Skip to content
This repository was archived by the owner on Jun 5, 2025. It is now read-only.

Fixes on migration ON_DELETE_CASCADE #708

Merged
merged 2 commits into from
Jan 22, 2025
Merged

Fixes on migration ON_DELETE_CASCADE #708

merged 2 commits into from
Jan 22, 2025

Conversation

aponcedeleonch
Copy link
Contributor

We were under the believe that alembic migrations were running inside a transaction because of Alembic's doc

At the very least, it contains instructions to configure and generate a SQLAlchemy engine, procure a connection from that engine along with a transaction, and then invoke the migration engine, using the connection as a source of database connectivity.

However, experience proved us wrong. This PR explicitly declares a transaction on the migration.

It also explicitly turns off FKs. The migration violates on purpose some constraints to move data between tables.

@aponcedeleonch aponcedeleonch requested a review from JAORMX January 22, 2025 08:40
@aponcedeleonch aponcedeleonch merged commit f313dda into main Jan 22, 2025
4 checks passed
@aponcedeleonch aponcedeleonch deleted the fix-migration branch January 22, 2025 08:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants