Repository navigation
feat(db): mirror ZoneMinder 1.39.42-57 - #290
Open
SteveGilvarry wants to merge 1 commit into
Open
SteveGilvarry wants to merge 1 commit into
SteveGilvarry wants to merge 1 commit into
Conversation
Thirteen upstream updates (1.39.42-46, 49, 51-57; the other versions in that range changed no schema) are mirrored as SeaORM migrations, vendored into db/legacy for the bridge's raw chain, and the cutover moves to 1.39.57. zm_create.sql.in, controls.sql, AI_Models.sql and the new camera_classes.sql come from ZoneMinder fc2bb717f; zm_config.sql is regenerated from the same commit. Schema: MonitorActions.Schedule and a Schedule trigger (42), CronJobs (43), Monitors.Go2RTCDisableBackChannel (45), Tags.Name to utf8mb4_bin on MySQL (51), Zones.ObjectCoords (54), Filters.AutoTag/AutoTagId (55), Users.Language varchar(16) (56), Monitors.ONVIF_Event_Tags and AI_Object_Classes.Aliases (57). Data: HeroSpeed controls (44), the stock Update DiskSpace filter removed (46), preset url and control fixes (49, 53), the Camera dataset and starter aliases (57). 1.39.52's clean-up of upgraded schemas is mirrored with its guards; on a schema this crate creates every step is already true. Postgres needed two things MySQL does not: MonitorPresets.ControlId is a varchar, so 1.39.53's control-id subqueries are cast there; and the AI_Datasets sequence is resynced before the Camera insert, because the COCO seed's explicit id left it behind. New helpers: mysql_column_type, resync_sequence. The "schema already current" stamp now also requires the 1.39.43/55/57 markers. The API does not expose the new columns yet; the entities and endpoints follow separately. Verified locally: schema-parity (57 tables, seeds), upgrade-parity from 1.34.26, 1.36.35 and 1.38.3, postgres-schema (756 columns); the 13 mirrors re-run on an already-migrated schema change nothing, and run cleanly with no change on a copy of a database ZoneMinder's own zmupdate.pl brought to 1.39.57. cargo test: 1434 passed; schema_gate DB tests pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 29, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Brings zm-api's schema mirror from ZoneMinder 1.39.41 to 1.39.57, following the routine in
docs/DB_VERSIONING_PLAN.md(now phase 7). This is the schema half only; exposing the new columns through the API follows in a separate PR.ZoneMinder master is at 1.39.57 and its packages already migrate databases there, so a zm-api on such a host was stamping 16 versions it didn't know.
What's mirrored
13 upstream updates; 1.39.47, 48 and 50 changed no schema.
MonitorActions.Schedule;TriggerOngainsScheduleCronJobstableMonitors.Go2RTCDisableBackChannelHosttoPathTags.Nametoutf8mb4_bin(MySQL)Statskeys and indexes, two index names,Object_Types.Id), mirrored with its guards; a no-op on a schema this crate createsZones.ObjectCoordsFilters.AutoTag,AutoTagIdUsers.Languagevarchar(16)Monitors.ONVIF_Event_Tags,AI_Object_Classes.Aliases, theCameradataset and starter aliases (camera_classes.sql)Vendored from ZoneMinder
fc2bb717f: the 13 update files,zm_create.sql.in,controls.sql,AI_Models.sqland the newcamera_classes.sql.zm_config.sqlis regenerated from the same commit (ZM_OPT_FAST_DELETEgone,ZM_ALLOWED_COMMANDSnew). The cutover moves to 1.39.57.Postgres
Two fixes MySQL doesn't need:
MonitorPresets.ControlIdis a varchar, so 1.39.53's control-id subqueries are cast there.AI_Datasetssequence is resynced before theCamerainsert. The COCO seed inserted an explicit id, which left the sequence behind (newresync_sequencehelper).Verified locally
schema-parity: structure OK (57 tables), seeds OKupgrade-parityfrom 1.34.26, 1.36.35 and 1.38.3: OKpostgres-schema: OK, 756 columns matchzmupdate.plhad upgraded (zm-api had recorded up to 1.39.41), mirrors 42-57 run cleanly and change nothing.cargo test --all-features: 1434 passed. Theschema_gateDB tests pass; the rest of the DB-backed suite is left to CI.🤖 Generated with Claude Code