Skip to content

Commit

Permalink
Merge pull request #172 from dathere/migration-added
Browse files Browse the repository at this point in the history
Migration added
  • Loading branch information
tino097 authored Oct 30, 2024
2 parents 452afec + a854720 commit 8c86c1e
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,16 @@


def upgrade():
op.add_column('jobs', sa.Column('job_key', sa.UnicodeText(), nullable=True))
if not _check_column_exists('jobs', 'job_key'):
op.add_column('jobs', sa.Column('job_key', sa.UnicodeText(), nullable=True))


def downgrade():
op.drop_column('jobs', 'job_key')


def _check_column_exists(table_name, column_name):
bind = op.get_bind()
insp = sa.engine.reflection.Inspector.from_engine(bind)
columns = insp.get_columns(table_name)
return column_name in [column["name"] for column in columns]

0 comments on commit 8c86c1e

Please sign in to comment.