mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-03 19:42:55 +00:00
Problem Neon and Hadron deployments have the same database schema, but different migration histories. Some transactions have different identifiers too. If we don't do anything about it, then the storage controller would fail to apply the merged set of transactions. Summary of Changes We squash all migrations into a single one. If the schema already matches, then the new transaction gets applie without doing anything. For new regions, this migration will bootstrap the database schema. This should be merged in both neon and hadron codebases. Note that after deploying this change, the `__diesel_schema_migrations` table will still contain entries for the old pre-squash transactions. This is fine because diesel only considers the tranasactions embedded in the repo for application. Once we are certain that we are not going to roll back, we can clean up the `__diesel_schema_migrations` tables in prod, but this is manual and error prone, so I'd skip it. Rolling back Rolling back to a previous deployment which embeds the non-squashed transactions is safe. The old transactions are still present in `__diesel_schema_migrations` (i.e. considered applied), so no migrations will be run, so no migrations will be run. Note that this assumes that all transactions are applied and squashed into the new migration before deployment.