fix: make migration 104 idempotent with if_not_exists on index creation

The notification composite indexes may already exist from the model's
__table_args__, causing DuplicateTableError on fresh migrations.
This commit is contained in:
CREDO23 2026-03-23 20:22:48 +02:00
parent 7d7d032e78
commit 29b9cc814f

View file

@ -30,21 +30,25 @@ def upgrade() -> None:
"ix_notifications_user_read_type_created",
"notifications",
["user_id", "read", "type", "created_at"],
if_not_exists=True,
)
op.create_index(
"ix_notifications_user_space_created",
"notifications",
["user_id", "search_space_id", "created_at"],
if_not_exists=True,
)
op.create_index(
"ix_notifications_type",
"notifications",
["type"],
if_not_exists=True,
)
op.create_index(
"ix_notifications_search_space_id",
"notifications",
["search_space_id"],
if_not_exists=True,
)