"""empty message

Revision ID: 25fc3f52af44
Revises: 
Create Date: 2017-04-10 17:15:01.049591

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '25fc3f52af44'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('credentials_data',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('cert', sa.Binary(), nullable=False),
    sa.Column('key', sa.Binary(), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('cluster',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=80), nullable=False),
    sa.Column('ca_credentials_id', sa.Integer(), nullable=False),
    sa.Column('etcd_version', sa.Integer(), nullable=False),
    sa.Column('suppose_etcd_cluster_exists', sa.Boolean(), nullable=False),
    sa.Column('etcd_nodes_dns_name', sa.String(length=80), nullable=False),
    sa.Column('install_dnsmasq', sa.Boolean(), nullable=False),
    sa.Column('allow_insecure_provision', sa.Boolean(), nullable=False),
    sa.Column('apiservers_audit_log', sa.Boolean(), nullable=False),
    sa.Column('apiservers_swagger_ui', sa.Boolean(), nullable=False),
    sa.Column('explicitly_advertise_addresses', sa.Boolean(), nullable=False),
    sa.Column('k8s_pod_network', sa.String(length=80), nullable=False),
    sa.Column('k8s_service_network', sa.String(length=80), nullable=False),
    sa.Column('k8s_hyperkube_tag', sa.String(length=80), nullable=False),
    sa.Column('k8s_cni', sa.Boolean(), nullable=False),
    sa.Column('k8s_apiservers_dns_name', sa.String(length=80), nullable=False),
    sa.Column('boot_images_base_url', sa.String(length=80), nullable=False),
    sa.Column('aci_proxy_url', sa.String(length=80), nullable=False),
    sa.Column('aci_proxy_ca_cert', sa.Text(), nullable=False),
    sa.Column('service_account_keypair_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['ca_credentials_id'], ['credentials_data.id'], ),
    sa.ForeignKeyConstraint(['service_account_keypair_id'], ['credentials_data.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('name')
    )
    op.create_table('node',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('ip', sa.String(length=80), nullable=False),
    sa.Column('fqdn', sa.String(length=80), nullable=False),
    sa.Column('maintenance_mode', sa.Boolean(), nullable=False),
    sa.Column('cluster_id', sa.Integer(), nullable=False),
    sa.Column('credentials_id', sa.Integer(), nullable=False),
    sa.Column('target_config_version', sa.Integer(), nullable=False),
    sa.Column('active_config_version', sa.Integer(), nullable=True),
    sa.Column('active_ignition_config', sa.Text(), nullable=False),
    sa.Column('coreos_autologin', sa.Boolean(), nullable=False),
    sa.Column('root_disk', sa.String(length=80), nullable=False),
    sa.Column('wipe_root_disk_next_boot', sa.Boolean(), nullable=False),
    sa.Column('root_disk_size_sectors', sa.Integer(), nullable=True),
    sa.Column('linux_consoles', sa.String(length=80), nullable=False),
    sa.Column('disable_ipv6', sa.Boolean(), nullable=False),
    sa.Column('is_etcd_server', sa.Boolean(), nullable=False),
    sa.Column('is_k8s_schedulable', sa.Boolean(), nullable=False),
    sa.Column('is_k8s_master', sa.Boolean(), nullable=False),
    sa.ForeignKeyConstraint(['cluster_id'], ['cluster.id'], ),
    sa.ForeignKeyConstraint(['credentials_id'], ['credentials_data.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('fqdn'),
    sa.UniqueConstraint('ip')
    )
    op.create_table('user',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('cluster_id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=80), nullable=False),
    sa.Column('credentials_id', sa.Integer(), nullable=False),
    sa.Column('groups', sa.String(length=255), nullable=False),
    sa.Column('ssh_key', sa.Text(), nullable=False),
    sa.ForeignKeyConstraint(['cluster_id'], ['cluster.id'], ),
    sa.ForeignKeyConstraint(['credentials_id'], ['credentials_data.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('address',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('node_id', sa.Integer(), nullable=False),
    sa.Column('interface', sa.String(length=80), nullable=False),
    sa.Column('ip', sa.String(length=80), nullable=False),
    sa.ForeignKeyConstraint(['node_id'], ['node.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('mountpoint',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('node_id', sa.Integer(), nullable=False),
    sa.Column('what', sa.String(length=80), nullable=False),
    sa.Column('where', sa.String(length=80), nullable=False),
    sa.Column('wanted_by', sa.String(length=80), nullable=False),
    sa.ForeignKeyConstraint(['node_id'], ['node.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('mountpoint')
    op.drop_table('address')
    op.drop_table('user')
    op.drop_table('node')
    op.drop_table('cluster')
    op.drop_table('credentials_data')
    # ### end Alembic commands ###
