"""Add File table

Revision ID: 3822d04489a0
Revises: 
Create Date: 2021-06-26 16:18:52.167545

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '3822d04489a0'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('files',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('filepath', sa.String(), nullable=False),
    sa.Column('storage', sa.String(), nullable=False),
    sa.Column('primary', sa.Boolean(), nullable=False),
    sa.Column('has_thumbnail', sa.Boolean(), nullable=False),
    sa.Column('category', sa.Enum('unknown', 'other', 'image', 'photo', 'scan', 'dump', 'dump_metadata', 'text', 'prose', 'transcription', 'collection', name='filecategory'), nullable=True),
    sa.Column('title', sa.String(), nullable=True),
    sa.Column('comment', sa.Text(), nullable=True),
    sa.Column('analyzed', sa.DateTime(), nullable=True),
    sa.Column('upload_date', sa.DateTime(), nullable=True),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.Column('asset_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['asset_id'], ['assets.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('files')
    # ### end Alembic commands ###
