Skip to content

Commit

Permalink
Fixes for using PostgreSQL (#2467)
Browse files Browse the repository at this point in the history
Created enum types should also be dropped on downgrade. Dropping tables
must be committed to become visible.
  • Loading branch information
matrss authored Aug 22, 2024
1 parent da36488 commit 4344e00
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ def upgrade():
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('permissions')
sa.Enum(name='access_level').drop(op.get_bind(), checkfirst=False)
op.drop_table('messages')
sa.Enum(name='messagetype').drop(op.get_bind(), checkfirst=False)
op.drop_table('changes')
op.drop_table('users')
op.drop_table('operations')
Expand Down
1 change: 1 addition & 0 deletions tests/_test_mscolab/test_migrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def test_upgrade_from(revision, iterations, mscolab_app, tmp_path):
with mscolab_app.app_context():
db.drop_all()
db.session.execute(sqlalchemy.text("DROP TABLE alembic_version"))
db.session.commit()
inspector = sqlalchemy.inspect(db.engine)
existing_tables = inspector.get_table_names()
assert existing_tables == []
Expand Down

0 comments on commit 4344e00

Please sign in to comment.