26 lines
794 B
Python
26 lines
794 B
Python
"""Add directory records to the file catalog."""
|
|
|
|
from collections.abc import Sequence
|
|
|
|
import sqlalchemy as sa
|
|
from alembic import op
|
|
|
|
revision: str = "20260802_0004"
|
|
down_revision: str | Sequence[str] | None = "20260802_0003"
|
|
branch_labels: str | Sequence[str] | None = None
|
|
depends_on: str | Sequence[str] | None = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
with op.batch_alter_table("file_records") as batch:
|
|
batch.add_column(
|
|
sa.Column("is_directory", sa.Boolean(), nullable=False, server_default=sa.false())
|
|
)
|
|
batch.create_index("ix_file_records_is_directory", ["is_directory"])
|
|
|
|
|
|
def downgrade() -> None:
|
|
with op.batch_alter_table("file_records") as batch:
|
|
batch.drop_index("ix_file_records_is_directory")
|
|
batch.drop_column("is_directory")
|