chore(db): drop the legacy counting_cameras.zone_name column #209
Labels
No labels
blocked
bug
enhancement
high-priority
low-priority
needs-info
needs-triage
ready-for-agent
ready-for-human
referenced
research
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gabogg/hikcentral#209
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Blocked by: #200Unblocked 2026-10-03: #200 closed when #168 merged (016a012). #168 left the camera INSERTs writing a literal'General'into this column. Removing those writes is part of this issue, and it supersedes #220 item 3.Agent Brief
Category: enhancement (cleanup)
Summary: Drop the legacy
counting_cameras.zone_namecolumn once #200 has stopped every read and write of it.Current behavior (after #200):
counting_cameras.zone_name TEXT NOT NULL DEFAULT 'General'stays in the table, unused and marked legacy.camera_group, derived from their linked Camera Group.Desired behavior:
NOT NULLportably, so rebuild the table:camera_index_code, name, direction, active/excluded flags, the day's counts,last_event_time,updated_atandresource_group_code.CREATE TABLEand from any remaining code reference.Acceptance criteria:
zone_nameand data), startup removes the column and keeps every row and every other value.counting_camerasexist after the migration, andPRAGMA foreign_key_checkis clean.zone_nameremains.Out of scope:
Low priority: the column is harmless while unused. This is housekeeping, not a fix.
Refs #200, #99, PR #168.
Maintainer decision (2026-10-03), from PR #234 review pass 1: the premise "SQLite can't drop a column that has a default and NOT NULL portably, so rebuild the table" is wrong. On SQLite 3.35+ (we have 3.51, and Python 3.11+ on Windows bundles a new enough version),
ALTER TABLE counting_cameras DROP COLUMN zone_namekeeps every row, index and trigger. The migration becomes one inline, guardedDROP COLUMNin the existing style, plus a startup check for SQLite >= 3.35. The other acceptance criteria stand.