This repository has been archived on 2026-05-31. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
imagerepo/migrations/versions/426ed1b38bcf_add_is_admin.py
T
2025-07-29 00:34:03 -04:00

50 lines
1.6 KiB
Python

"""add is_admin
Revision ID: 426ed1b38bcf
Revises: 79c2e82697ce
Create Date: 2025-07-28 23:53:10.691918
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '426ed1b38bcf'
down_revision = '79c2e82697ce'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('image_record',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('filename', sa.String(length=256), nullable=False),
sa.Column('filepath', sa.String(length=512), nullable=False),
sa.Column('hash', sa.String(length=64), nullable=False),
sa.Column('artist', sa.String(length=128), nullable=False),
sa.Column('file_size', sa.Integer(), nullable=True),
sa.Column('width', sa.Integer(), nullable=True),
sa.Column('height', sa.Integer(), nullable=True),
sa.Column('format', sa.String(length=32), nullable=True),
sa.Column('camera_model', sa.String(length=128), nullable=True),
sa.Column('taken_at', sa.DateTime(), nullable=True),
sa.Column('imported_at', sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('hash')
)
with op.batch_alter_table('user', schema=None) as batch_op:
batch_op.add_column(sa.Column('is_admin', sa.Boolean(), nullable=True))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('user', schema=None) as batch_op:
batch_op.drop_column('is_admin')
op.drop_table('image_record')
# ### end Alembic commands ###