"""empty message

Revision ID: 7dfc4ce4b421
Revises: 3fb3d96cd57d
Create Date: 2018-08-02 15:40:46.181850

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '7dfc4ce4b421'
down_revision = '3fb3d96cd57d'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('physics',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('mass', sa.Integer(), nullable=True),
    sa.Column('density', sa.Integer(), nullable=True),
    sa.Column('equatRadius', sa.Integer(), nullable=True),
    sa.Column('meanRadius', sa.Integer(), nullable=True),
    sa.Column('polarRadius', sa.Integer(), nullable=True),
    sa.Column('flatterning', sa.Integer(), nullable=True),
    sa.Column('volumetricMeanRadius', sa.Integer(), nullable=True),
    sa.Column('escapeVelocity', sa.Integer(), nullable=True),
    sa.Column('rotationPeriod', sa.Integer(), nullable=True),
    sa.Column('axialTilt', sa.Integer(), nullable=True),
    sa.Column('northPRightAsc', sa.Integer(), nullable=True),
    sa.Column('northPDeclination', sa.Integer(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('types',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=32), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.drop_table('barycentres')
    op.add_column('bodies', sa.Column('physical_properties', sa.Integer(), nullable=True))
    op.add_column('bodies', sa.Column('type', sa.Integer(), nullable=True))
    op.create_foreign_key(None, 'bodies', 'types', ['type'], ['id'])
    op.create_foreign_key(None, 'bodies', 'physics', ['physical_properties'], ['id'])
    op.drop_column('bodies', 'density')
    op.drop_column('bodies', 'axialTilt')
    op.drop_column('bodies', 'rotationPeriod')
    op.drop_column('bodies', 'equatRadius')
    op.drop_column('bodies', 'northPDeclination')
    op.drop_column('bodies', 'meanRadius')
    op.drop_column('bodies', 'northPRightAsc')
    op.drop_column('bodies', 'flatterning')
    op.drop_column('bodies', 'polarRadius')
    op.drop_column('bodies', 'escapeVelocity')
    op.drop_column('bodies', 'volumetricMeanRadius')
    op.drop_column('bodies', 'mass')
    op.drop_constraint(None, 'orbits', type_='foreignkey')
    op.create_foreign_key(None, 'orbits', 'bodies', ['barycentre'], ['id'])
    op.drop_constraint(None, 'systems', type_='foreignkey')
    op.create_foreign_key(None, 'systems', 'bodies', ['barycentre_id'], ['id'])
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, 'systems', type_='foreignkey')
    op.create_foreign_key(None, 'systems', 'barycentres', ['barycentre_id'], ['id'])
    op.drop_constraint(None, 'orbits', type_='foreignkey')
    op.create_foreign_key(None, 'orbits', 'barycentres', ['barycentre'], ['id'])
    op.add_column('bodies', sa.Column('mass', sa.INTEGER(), nullable=True))
    op.add_column('bodies', sa.Column('volumetricMeanRadius', sa.INTEGER(), nullable=True))
    op.add_column('bodies', sa.Column('escapeVelocity', sa.INTEGER(), nullable=True))
    op.add_column('bodies', sa.Column('polarRadius', sa.INTEGER(), nullable=True))
    op.add_column('bodies', sa.Column('flatterning', sa.INTEGER(), nullable=True))
    op.add_column('bodies', sa.Column('northPRightAsc', sa.INTEGER(), nullable=True))
    op.add_column('bodies', sa.Column('meanRadius', sa.INTEGER(), nullable=True))
    op.add_column('bodies', sa.Column('northPDeclination', sa.INTEGER(), nullable=True))
    op.add_column('bodies', sa.Column('equatRadius', sa.INTEGER(), nullable=True))
    op.add_column('bodies', sa.Column('rotationPeriod', sa.INTEGER(), nullable=True))
    op.add_column('bodies', sa.Column('axialTilt', sa.INTEGER(), nullable=True))
    op.add_column('bodies', sa.Column('density', sa.INTEGER(), nullable=True))
    op.drop_constraint(None, 'bodies', type_='foreignkey')
    op.drop_constraint(None, 'bodies', type_='foreignkey')
    op.drop_column('bodies', 'type')
    op.drop_column('bodies', 'physical_properties')
    op.create_table('barycentres',
    sa.Column('id', sa.INTEGER(), nullable=False),
    sa.Column('name', sa.VARCHAR(length=32), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.drop_table('types')
    op.drop_table('physics')
    # ### end Alembic commands ###
