"""empty message

Revision ID: 1b69eb43d002
Revises: 12c7d91346fc
Create Date: 2019-03-24 15:59:37.598587

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '1b69eb43d002'
down_revision = '12c7d91346fc'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('distro',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=60), nullable=False),
    sa.Column('company', sa.String(length=60), nullable=False),
    sa.Column('datetime_added', sa.DateTime(), nullable=True),
    sa.Column('datetime_modified', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.alter_column('image', 'archive_filename',
               existing_type=sa.VARCHAR(length=200),
               nullable=False)
    op.alter_column('image', 'archive_path',
               existing_type=sa.VARCHAR(length=200),
               nullable=False)
    op.alter_column('image', 'build',
               existing_type=sa.VARCHAR(length=40),
               nullable=False)
    op.alter_column('image', 'file_suffix',
               existing_type=sa.VARCHAR(length=200),
               nullable=False)
    op.alter_column('image', 'name',
               existing_type=sa.VARCHAR(length=200),
               nullable=False)
    op.alter_column('image', 'sha256',
               existing_type=sa.VARCHAR(length=200),
               nullable=False)
    op.alter_column('image', 'url',
               existing_type=sa.VARCHAR(length=200),
               nullable=False)
    op.alter_column('image', 'uuid',
               existing_type=sa.VARCHAR(length=200),
               nullable=False)
    op.add_column('release', sa.Column('distro_id', sa.Integer(), nullable=True))
    op.create_foreign_key(None, 'release', 'distro', ['distro_id'], ['id'])
    op.drop_column('release', 'distro')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('release', sa.Column('distro', sa.VARCHAR(length=100), autoincrement=False, nullable=False))
    op.drop_constraint(None, 'release', type_='foreignkey')
    op.drop_column('release', 'distro_id')
    op.alter_column('image', 'uuid',
               existing_type=sa.VARCHAR(length=200),
               nullable=True)
    op.alter_column('image', 'url',
               existing_type=sa.VARCHAR(length=200),
               nullable=True)
    op.alter_column('image', 'sha256',
               existing_type=sa.VARCHAR(length=200),
               nullable=True)
    op.alter_column('image', 'name',
               existing_type=sa.VARCHAR(length=200),
               nullable=True)
    op.alter_column('image', 'file_suffix',
               existing_type=sa.VARCHAR(length=200),
               nullable=True)
    op.alter_column('image', 'build',
               existing_type=sa.VARCHAR(length=40),
               nullable=True)
    op.alter_column('image', 'archive_path',
               existing_type=sa.VARCHAR(length=200),
               nullable=True)
    op.alter_column('image', 'archive_filename',
               existing_type=sa.VARCHAR(length=200),
               nullable=True)
    op.drop_table('distro')
    # ### end Alembic commands ###
