Fix migration 0001_initial: double CREATE TYPE crashes every clean bootstrap
world_visibility and asset_type were each declared twice: once explicitly via `.create(checkfirst=True)`, and again implicitly by SQLAlchemy when create_table() compiled the inline postgresql.ENUM() column type (which defaults create_type=True). On a genuinely empty database this raises asyncpg.DuplicateObjectError mid-transaction and the migration never completes -- verified this was true 100% of the time from a fresh container, meaning the backend has never successfully bootstrapped from scratch. Fixed by passing create_type=False on the inline column declarations, since the type is already created explicitly above. Also parameterized both services' host ports (POSTGRES_HOST_PORT / REDIS_HOST_PORT, defaulting to the original 5432/6379) so concurrent agent workspaces sharing this same docker-compose.yml can run isolated databases without colliding on the host port.
This commit is contained in:
@@ -69,7 +69,8 @@ def upgrade() -> None:
|
||||
sa.Column(
|
||||
"visibility",
|
||||
postgresql.ENUM(
|
||||
"public", "private", "friends_only", name="world_visibility"
|
||||
"public", "private", "friends_only", name="world_visibility",
|
||||
create_type=False,
|
||||
),
|
||||
nullable=True,
|
||||
),
|
||||
@@ -89,7 +90,7 @@ def upgrade() -> None:
|
||||
"asset_type",
|
||||
postgresql.ENUM(
|
||||
"image", "audio", "video", "document", "model_3d", "other",
|
||||
name="asset_type",
|
||||
name="asset_type", create_type=False,
|
||||
),
|
||||
nullable=False,
|
||||
),
|
||||
|
||||
@@ -8,7 +8,7 @@ services:
|
||||
POSTGRES_PASSWORD: agp_password
|
||||
POSTGRES_DB: agp_db
|
||||
ports:
|
||||
- "5432:5432"
|
||||
- "${POSTGRES_HOST_PORT:-5432}:5432"
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
@@ -20,7 +20,7 @@ services:
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
ports:
|
||||
- "6379:6379"
|
||||
- "${REDIS_HOST_PORT:-6379}:6379"
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
healthcheck:
|
||||
|
||||
Reference in New Issue
Block a user