fix: gate alembic autogenerate on OWNED_TABLES (shared kernel DB) #19

Merged
john merged 1 commit from fix/alembic-owned-tables into dev 2026-08-03 21:30:35 +00:00
Owner
No description provided.
fix(alembic): gate autogenerate on OWNED_TABLES
All checks were successful
CI / Detect Changes (pull_request) Successful in 20s
CI / Backend (pull_request) Successful in 8s
CI / Deploy (pull_request) Has been skipped
CI / Docker Build (pull_request) Successful in 1m54s
d703a5e502
Every app in the fleet shares one PostgreSQL database with its own Alembic
chain. Without an include_object filter, "alembic revision --autogenerate"
and "alembic check" here diff this app's models against every table in that
shared database and propose a DROP TABLE for each one they cannot account for.

Measured on a scratch Postgres built by replaying all five chains in
production order: an unfiltered "alembic check" in this repo proposed
dropping 52 tables, including flightplan_item, workstream_member, task,
client, contract, milestone, corporate_document, and the sales / pm / legal
alembic_version_* tables.

env.py now restricts the metadata diff to OWNED_TABLES, the tables this
repo's own alembic/versions/ chain creates. Mirrors haskos-engineering.
Migration execution is unaffected; include_object gates comparison only.

After the filter, "alembic check" reports 2 operations, both pre-existing
model/migration drift on this app's own tables and both reproducing against
production: billing_profile_invoice_prefix_key and ix_invoice_status exist in
the database and are not declared on the models. Left alone here — findings,
not this change's scope.

invoice is also created by smeos revision x8y9z0a1b2c3 and is kept as owned
regardless: this chain creates it IF NOT EXISTS and then reshapes it onto
entity_id in 003. payable and payment are deliberately excluded — 003 dropped
both in favour of obligation + settlement and neither exists in production.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N3dX8e8auAw8q86bGSLd4S
john merged commit 44e9bdb195 into dev 2026-08-03 21:30:35 +00:00
john deleted branch fix/alembic-owned-tables 2026-08-03 21:30:35 +00:00
Sign in to join this conversation.
No reviewers
No labels
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
haskytech/haskos-finance!19
No description provided.