Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion migrations/.current-alembic-head
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0553_add_reason_to_provider
0556_add_notify_status_idx
23 changes: 23 additions & 0 deletions migrations/versions/0554_add_notif_status_constraint.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""
Create Date: 2026-07-20T00:00:00
"""

from alembic import op

revision = "0554_add_notif_status_constraint"
down_revision = "0553_add_reason_to_provider"


def upgrade():
op.execute(
"-- squawk-ignore require-timeout-settings\n"
"ALTER TABLE notifications "
"ADD CONSTRAINT ck_notifications_notification_status_not_null "
"CHECK (notification_status IS NOT NULL) NOT VALID;"
)


def downgrade():
op.execute(
"ALTER TABLE notifications DROP CONSTRAINT IF EXISTS ck_notifications_notification_status_not_null;"
)
20 changes: 20 additions & 0 deletions migrations/versions/0555_add_notify_status_not_null.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
"""
Create Date: 2026-07-20T00:00:00
"""

from alembic import op

revision = "0555_add_notify_status_not_null"
down_revision = "0554_add_notif_status_constraint"


def upgrade():
op.execute(
"ALTER TABLE notifications "
"VALIDATE CONSTRAINT ck_notifications_notification_status_not_null;"
)
op.execute("ALTER TABLE notifications ALTER COLUMN notification_status SET NOT NULL;")


def downgrade():
op.execute("ALTER TABLE notifications ALTER COLUMN notification_status DROP NOT NULL;")
24 changes: 24 additions & 0 deletions migrations/versions/0556_add_notify_status_idx.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"""
Create Date: 2026-07-20T00:00:00
"""

from alembic import op

revision = "0556_add_notify_status_idx"
down_revision = "0555_add_notify_status_not_null"


def upgrade():
with op.get_context().autocommit_block():
op.execute(
"CREATE UNIQUE INDEX CONCURRENTLY IF NOT EXISTS "
"ix_notifications_id_status "
"ON notifications (id, notification_status);"
)


def downgrade():
with op.get_context().autocommit_block():
op.execute(
"DROP INDEX CONCURRENTLY IF EXISTS ix_notifications_id_status;"
)
Loading