fix: update database URL to use 0.0.0.0 and adjust Alembic migration configurations
This commit is contained in:
+8
-13
@@ -28,8 +28,8 @@ def run_migrations_offline() -> None:
|
||||
target_metadata=target_metadata,
|
||||
literal_binds=True,
|
||||
dialect_opts={"paramstyle": "named"},
|
||||
compare_type=True,
|
||||
compare_server_default=True,
|
||||
# compare_type=True,
|
||||
# compare_server_default=True,
|
||||
)
|
||||
|
||||
with context.begin_transaction():
|
||||
@@ -41,8 +41,8 @@ def do_run_migrations(connection: Connection) -> None:
|
||||
context.configure(
|
||||
connection=connection,
|
||||
target_metadata=target_metadata,
|
||||
compare_type=True,
|
||||
compare_server_default=True,
|
||||
# compare_type=True,
|
||||
# compare_server_default=True,
|
||||
)
|
||||
|
||||
with context.begin_transaction():
|
||||
@@ -67,12 +67,7 @@ async def run_migrations_online() -> None:
|
||||
await connectable.dispose()
|
||||
|
||||
|
||||
def main() -> None:
|
||||
if context.is_offline_mode():
|
||||
run_migrations_offline()
|
||||
else:
|
||||
asyncio.run(run_migrations_online())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
if context.is_offline_mode():
|
||||
run_migrations_offline()
|
||||
else:
|
||||
asyncio.run(run_migrations_online())
|
||||
|
||||
@@ -13,20 +13,38 @@ depends_on: tuple[str, ...] | None = None
|
||||
|
||||
def upgrade() -> None:
|
||||
organization_role = sa.Enum(
|
||||
"owner", "admin", "manager", "member", name="organization_role"
|
||||
"owner",
|
||||
"admin",
|
||||
"manager",
|
||||
"member",
|
||||
name="organization_role",
|
||||
create_type=False,
|
||||
)
|
||||
deal_status = sa.Enum(
|
||||
"new",
|
||||
"in_progress",
|
||||
"won",
|
||||
"lost",
|
||||
name="deal_status",
|
||||
create_type=False,
|
||||
)
|
||||
deal_stage = sa.Enum(
|
||||
"qualification",
|
||||
"proposal",
|
||||
"negotiation",
|
||||
"closed",
|
||||
name="deal_stage",
|
||||
create_type=False,
|
||||
)
|
||||
deal_status = sa.Enum("new", "in_progress", "won", "lost", name="deal_status")
|
||||
deal_stage = sa.Enum("qualification", "proposal", "negotiation", "closed", name="deal_stage")
|
||||
activity_type = sa.Enum(
|
||||
"comment", "status_changed", "task_created", "system", name="activity_type"
|
||||
"comment",
|
||||
"status_changed",
|
||||
"task_created",
|
||||
"system",
|
||||
name="activity_type",
|
||||
create_type=False,
|
||||
)
|
||||
|
||||
bind = op.get_bind()
|
||||
organization_role.create(bind, checkfirst=True)
|
||||
deal_status.create(bind, checkfirst=True)
|
||||
deal_stage.create(bind, checkfirst=True)
|
||||
activity_type.create(bind, checkfirst=True)
|
||||
|
||||
op.create_table(
|
||||
"organizations",
|
||||
sa.Column("id", sa.Integer(), nullable=False),
|
||||
@@ -212,12 +230,36 @@ def downgrade() -> None:
|
||||
op.drop_table("organizations")
|
||||
|
||||
organization_role = sa.Enum(
|
||||
"owner", "admin", "manager", "member", name="organization_role"
|
||||
"owner",
|
||||
"admin",
|
||||
"manager",
|
||||
"member",
|
||||
name="organization_role",
|
||||
create_type=False,
|
||||
)
|
||||
deal_status = sa.Enum(
|
||||
"new",
|
||||
"in_progress",
|
||||
"won",
|
||||
"lost",
|
||||
name="deal_status",
|
||||
create_type=False,
|
||||
)
|
||||
deal_stage = sa.Enum(
|
||||
"qualification",
|
||||
"proposal",
|
||||
"negotiation",
|
||||
"closed",
|
||||
name="deal_stage",
|
||||
create_type=False,
|
||||
)
|
||||
deal_status = sa.Enum("new", "in_progress", "won", "lost", name="deal_status")
|
||||
deal_stage = sa.Enum("qualification", "proposal", "negotiation", "closed", name="deal_stage")
|
||||
activity_type = sa.Enum(
|
||||
"comment", "status_changed", "task_created", "system", name="activity_type"
|
||||
"comment",
|
||||
"status_changed",
|
||||
"task_created",
|
||||
"system",
|
||||
name="activity_type",
|
||||
create_type=False,
|
||||
)
|
||||
|
||||
bind = op.get_bind()
|
||||
|
||||
Reference in New Issue
Block a user