"""Add MuseumAttachment

Revision ID: b7bf3f1119f5
Revises: 5c449c1bc2f5
Create Date: 2019-12-11 11:20:10.796928

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'b7bf3f1119f5'
down_revision = '5c449c1bc2f5'
branch_labels = None
depends_on = None


def upgrade():
    op.create_table('museum_attachments',
        sa.Column('id', sa.BigInteger(), nullable=False),
        sa.Column('filename', sa.Text(), nullable=True),
        sa.Column('modified_date', sa.DateTime(timezone=True), nullable=True),
        sa.Column('created_date', sa.DateTime(timezone=True), nullable=True),
        sa.PrimaryKeyConstraint('id', name=op.f('pk_museum_attachments'))
    )
    op.create_table('object_attachment_association',
        sa.Column('museum_object_id', sa.BigInteger(), nullable=True),
        sa.Column('museum_attachment_id', sa.BigInteger(), nullable=True),
        sa.ForeignKeyConstraint(['museum_attachment_id'], ['museum_attachments.id'], name=op.f('fk_object_attachment_association_museum_attachment_id_museum_attachments')),
        sa.ForeignKeyConstraint(['museum_object_id'], ['museum_objects.id'], name=op.f('fk_object_attachment_association_museum_object_id_museum_objects'))
    )


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