bbd353ff38
Migration 0001 uses Base.metadata.create_all() which creates ALL tables from current models.py, causing subsequent migrations (0015+) to fail with "already exists" errors when they try to re-create constraints, indexes, columns, and tables. Three-layer fix: 1. migrations.py: detect fresh DB (no tables) and bootstrap via create_all() + stamp head, bypassing all migrations entirely. 2. models.py: add EmailTemplate model, CheckConstraints to LandingPage, and indexes to GuestPurchase so create_all() produces a complete schema identical to running all 30 migrations sequentially. 3. Idempotency guards in migrations 0015-0030: _has_unique_constraint, _has_table, _has_index, _has_column, _has_check_constraint checks before DDL operations, protecting against re-runs via make migrate.