fix: Resolve issue with sync migration
This commit is contained in:
parent
9b6cbaf389
commit
1ef5805c57
1 changed files with 8 additions and 4 deletions
|
|
@ -27,6 +27,12 @@ def upgrade() -> None:
|
||||||
connection = op.get_bind()
|
connection = op.get_bind()
|
||||||
inspector = sa.inspect(connection)
|
inspector = sa.inspect(connection)
|
||||||
|
|
||||||
|
if op.get_context().dialect.name == "postgresql":
|
||||||
|
syncstatus_enum = postgresql.ENUM(
|
||||||
|
"STARTED", "IN_PROGRESS", "COMPLETED", "FAILED", "CANCELLED", name="syncstatus"
|
||||||
|
)
|
||||||
|
syncstatus_enum.create(op.get_bind(), checkfirst=True)
|
||||||
|
|
||||||
if "sync_operations" not in inspector.get_table_names():
|
if "sync_operations" not in inspector.get_table_names():
|
||||||
if op.get_context().dialect.name == "postgresql":
|
if op.get_context().dialect.name == "postgresql":
|
||||||
syncstatus = postgresql.ENUM(
|
syncstatus = postgresql.ENUM(
|
||||||
|
|
@ -36,8 +42,7 @@ def upgrade() -> None:
|
||||||
"FAILED",
|
"FAILED",
|
||||||
"CANCELLED",
|
"CANCELLED",
|
||||||
name="syncstatus",
|
name="syncstatus",
|
||||||
create_type=True,
|
create_type=False,
|
||||||
checkfirst=True,
|
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
syncstatus = sa.Enum(
|
syncstatus = sa.Enum(
|
||||||
|
|
@ -47,8 +52,7 @@ def upgrade() -> None:
|
||||||
"FAILED",
|
"FAILED",
|
||||||
"CANCELLED",
|
"CANCELLED",
|
||||||
name="syncstatus",
|
name="syncstatus",
|
||||||
create_type=True,
|
create_type=False,
|
||||||
checkfirst=True,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Table doesn't exist, create it normally
|
# Table doesn't exist, create it normally
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue