From 57baeda7677ac75be7b072e4fce0fce0ecd92249 Mon Sep 17 00:00:00 2001 From: Anish Sarkar <104695310+AnishSarkar22@users.noreply.github.com> Date: Thu, 22 Jan 2026 02:14:46 +0530 Subject: [PATCH] refactor: remove archived column migration for notifications --- ...73_add_archived_column_to_notifications.py | 51 ------------------- 1 file changed, 51 deletions(-) delete mode 100644 surfsense_backend/alembic/versions/73_add_archived_column_to_notifications.py diff --git a/surfsense_backend/alembic/versions/73_add_archived_column_to_notifications.py b/surfsense_backend/alembic/versions/73_add_archived_column_to_notifications.py deleted file mode 100644 index 99962e501..000000000 --- a/surfsense_backend/alembic/versions/73_add_archived_column_to_notifications.py +++ /dev/null @@ -1,51 +0,0 @@ -"""Add archived column to notifications table - -Revision ID: 73 -Revises: 72 - -Adds an archived boolean column to the notifications table to allow users -to archive inbox items without deleting them. - -NOTE: Electric SQL automatically picks up schema changes when REPLICA IDENTITY FULL -is set (which was done in migration 66). We re-affirm it here to ensure replication -continues to work after adding the new column. -""" - -from collections.abc import Sequence - -from alembic import op - -# revision identifiers, used by Alembic. -revision: str = "73" -down_revision: str | None = "72" -branch_labels: str | Sequence[str] | None = None -depends_on: str | Sequence[str] | None = None - - -def upgrade() -> None: - """Add archived column to notifications table.""" - # Add the archived column with a default value - op.execute( - """ - ALTER TABLE notifications - ADD COLUMN IF NOT EXISTS archived BOOLEAN NOT NULL DEFAULT FALSE; - """ - ) - - # Create index for archived column - op.execute( - "CREATE INDEX IF NOT EXISTS ix_notifications_archived ON notifications (archived);" - ) - - # Re-affirm REPLICA IDENTITY FULL for Electric SQL after schema change - # This ensures Electric SQL continues to replicate all columns including the new one - op.execute("ALTER TABLE notifications REPLICA IDENTITY FULL;") - - -def downgrade() -> None: - """Remove archived column from notifications table.""" - op.execute("DROP INDEX IF EXISTS ix_notifications_archived;") - op.execute("ALTER TABLE notifications DROP COLUMN IF EXISTS archived;") - # Re-affirm REPLICA IDENTITY FULL after removing the column - op.execute("ALTER TABLE notifications REPLICA IDENTITY FULL;") -