"""Add photos.nextcloud_fileid for NC preview proxying Revision ID: 0018_photos_nextcloud_fileid Revises: 0017_photos_list_index Create Date: 2026-05-11 The thumbnail endpoint will proxy Nextcloud's /index.php/core/preview instead of generating and serving its own WebP cache under /data/thumbs. That requires storing each photo's Nextcloud numeric fileid alongside the row. NULL is allowed because legacy / non-NC photos still exist and the handler keeps the on-disk fallback for them. """ from typing import Sequence, Union import sqlalchemy as sa from alembic import op revision: str = "0018_photos_nextcloud_fileid" down_revision: Union[str, None] = "0017_photos_list_index" branch_labels: Union[str, Sequence[str], None] = None depends_on: Union[str, Sequence[str], None] = None def upgrade() -> None: op.add_column( "photos", sa.Column("nextcloud_fileid", sa.Integer(), nullable=True), ) op.create_index( "ix_photos_nextcloud_fileid", "photos", ["nextcloud_fileid"], ) def downgrade() -> None: op.drop_index("ix_photos_nextcloud_fileid", table_name="photos") op.drop_column("photos", "nextcloud_fileid")