"""empty message

Revision ID: 48164eee8b7f
Revises: 
Create Date: 2018-01-26 11:15:21.649645

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

# revision identifiers, used by Alembic.
revision = '48164eee8b7f'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('address',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('street', sa.CHAR(length=100), nullable=True),
    sa.Column('neighborhood', sa.CHAR(length=100), nullable=True),
    sa.Column('number', sa.CHAR(length=20), nullable=True),
    sa.Column('city', sa.CHAR(length=100), nullable=True),
    sa.Column('state', sa.CHAR(length=100), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('user',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('username', sa.CHAR(length=30), nullable=True),
    sa.Column('name', sa.CHAR(length=100), nullable=True),
    sa.Column('email', sa.CHAR(length=50), nullable=True),
    sa.Column('role', postgresql.ENUM('ROOT', 'SUPPORT', 'ONWER', 'HELPER', name='roles', create_type=False), nullable=True),
    sa.Column('cellphone', sa.CHAR(length=30), nullable=True),
    sa.Column('is_staff', sa.Boolean(), nullable=True),
    sa.Column('is_active', sa.Boolean(), nullable=True),
    sa.Column('date_joined', sa.DateTime(), nullable=True),
    sa.Column('address_id', sa.Integer(), nullable=True),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.ForeignKeyConstraint(['address_id'], ['address.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('group',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.CHAR(length=50), nullable=True),
    sa.Column('address_id', sa.Integer(), nullable=True),
    sa.Column('owner_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['address_id'], ['address.id'], ),
    sa.ForeignKeyConstraint(['owner_id'], ['user.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('event',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('code', sa.CHAR(length=50), nullable=False),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('group_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['group_id'], ['group.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('code')
    )
    op.create_table('list_group',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.CHAR(length=100), nullable=False),
    sa.Column('group_id', sa.Integer(), nullable=True),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.ForeignKeyConstraint(['group_id'], ['group.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('allowed_artist',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.CHAR(length=100), nullable=False),
    sa.Column('list_group_id', sa.Integer(), nullable=True),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.ForeignKeyConstraint(['list_group_id'], ['list_group.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('event_list_group',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('event_id', sa.Integer(), nullable=True),
    sa.Column('list_group_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['event_id'], ['event.id'], ),
    sa.ForeignKeyConstraint(['list_group_id'], ['list_group.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('event_list_group')
    op.drop_table('allowed_artist')
    op.drop_table('list_group')
    op.drop_table('event')
    op.drop_table('group')
    op.drop_table('user')
    op.drop_table('address')
    # ### end Alembic commands ###
