Folders are only a grouping in the database (media_folders, media.folder_id, Alembic 0046): made, renamed, deleted (files stay) on the Media page, a file filed from its details, uploads go into the folder shown, the picker filters by folder. The gallery widget: its own pictures/videos in order or a folder as it is now, seconds each, fade / slide / zoom, cover / contain. Plan 6R.16, F-114. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
42 lines
1.5 KiB
Python
42 lines
1.5 KiB
Python
"""Media folders (6R.16, owner 2026-11-22): the Media page groups files in folders. Only a grouping in
|
|
the database (media.folder_id); the files stay where they are on disk. A gallery widget can show a folder.
|
|
|
|
Revision ID: 0046_media_folders
|
|
Revises: 0045_signage_shapes
|
|
Create Date: 2026-11-22 16:00:00
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
from core.timeutil import UTCDateTime
|
|
|
|
revision = '0046_media_folders'
|
|
down_revision = '0045_signage_shapes'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.create_table(
|
|
'media_folders',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('name', sa.String(), nullable=False),
|
|
sa.Column('position', sa.Integer(), nullable=False, server_default='0'),
|
|
sa.Column('created_at', UTCDateTime(), nullable=False),
|
|
sa.PrimaryKeyConstraint('id'),
|
|
)
|
|
op.create_index('ix_media_folders_id', 'media_folders', ['id'])
|
|
with op.batch_alter_table('media') as b:
|
|
b.add_column(sa.Column('folder_id', sa.Integer(), nullable=True))
|
|
b.create_index('ix_media_folder_id', ['folder_id'])
|
|
b.create_foreign_key('fk_media_folder', 'media_folders', ['folder_id'], ['id'], ondelete='SET NULL')
|
|
|
|
|
|
def downgrade() -> None:
|
|
with op.batch_alter_table('media') as b:
|
|
b.drop_constraint('fk_media_folder', type_='foreignkey')
|
|
b.drop_index('ix_media_folder_id')
|
|
b.drop_column('folder_id')
|
|
op.drop_index('ix_media_folders_id', 'media_folders')
|
|
op.drop_table('media_folders')
|