read.markets/alembic/versions
Giorgio Gilestro 78ce8c8b0d alembic: make migration chain SQLite-compatible (fresh upgrade)
Five existing migrations used op.alter_column / op.create_unique_constraint /
op.drop_constraint / op.create_foreign_key directly on the users + quotes +
quotes_daily tables. SQLite has no native support for those operations and
requires Alembic's batch_alter_table copy-and-rename workaround.

This wasn't noticed until now because the test suite uses
Base.metadata.create_all to materialise schema, not the migration chain
itself; and prod is MariaDB. But running `alembic upgrade head` against
a fresh SQLite database (developer onboarding, CI smoke tests, the
test container's own bootstrap) would fail at 0005.

Fixes:
- alembic/env.py: set render_as_batch=True when the dialect is SQLite.
  This auto-wraps any future autogenerated migration but doesn't
  retroactively rewrite existing op.* calls.
- 0005 (widen quotes.symbol), 0013 (referrals), 0018 (polar webhook),
  0019 (stripe), 0023 (users.lang index + qd_symbol widen) explicitly
  wrap their problematic ops in `with op.batch_alter_table(...) as bop`.

Now `alembic upgrade head` + `alembic downgrade base` round-trip cleanly
on a fresh SQLite database. MariaDB prod behaviour unchanged.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-28 00:16:09 +02:00
..
0001_initial_schema.py initial commit — cassandra v0.1 2026-05-15 21:56:10 +01:00
0002_position_name.py initial commit — cassandra v0.1 2026-05-15 21:56:10 +01:00
0003_log_tone_analysis.py initial commit — cassandra v0.1 2026-05-15 21:56:10 +01:00
0004_indicator_summaries.py add Eurostat + UK ONS sources; valuation/bubble/economy/bonds groups; aggregate read; market-open header 2026-05-15 23:07:42 +01:00
0005_widen_quote_symbol.py alembic: make migration chain SQLite-compatible (fresh upgrade) 2026-05-28 00:16:09 +02:00
0006_instrument_map.py phase B (1/4): CSV parser + InstrumentMap (T212 shortcode → Yahoo ticker) 2026-05-16 10:53:08 +01:00
0007_users.py phase A: user accounts + session-cookie auth 2026-05-16 11:12:10 +01:00
0008_email_otps.py phase G: data minimisation + passwordless auth + DeepSeek-first LLM 2026-05-18 14:16:57 +01:00
0009_ticker_universe.py phase G: data minimisation + passwordless auth + DeepSeek-first LLM 2026-05-18 14:16:57 +01:00
0010_drop_password.py phase G: data minimisation + passwordless auth + DeepSeek-first LLM 2026-05-18 14:16:57 +01:00
0011_drop_portfolio_tables.py phase G: data minimisation + passwordless auth + DeepSeek-first LLM 2026-05-18 14:16:57 +01:00
0012_headlines_tags.py news: auto-tag headlines + market-aware cadence + filter UI 2026-05-21 23:25:03 +01:00
0013_referrals.py alembic: make migration chain SQLite-compatible (fresh upgrade) 2026-05-28 00:16:09 +02:00
0014_user_credit_until.py phase D milestones 1+2: referral system + paid-access gate 2026-05-21 23:25:35 +01:00
0015_portfolio_sync.py sync: encrypted cloud backup for portfolios + settings UX rework 2026-05-23 16:15:54 +02:00
0016_portfolio_sync_pepper_fp.py sync: detect orphaned blobs (pepper rotation) + fix AESGCM arg order 2026-05-25 12:49:11 +02:00
0017_email_digest.py db: drop redundant user_id index on email_sends 2026-05-25 22:55:33 +02:00
0018_polar_webhook.py alembic: make migration chain SQLite-compatible (fresh upgrade) 2026-05-28 00:16:09 +02:00
0019_stripe.py alembic: make migration chain SQLite-compatible (fresh upgrade) 2026-05-28 00:16:09 +02:00
0020_trial_end.py stripe: per-cadence cooling-off + manage-subscription button 2026-05-26 20:06:19 +02:00
0021_csv_format_template.py alembic: use sa.text() for integer server_defaults in 0021 2026-05-27 12:06:05 +02:00
0022_localization.py alembic: add 0022 localization (users.lang + strategic_log_translations) 2026-05-27 16:53:27 +02:00
0023_lang_index_and_qd_symbol_widen.py alembic: make migration chain SQLite-compatible (fresh upgrade) 2026-05-28 00:16:09 +02:00
0024_ind_summary_translations.py i18n: localize indicator summaries (per-group + aggregate read) 2026-05-27 20:19:47 +02:00
0025_align_translation_columns.py models: align translation column naming + add token counts 2026-05-27 21:18:29 +02:00