refactor(db): drop the occupancy_settings_audit CHECK rebuild that never runs on shipped databases #256

Open
opened 2026-10-03 10:45:36 +00:00 by gabogg · 0 comments
Owner

P3 follow-up from PR #177 review pass 5 (standards axis).

Finding

app/db/database.py (~508-536) rebuilds occupancy_settings_audit in place (RENAME, CREATE, INSERT ... SELECT *, DROP) to add CANCELLATION to its CHECK constraint.

  • The table first ships with #177, so every production DB creates it with the new CHECK, and the rebuild only ever ran on dev DBs that tracked the branch.
  • SELECT * relies on both definitions having the same column order.
  • No test covers the rebuild.
  • It is atomic only because earlier DML in _run_schema happened to open a transaction.
  • The maintainer had the same kind of rebuild replaced in PR #234.

Acceptance Criteria

  • Remove the rebuild block. The CREATE TABLE with the four-action CHECK stays the only definition.
  • Fresh-DB tests still pass.
P3 follow-up from PR #177 review pass 5 (standards axis). ### Finding `app/db/database.py` (~508-536) rebuilds `occupancy_settings_audit` in place (RENAME, CREATE, `INSERT ... SELECT *`, DROP) to add `CANCELLATION` to its CHECK constraint. - The table first ships with #177, so every production DB creates it with the new CHECK, and the rebuild only ever ran on dev DBs that tracked the branch. - `SELECT *` relies on both definitions having the same column order. - No test covers the rebuild. - It is atomic only because earlier DML in `_run_schema` happened to open a transaction. - The maintainer had the same kind of rebuild replaced in PR #234. ### Acceptance Criteria - Remove the rebuild block. The `CREATE TABLE` with the four-action CHECK stays the only definition. - Fresh-DB tests still pass.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gabogg/hikcentral#256
No description provided.