"""drop note_links — [[wiki-links]] are removed Revision ID: 0024 Revises: 0023 Create Date: 2026-08-22 0023 stays in the chain: removing an applied revision would strand a database's alembic_version pointer. note_links was derived from note bodies, so nothing typed is lost; the `[[text]]` is still in every body. """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql revision = "0024" down_revision = "0023" branch_labels = None depends_on = None def upgrade() -> None: op.drop_table("note_links") def downgrade() -> None: op.create_table( "note_links", sa.Column("id", postgresql.UUID(as_uuid=True), primary_key=True), sa.Column( "source_id", postgresql.UUID(as_uuid=True), sa.ForeignKey("notes.id", ondelete="CASCADE"), nullable=False, ), sa.Column( "target_id", postgresql.UUID(as_uuid=True), sa.ForeignKey("notes.id", ondelete="SET NULL"), nullable=True, ), sa.Column("target_norm", sa.Text(), nullable=False), ) op.create_index("ix_note_links_target", "note_links", ["target_norm"]) op.create_index("ix_note_links_target_id", "note_links", ["target_id"])