"""Questions are soft-deleted. A question id comes from a sequence and is never reissued, and fourteen tables reference it — attempts, quiz membership, exam membership, media, article links, notes, favourites, feedback. Deleting the row took all of that with it, so "restore" could never have meant more than "type it in again with a new id". Revision ID: f6a7b8c9d0e1 Revises: e5f6a7b8c9d0 """ import sqlalchemy as sa from alembic import op revision = "f6a7b8c9d0e1" down_revision = "e5f6a7b8c9d0" branch_labels = None depends_on = None def upgrade() -> None: op.add_column("questions", sa.Column("deleted_at", sa.DateTime(), nullable=True)) op.create_index("ix_questions_deleted_at", "questions", ["deleted_at"]) def downgrade() -> None: op.drop_index("ix_questions_deleted_at", table_name="questions") op.drop_column("questions", "deleted_at")