0.2.0 initial commit

This commit is contained in:
Yusur 2025-10-08 14:46:09 +02:00
commit 6f67d125af
38 changed files with 2051 additions and 0 deletions

View file

@ -0,0 +1,77 @@
"""empty message
Revision ID: 3bfaa1b74794
Revises:
Create Date: 2023-11-19 15:50:38.211123
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '3bfaa1b74794'
down_revision = None
branch_labels = None
depends_on = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('image',
sa.Column('id', sa.BigInteger(), nullable=False),
sa.Column('type', sa.SmallInteger(), nullable=True),
sa.Column('format', sa.SmallInteger(), nullable=True),
sa.Column('name', sa.String(length=256), nullable=True),
sa.Column('hash', sa.String(length=256), nullable=True),
sa.Column('date', sa.DateTime(), nullable=True),
sa.Column('size', sa.BigInteger(), nullable=True),
sa.Column('pathname', sa.String(length=8192), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('pathname')
)
op.create_index(op.f('ix_image_date'), 'image', ['date'], unique=False)
op.create_index(op.f('ix_image_hash'), 'image', ['hash'], unique=False)
op.create_index(op.f('ix_image_name'), 'image', ['name'], unique=False)
op.create_index(op.f('ix_image_type'), 'image', ['type'], unique=False)
op.create_table('video',
sa.Column('id', sa.BigInteger(), nullable=False),
sa.Column('type', sa.SmallInteger(), nullable=True),
sa.Column('format', sa.SmallInteger(), nullable=True),
sa.Column('name', sa.String(length=256), nullable=True),
sa.Column('duration', sa.Float(), nullable=True),
sa.Column('date', sa.DateTime(), nullable=True),
sa.Column('size', sa.BigInteger(), nullable=True),
sa.Column('pathname', sa.String(length=8192), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('pathname')
)
op.create_index(op.f('ix_video_date'), 'video', ['date'], unique=False)
op.create_index(op.f('ix_video_duration'), 'video', ['duration'], unique=False)
op.create_index(op.f('ix_video_name'), 'video', ['name'], unique=False)
op.create_index(op.f('ix_video_type'), 'video', ['type'], unique=False)
op.create_table('imagetag',
sa.Column('id', sa.BigInteger(), nullable=False),
sa.Column('image_id', sa.BigInteger(), nullable=True),
sa.Column('name', sa.String(length=64), nullable=True),
sa.ForeignKeyConstraint(['image_id'], ['image.id'], ),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('image_id', 'name')
)
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('imagetag')
op.drop_index(op.f('ix_video_type'), table_name='video')
op.drop_index(op.f('ix_video_name'), table_name='video')
op.drop_index(op.f('ix_video_duration'), table_name='video')
op.drop_index(op.f('ix_video_date'), table_name='video')
op.drop_table('video')
op.drop_index(op.f('ix_image_type'), table_name='image')
op.drop_index(op.f('ix_image_name'), table_name='image')
op.drop_index(op.f('ix_image_hash'), table_name='image')
op.drop_index(op.f('ix_image_date'), table_name='image')
op.drop_table('image')
# ### end Alembic commands ###

View file

@ -0,0 +1,94 @@
"""empty message
Revision ID: 63d014f73934
Revises: 3bfaa1b74794
Create Date: 2023-12-02 21:50:41.457594
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '63d014f73934'
down_revision = '3bfaa1b74794'
branch_labels = None
depends_on = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('user',
sa.Column('id', sa.BigInteger(), nullable=False),
sa.Column('username', sa.String(length=30), nullable=True),
sa.Column('display_name', sa.String(length=64), nullable=True),
sa.Column('passhash', sa.String(length=256), nullable=True),
sa.Column('joined_at', sa.String(length=256), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('username')
)
op.create_table('imagecollection',
sa.Column('id', sa.BigInteger(), nullable=False),
sa.Column('name', sa.String(length=128), nullable=False),
sa.Column('owner_id', sa.BigInteger(), nullable=True),
sa.Column('description', sa.String(length=4096), nullable=True),
sa.ForeignKeyConstraint(['owner_id'], ['user.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('imageincollection',
sa.Column('image_id', sa.BigInteger(), nullable=False),
sa.Column('collection_id', sa.BigInteger(), nullable=False),
sa.Column('since', sa.DateTime(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=True),
sa.ForeignKeyConstraint(['collection_id'], ['imagecollection.id'], ),
sa.ForeignKeyConstraint(['image_id'], ['image.id'], ),
sa.PrimaryKeyConstraint('image_id', 'collection_id')
)
op.create_index(op.f('ix_imageincollection_since'), 'imageincollection', ['since'], unique=False)
op.drop_index('idx_60001_image_date', table_name='image')
op.drop_index('idx_60001_image_hash', table_name='image')
op.drop_index('idx_60001_image_name', table_name='image')
op.drop_index('idx_60001_image_pathname', table_name='image')
op.drop_index('idx_60001_image_type', table_name='image')
op.create_index(op.f('ix_image_date'), 'image', ['date'], unique=False)
op.create_index(op.f('ix_image_hash'), 'image', ['hash'], unique=False)
op.create_index(op.f('ix_image_name'), 'image', ['name'], unique=False)
op.create_index(op.f('ix_image_type'), 'image', ['type'], unique=False)
op.create_unique_constraint(None, 'image', ['pathname'])
op.drop_index('idx_59995_imagetag_image_id', table_name='imagetag')
op.drop_index('idx_59995_imagetag_image_id_name', table_name='imagetag')
op.create_unique_constraint(None, 'imagetag', ['image_id', 'name'])
op.create_foreign_key(None, 'imagetag', 'image', ['image_id'], ['id'])
op.create_index(op.f('ix_video_date'), 'video', ['date'], unique=False)
op.create_index(op.f('ix_video_duration'), 'video', ['duration'], unique=False)
op.create_index(op.f('ix_video_name'), 'video', ['name'], unique=False)
op.create_index(op.f('ix_video_type'), 'video', ['type'], unique=False)
op.create_unique_constraint(None, 'video', ['pathname'])
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(None, 'video', type_='unique')
op.drop_index(op.f('ix_video_type'), table_name='video')
op.drop_index(op.f('ix_video_name'), table_name='video')
op.drop_index(op.f('ix_video_duration'), table_name='video')
op.drop_index(op.f('ix_video_date'), table_name='video')
op.drop_constraint(None, 'imagetag', type_='foreignkey')
op.drop_constraint(None, 'imagetag', type_='unique')
op.create_index('idx_59995_imagetag_image_id_name', 'imagetag', ['image_id', 'name'], unique=False)
op.create_index('idx_59995_imagetag_image_id', 'imagetag', ['image_id'], unique=False)
op.drop_constraint(None, 'image', type_='unique')
op.drop_index(op.f('ix_image_type'), table_name='image')
op.drop_index(op.f('ix_image_name'), table_name='image')
op.drop_index(op.f('ix_image_hash'), table_name='image')
op.drop_index(op.f('ix_image_date'), table_name='image')
op.create_index('idx_60001_image_type', 'image', ['type'], unique=False)
op.create_index('idx_60001_image_pathname', 'image', ['pathname'], unique=False)
op.create_index('idx_60001_image_name', 'image', ['name'], unique=False)
op.create_index('idx_60001_image_hash', 'image', ['hash'], unique=False)
op.create_index('idx_60001_image_date', 'image', ['date'], unique=False)
op.drop_index(op.f('ix_imageincollection_since'), table_name='imageincollection')
op.drop_table('imageincollection')
op.drop_table('imagecollection')
op.drop_table('user')
# ### end Alembic commands ###

View file

@ -0,0 +1,28 @@
"""empty message
Revision ID: fbf0bcc3368a
Revises: 63d014f73934
Create Date: 2023-12-31 16:10:00.055273
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'fbf0bcc3368a'
down_revision = '63d014f73934'
branch_labels = None
depends_on = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
pass
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
pass
# ### end Alembic commands ###