Make sure migration is atomic #25

Closed
opened 2020-01-26 20:12:56 +01:00 by midgard · 6 comments
midgard commented 2020-01-26 20:12:56 +01:00 (Migrated from git.zeus.gent)
https://docs.sqlalchemy.org/en/13/orm/session_api.html#sqlalchemy.orm.session.sessionmaker https://docs.sqlalchemy.org/en/13/orm/session_transaction.html#unitofwork-transaction But migrations use methods of module `alembic` and not SQL Alchemy directly.
midgard commented 2020-01-26 20:12:56 +01:00 (Migrated from git.zeus.gent)

changed milestone to %1

changed milestone to %1
midgard commented 2020-01-26 20:24:12 +01:00 (Migrated from git.zeus.gent)

changed the description

changed the description
midgard commented 2020-01-26 22:29:19 +01:00 (Migrated from git.zeus.gent)

This depends on the DDL. MySQL is non-transactional by Alembic's design. Nowadays MySQL does support transactions so Alembic should probably be changed.

This depends on the DDL. MySQL is non-transactional by Alembic's design. Nowadays MySQL does support transactions so Alembic should probably be changed.
midgard commented 2020-01-26 22:29:54 +01:00 (Migrated from git.zeus.gent)

As a workaround we could emit START TRANSACTION; and COMMIT; manually at the start and end of the migration.

As a workaround we could emit `START TRANSACTION;` and `COMMIT;` manually at the start and end of the migration.
midgard commented 2020-01-26 22:40:16 +01:00 (Migrated from git.zeus.gent)

Turns out, transactions in MySQL suck. E.g. CREATE TABLE can't be rolled back.

Thus, we cannot ensure atomic migrations.

Turns out, transactions in MySQL suck. E.g. `CREATE TABLE` can't be rolled back. Thus, we cannot ensure atomic migrations.
midgard commented 2020-01-26 22:40:17 +01:00 (Migrated from git.zeus.gent)

closed

closed
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Haldis/haldis#25
No description provided.