"""empty message

Revision ID: 39119815b311
Revises: 
Create Date: 2020-04-19 16:55:46.083341

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '39119815b311'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('manuscripts',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('heb_name', sa.String(length=255), nullable=True),
    sa.Column('eng_name', sa.String(length=255), nullable=True),
    sa.Column('estimated_date', sa.String(length=50), nullable=True),
    sa.Column('shelf_no', sa.String(length=100), nullable=True),
    sa.Column('catalog_no', sa.String(length=100), nullable=True),
    sa.Column('external_url', sa.String(length=255), nullable=True),
    sa.Column('iiif_manifest_url', sa.String(length=255), nullable=True),
    sa.Column('license', sa.Text(), nullable=True),
    sa.Column('notes', sa.Text(), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('heb_name')
    )
    op.create_table('tokencache',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('token', sa.String(length=255), nullable=True),
    sa.Column('token_provider', sa.String(length=255), nullable=True),
    sa.Column('email', sa.String(length=255), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('users',
    sa.Column('email', sa.String(length=255), nullable=False),
    sa.Column('first_name', sa.String(length=50), nullable=True),
    sa.Column('last_name', sa.String(length=50), nullable=True),
    sa.PrimaryKeyConstraint('email')
    )
    op.create_table('pages',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('manuscript_id', sa.Integer(), nullable=True),
    sa.Column('page_name', sa.String(length=255), nullable=True),
    sa.Column('page_number', sa.Integer(), nullable=True),
    sa.Column('iiif_url', sa.String(length=255), nullable=True),
    sa.Column('page_width', sa.Integer(), nullable=True),
    sa.Column('page_height', sa.Integer(), nullable=True),
    sa.Column('dpi', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['manuscript_id'], ['manuscripts.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('iiif_url')
    )
    op.create_table('transcriptions',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('page_id', sa.Integer(), nullable=True),
    sa.Column('user_email', sa.String(length=255), nullable=True),
    sa.Column('partial', sa.Boolean(), server_default='1', nullable=True),
    sa.Column('initial_transcription_id', sa.Integer(), nullable=True),
    sa.Column('transcription', sa.Text(), nullable=True),
    sa.Column('start_time', sa.TIMESTAMP(), server_default=sa.text('(CURRENT_TIMESTAMP)'), nullable=True),
    sa.Column('save_time', sa.TIMESTAMP(), nullable=True),
    sa.ForeignKeyConstraint(['initial_transcription_id'], ['transcriptions.id'], ),
    sa.ForeignKeyConstraint(['page_id'], ['pages.id'], ),
    sa.ForeignKeyConstraint(['user_email'], ['users.email'], ),
    sa.PrimaryKeyConstraint('id')
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('transcriptions')
    op.drop_table('pages')
    op.drop_table('users')
    op.drop_table('tokencache')
    op.drop_table('manuscripts')
    # ### end Alembic commands ###
