"""Initial revision

Revision ID: 0002ca860468
Revises: 
Create Date: 2018-11-24 17:55:43.799089

"""
from alembic import op
import sqlalchemy as sa

# revision identifiers, used by Alembic.
revision = '0002ca860468'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('join_roles',
                    sa.Column('role_id', sa.BigInteger(), autoincrement=False, nullable=False),
                    sa.Column('guild_id', sa.BigInteger(), nullable=True),
                    sa.PrimaryKeyConstraint('role_id', name=op.f('pk_join_roles'))
                    )
    op.create_table('newbie_guilds',
                    sa.Column('guild_id', sa.BigInteger(), autoincrement=False, nullable=False),
                    sa.Column('role_id', sa.BigInteger(), nullable=False),
                    sa.Column('welcome_message', sa.UnicodeText(), nullable=False),
                    sa.Column('response_message', sa.UnicodeText(), nullable=False),
                    sa.Column('timeout', sa.Interval(), nullable=True),
                    sa.PrimaryKeyConstraint('guild_id', name=op.f('pk_newbie_guilds'))
                    )
    op.create_table('optin_channels',
                    sa.Column('channel_id', sa.BigInteger(), autoincrement=False, nullable=False),
                    sa.Column('role_id', sa.BigInteger(), nullable=True),
                    sa.Column('guild_id', sa.BigInteger(), nullable=True),
                    sa.PrimaryKeyConstraint('channel_id', name=op.f('pk_optin_channels')),
                    sa.UniqueConstraint('role_id', name=op.f('uq_optin_channels_role_id'))
                    )
    op.create_table('whitelisted_channels',
                    sa.Column('channel_id', sa.BigInteger(), autoincrement=False, nullable=False),
                    sa.Column('guild_id', sa.BigInteger(), nullable=True),
                    sa.PrimaryKeyConstraint('channel_id', name=op.f('pk_whitelisted_channels'))
                    )
    op.create_table('newbie_channels',
                    sa.Column('channel_id', sa.BigInteger(), autoincrement=False, nullable=False),
                    sa.Column('guild_id', sa.BigInteger(), nullable=False),
                    sa.ForeignKeyConstraint(['guild_id'], ['newbie_guilds.guild_id'], name=op.f('fk_newbie_channels_guild_id_newbie_guilds')),
                    sa.PrimaryKeyConstraint('channel_id', name=op.f('pk_newbie_channels'))
                    )
    op.create_table('newbie_users',
                    sa.Column('user_id', sa.BigInteger(), autoincrement=False, nullable=False),
                    sa.Column('guild_id', sa.BigInteger(), autoincrement=False, nullable=False),
                    sa.Column('message_id', sa.BigInteger(), nullable=False),
                    sa.Column('joined_at', sa.DateTime(), nullable=False),
                    sa.ForeignKeyConstraint(['guild_id'], ['newbie_guilds.guild_id'], name=op.f('fk_newbie_users_guild_id_newbie_guilds')),
                    sa.PrimaryKeyConstraint('user_id', 'guild_id', name=op.f('pk_newbie_users')),
                    sa.UniqueConstraint('message_id', name=op.f('uq_newbie_users_message_id'))
                    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('newbie_users')
    op.drop_table('newbie_channels')
    op.drop_table('whitelisted_channels')
    op.drop_table('optin_channels')
    op.drop_table('newbie_guilds')
    op.drop_table('join_roles')
    # ### end Alembic commands ###

Add initial revision