Adjusted the migrations so they work on the prod db
This commit is contained in:
@@ -178,9 +178,18 @@ def upgrade() -> None:
|
||||
["room_number"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_acked_requests_username"), "acked_requests", ["username"], unique=False
|
||||
)
|
||||
# Create index on acked_requests if it doesn't exist
|
||||
connection = op.get_bind()
|
||||
inspector = sa.inspect(connection)
|
||||
|
||||
# Get existing indices on acked_requests
|
||||
acked_requests_indices = [idx['name'] for idx in inspector.get_indexes('acked_requests')]
|
||||
|
||||
# Only create index if it doesn't exist
|
||||
if "ix_acked_requests_username" not in acked_requests_indices:
|
||||
op.create_index(
|
||||
op.f("ix_acked_requests_username"), "acked_requests", ["username"], unique=False
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user