more robust migrations

This commit is contained in:
2025-06-02 18:58:48 +02:00
parent 4dbaa27cba
commit 5c6c3f436e
51 changed files with 401 additions and 273 deletions

View File

@@ -25,18 +25,18 @@ def upgrade():
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
conn = op.get_bind()
conn = op.get_bind()
inspector = inspect(conn)
tables = inspector.get_table_names()
if 'template_variables' not in tables:
op.create_table('template_variables',
sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
sa.Column('notification_type', sa.VARCHAR(length=50), autoincrement=False, nullable=False),
sa.Column('variable_name', sa.VARCHAR(length=50), autoincrement=False, nullable=False),
sa.Column('description', sa.VARCHAR(length=200), autoincrement=False, nullable=False),
sa.Column('example_value', sa.VARCHAR(length=200), autoincrement=False, nullable=True),
sa.Column('created_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
sa.PrimaryKeyConstraint('id', name=op.f('template_variables_pkey'))
)
# ### end Alembic commands ###
sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
sa.Column('notification_type', sa.VARCHAR(length=50), autoincrement=False, nullable=False),
sa.Column('variable_name', sa.VARCHAR(length=50), autoincrement=False, nullable=False),
sa.Column('description', sa.VARCHAR(length=200), autoincrement=False, nullable=False),
sa.Column('example_value', sa.VARCHAR(length=200), autoincrement=False, nullable=True),
sa.Column('created_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
sa.PrimaryKeyConstraint('id', name=op.f('template_variables_pkey'))
)
# ### end Alembic commands ###