Commit Graph
18 Commits
Author SHA1 Message Date
Isaac ConnorandClaude Opus 5.5 c4ef3fdd62 feat: key Frames by (EventId, FrameId) and drop the surrogate Id refs #5164
Every query on Frames filters on EventId and orders or ranges by FrameId,
and nothing needs a frame by Id. The Id primary key was a clustered index
nothing read, and EventId_FrameId_idx was a secondary index every query
used. On a copy of a local table that secondary index was half the
table's size. With (EventId, FrameId) as the primary key the index is
gone, and an event's rows are stored together, so deleting an event is a
range delete.

zm_update-1.39.36.sql:
- converts AI_Detections.FrameId from Frames.Id to the per-event frame
  number, drops its foreign key to Frames and indexes (EventId, FrameId).
  A composite foreign key cannot replace it: ON DELETE SET NULL would
  have to null the NOT NULL EventId, and Frames rows are written in
  batches, so a detection can be recorded before its frame row.
- removes duplicate (EventId, FrameId) rows, keeping the earliest.
- rebuilds Frames with the new primary key.
- removes ON UPDATE CURRENT_TIMESTAMP from Frames.TimeStamp. Any UPDATE
  of a frame row was overwriting its capture time.
Each step checks the current schema first, so the migration can be
re-run.

REST API: view, edit and delete take /frames/<action>/<EventId>/<FrameId>.json.
The old single-Id URLs return 404. CakePHP 2 has no composite keys, so
the model's primaryKey is EventId. That keeps Event's dependent cascade
delete limited to the event's own frames. The controller writes with
explicit (EventId, FrameId) conditions instead of save(), which would
match rows on EventId alone. Edit no longer changes EventId or FrameId.

view=image with fid but no eid used to look up Frames.Id. It now returns
404.

The Perl Frame class is identified by (EventId, FrameId).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 11:48:26 -04:00
adhamiamirhossein 27977acdd4 fix: php 8.3 deprecated get_class method call without argument 2023-11-22 10:48:04 +03:30
Isaac Connor 4c3ea7125d Add defaults to Frame 2019-09-22 14:21:59 -04:00
Isaac Connor 0a0bb1b326 Update Frame and Server Objects to use common methods 2019-09-19 16:24:05 -04:00
Isaac Connor 8dd8888975 Php namespace (#2537)
* experiment with namespaces on the Server class

* experiment with namespaces on the Server class

* Implement the ZM namespace on objects

* Implement the ZM namespace on objects

* Implement the ZM namespace on objects
2019-02-22 09:19:07 -05:00
Matthew Noorenberghe a97711de89 Replace or sanitize remaining uses of PHP_SELF. Fixes #2446 2019-02-09 22:12:36 -08:00
Isaac Connor f2b38f175d Update Frame::find_one so that we can specify an ordering for find_one and so that semantics match other objects find methods 2018-10-11 09:14:40 -04:00
Isaac Connor ac775f13f6 always return an array from find_all 2018-04-20 14:23:27 -04:00
Isaac Connor d312482a2b add StorageScheme to Storage and Events. Deprecate ZM_USE_DEEP_STORAGE 2017-12-18 12:52:26 -05:00
Isaac Connor ba4e5572d6 add setting of values to anonymouse member function 2017-10-17 10:09:14 -07:00
Isaac Connor 7f50a13074 add Event disk space recalc to zmaudit 2017-10-10 12:11:59 -07:00
Isaac Connor 8b3b9eb30e more merges/fixes from SA 2017-05-30 13:47:30 -04:00
Isaac Connor ac8b09e89c merge some trivial updates from storageareas 2017-05-16 14:14:07 -04:00
Isaac Connor b5e4c94682 test for integer string as well 2016-12-08 15:58:00 -05:00
Isaac Connor e7d0861530 check limit for a valid integer and complain if not. 2016-12-08 13:37:23 -05:00
Isaac Connor 3dadcc8d32 add ability to pass show=capture or show=analyse to getImageSrc 2016-08-12 15:14:51 -04:00
Isaac Connor 235095ed5f fix URL to image view 2016-05-16 10:32:43 -04:00
Isaac Connor c050969141 Merge object model classes from storageareas 2016-05-05 15:33:28 -04:00