41 lines
1.3 KiB
Python
41 lines
1.3 KiB
Python
"""Archive locations (US06-01).
|
|
|
|
Revision ID: 0011_archive_locations
|
|
Revises: 0010_upload_verification
|
|
Create Date: 2026-08-16
|
|
|
|
Configured archive destinations with their stable media identity, last probed
|
|
capabilities, and state.
|
|
"""
|
|
|
|
import sqlalchemy as sa
|
|
from alembic import op
|
|
|
|
revision = "0011_archive_locations"
|
|
down_revision = "0010_upload_verification"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.create_table(
|
|
"archive_locations",
|
|
sa.Column("id", sa.String(), primary_key=True),
|
|
sa.Column("name", sa.String(), nullable=False, unique=True),
|
|
sa.Column("root", sa.String(), nullable=False),
|
|
sa.Column("media_id", sa.String(), nullable=False, unique=True),
|
|
sa.Column("capabilities", sa.String(), nullable=True),
|
|
sa.Column("state", sa.String(), nullable=False, server_default="offline"),
|
|
sa.Column("last_seen_at", sa.DateTime(timezone=True), nullable=True),
|
|
sa.Column(
|
|
"created_at", sa.DateTime(timezone=True), nullable=False, server_default=sa.func.now()
|
|
),
|
|
sa.Column(
|
|
"updated_at", sa.DateTime(timezone=True), nullable=False, server_default=sa.func.now()
|
|
),
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_table("archive_locations")
|