fix: skip enum upgrade before initial schema creation
This commit is contained in:
@@ -118,6 +118,12 @@ def _upgrade_postgresql_alert_type(connection: Connection) -> None:
|
||||
"""Permit the degraded alert value for databases using PostgreSQL enums."""
|
||||
if connection.dialect.name == "postgresql":
|
||||
enum_name = AlertEvent.__table__.c.alert_type.type.name
|
||||
enum_exists = connection.execute(
|
||||
text("SELECT 1 FROM pg_type WHERE typname = :enum_name"),
|
||||
{"enum_name": enum_name},
|
||||
).scalar_one_or_none()
|
||||
if enum_exists is None:
|
||||
return
|
||||
connection.execute(
|
||||
text(
|
||||
f"ALTER TYPE {_quote(connection, enum_name)} "
|
||||
|
||||
Reference in New Issue
Block a user