Skip to content

feat(db): mirror ZoneMinder 1.39.42-57 - #290

Open
SteveGilvarry wants to merge 1 commit into
ZoneMinder:masterfrom
SteveGilvarry:feat/zm-schema-1.39.57
Open

SteveGilvarry wants to merge 1 commit into
ZoneMinder:masterfrom
SteveGilvarry:feat/zm-schema-1.39.57

Conversation

@SteveGilvarry

Copy link
Copy Markdown
Member

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.

Version Change
1.39.42 MonitorActions.Schedule; TriggerOn gains Schedule
1.39.43 CronJobs table
1.39.44 HeroSpeed L5TW / L5BW controls
1.39.45 Monitors.Go2RTCDisableBackChannel
1.39.46 stock "Update DiskSpace" filter removed
1.39.49 Axis/Vivotek/ACTi Ffmpeg presets: url moved from Host to Path
1.39.51 Tags.Name to utf8mb4_bin (MySQL)
1.39.52 clean-up of upgraded schemas (Janus columns, Stats keys and indexes, two index names, Object_Types.Id), mirrored with its guards; a no-op on a schema this crate creates
1.39.53 three presets pointed at the wrong control
1.39.54 Zones.ObjectCoords
1.39.55 Filters.AutoTag, AutoTagId
1.39.56 Users.Language varchar(16)
1.39.57 Monitors.ONVIF_Event_Tags, AI_Object_Classes.Aliases, the Camera dataset and starter aliases (camera_classes.sql)

Vendored from ZoneMinder fc2bb717f: the 13 update files, zm_create.sql.in, controls.sql, AI_Models.sql and the new camera_classes.sql. zm_config.sql is regenerated from the same commit (ZM_OPT_FAST_DELETE gone, ZM_ALLOWED_COMMANDS new). The cutover moves to 1.39.57.

Postgres

Two fixes MySQL doesn't need:

  • MonitorPresets.ControlId is a varchar, so 1.39.53's control-id subqueries are cast there.
  • The AI_Datasets sequence is resynced before the Camera insert. The COCO seed inserted an explicit id, which left the sequence behind (new resync_sequence helper).

Verified locally

  • schema-parity: structure OK (57 tables), seeds OK
  • upgrade-parity from 1.34.26, 1.36.35 and 1.38.3: OK
  • postgres-schema: OK, 756 columns match
  • Re-running the 13 mirrors on an already-migrated schema changes nothing (920 lines of columns, indexes and seed counts compared).
  • On a copy of a real database that ZoneMinder 1.39.57's own zmupdate.pl had upgraded (zm-api had recorded up to 1.39.41), mirrors 42-57 run cleanly and change nothing.
  • cargo test --all-features: 1434 passed. The schema_gate DB tests pass; the rest of the DB-backed suite is left to CI.

🤖 Generated with Claude Code

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 branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant