mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-06-08 20:25:19 +02:00
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:
parent
7d7d032e78
commit
29b9cc814f
1 changed files with 4 additions and 0 deletions
|
|
@ -30,21 +30,25 @@ def upgrade() -> None:
|
||||||
"ix_notifications_user_read_type_created",
|
"ix_notifications_user_read_type_created",
|
||||||
"notifications",
|
"notifications",
|
||||||
["user_id", "read", "type", "created_at"],
|
["user_id", "read", "type", "created_at"],
|
||||||
|
if_not_exists=True,
|
||||||
)
|
)
|
||||||
op.create_index(
|
op.create_index(
|
||||||
"ix_notifications_user_space_created",
|
"ix_notifications_user_space_created",
|
||||||
"notifications",
|
"notifications",
|
||||||
["user_id", "search_space_id", "created_at"],
|
["user_id", "search_space_id", "created_at"],
|
||||||
|
if_not_exists=True,
|
||||||
)
|
)
|
||||||
op.create_index(
|
op.create_index(
|
||||||
"ix_notifications_type",
|
"ix_notifications_type",
|
||||||
"notifications",
|
"notifications",
|
||||||
["type"],
|
["type"],
|
||||||
|
if_not_exists=True,
|
||||||
)
|
)
|
||||||
op.create_index(
|
op.create_index(
|
||||||
"ix_notifications_search_space_id",
|
"ix_notifications_search_space_id",
|
||||||
"notifications",
|
"notifications",
|
||||||
["search_space_id"],
|
["search_space_id"],
|
||||||
|
if_not_exists=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue