Skip to content

Commit

Permalink
Fix the migration
Browse files Browse the repository at this point in the history
  • Loading branch information
tino097 committed May 6, 2024
1 parent 97e8d7d commit 79de9bd
Showing 1 changed file with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,27 @@

def upgrade():
# upgrade jobs table if it not exists
if _check_column_exists("jobs", "aps_job_id"):
return
else:
if not _check_column_exists("jobs", "aps_job_id"):
op.add_column(
"jobs",
sa.Column("aps_job_id", sa.UnicodeText),
)

# upgrade logs table
if _check_column_exists("logs", "id"):
return
else:
if not _check_column_exists("logs", "id"):
op.add_column(
"logs",
sa.Column("id", sa.Integer, primary_key=True, autoincrement=True),
)


def downgrade():
pass
# downgrade jobs table
if _check_column_exists("jobs", "aps_job_id"):
op.drop_column("jobs", "aps_job_id")

# downgrade logs table
if _check_column_exists("logs", "id"):
op.drop_column("logs", "id")


def _check_column_exists(table_name, column_name):
Expand Down

0 comments on commit 79de9bd

Please sign in to comment.