refactor(backend): Alembic owns the local schema; v1 ALTER list deleted
Platform v2 step 1.0 (APPS_PLATFORM D-13, D-17). - migrations/ with env.py (render_as_batch, models/all.py metadata, no fileConfig) and baseline 0001_v2_baseline autogenerated from the models and reviewed; it also seeds the pos_settings rows a fresh v1 install got - core/schema.py::upgrade_to_head() is the only way the schema is built: app startup, seed.py, demo_seed.py, wipe_database.py and the tests. It refuses v1 databases (tables without alembic_version) with a clear error - main.py: _run_migrations() and create_all removed (723 lines) - sync_events became a model (was raw DDL); price_event_log order indexes declared on the model; unused order_discounts.price_before/after dropped - tests/guards: no-drift + idempotent upgrade + install defaults + v1 refusal + no create_all; placeholders for the time (1.1) and access (1.5) guards - CS-1 rewritten for Alembic on this branch Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
"""Import every model module so Base.metadata knows the whole schema.
|
||||
|
||||
Used by main.py (app startup), migrations/env.py (Alembic autogenerate) and
|
||||
the tests. Agent note: a new model module MUST be added here, or Alembic
|
||||
autogenerate will not see it and the drift guard (tests/guards) will not
|
||||
catch it either.
|
||||
"""
|
||||
import models.user # noqa: F401 also registers WaiterZone
|
||||
import models.table # noqa: F401
|
||||
import models.printer # noqa: F401
|
||||
import models.product # noqa: F401
|
||||
import models.customers # noqa: F401
|
||||
import models.order # noqa: F401 also registers OrderAuditLog, OrderDiscount, PrintJob
|
||||
import models.business_day # noqa: F401
|
||||
import models.shift # noqa: F401 WaiterShift, ShiftBreak
|
||||
import models.settings # noqa: F401
|
||||
import models.flag # noqa: F401 TableFlagDef, TableFlagAssignment
|
||||
import models.message # noqa: F401 StaffMessage, StaffMessageAck, QuickMessageTemplate
|
||||
import models.reservation # noqa: F401
|
||||
import models.notes # noqa: F401 SiteNote, SiteTodo
|
||||
import models.expenses # noqa: F401 Contact, Expense, ExpensePayment
|
||||
import models.tabs # noqa: F401 Tab, TabEntry, TabPayment
|
||||
import models.waste # noqa: F401 WasteLog
|
||||
import models.schedule # noqa: F401 ScheduledShift
|
||||
import models.chat # noqa: F401 Conversation, ConversationParticipant, ChatMessage
|
||||
import models.prep_zone # noqa: F401 PrepZone, prep_zone_printers, product_prep_zones
|
||||
import models.pricing # noqa: F401 PriceGroup, PriceModifier, Deal, PriceEventLog, WaiterDiscountSettings
|
||||
import models.recovery_code # noqa: F401
|
||||
import models.sync_event # noqa: F401
|
||||
Reference in New Issue
Block a user