feat: split initial social schema migration chain

replace monolithic migration with ordered scripts, include profiles/sessions in migration, and verify full downgrade/upgrade cycle for clean Supabase bootstrap
This commit is contained in:
qzl
2026-02-26 17:58:37 +08:00
parent 2994cc708c
commit 6641eba9df
22 changed files with 2242 additions and 23 deletions
@@ -0,0 +1,29 @@
"""initial schema part 5: hardening and partial indexes
Revision ID: 202602260005
Revises: 202602260004
Create Date: 2026-02-26 20:14:00
"""
from typing import Sequence, Union
from alembic import op
revision: str = "202602260005"
down_revision: Union[str, Sequence[str], None] = "202602260004"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
op.execute(
"CREATE INDEX ix_inbox_messages_pending_recent ON inbox_messages (recipient_id, created_at DESC) WHERE status = 'pending'"
)
op.execute(
"CREATE INDEX ix_todos_pending_due ON todos (owner_id, due_at) WHERE status = 'pending'"
)
def downgrade() -> None:
op.execute("DROP INDEX IF EXISTS ix_todos_pending_due")
op.execute("DROP INDEX IF EXISTS ix_inbox_messages_pending_recent")