I've a simple migration script which is supposed to create a few tables.
For brevity, this is basically the content:
op.create_table(
'a',
sa.Column('id', sa.BIGINT, primary_key=True),
)
op.create_table(
'b',
sa.Column('id', sa.BIGINT, primary_key=True),
sa.Column('id', sa.BIGINT, primary_key=True),
)
Table b
has two id
columns, which causes an error.
After fixing and restarting the server, I get an error for the fact, that table a
already exists.
The table alembic_version
does not contain a record of this revision:
mysql> select * from alembic_version;
Empty set (0.00 sec)
Yet the table actually exists:
mysql> show tables;
+-------------------------+
| Tables_in_fingerprinter |
+-------------------------+
| alembic_version |
| a |
+-------------------------+
How can I make sure that alembic puts everything into one transaction and avoid committing partial changes to the database?