diff --git a/hindsight-api/alembic/env.py b/hindsight-api/alembic/env.py index 7dee2da8..754b1ce6 100644 --- a/hindsight-api/alembic/env.py +++ b/hindsight-api/alembic/env.py @@ -126,6 +126,7 @@ def run_migrations_online() -> None: with connectable.connect() as connection: # Also explicitly set read-write mode on this connection connection.execute(text("SET SESSION CHARACTERISTICS AS TRANSACTION READ WRITE")) + connection.commit() # Commit the SET command context.configure( connection=connection, @@ -135,6 +136,9 @@ def run_migrations_online() -> None: with context.begin_transaction(): context.run_migrations() + # Explicit commit to ensure changes are persisted (especially for Supabase) + connection.commit() + if context.is_offline_mode(): run_migrations_offline()