"""Initial schema.

Revision ID: 9dbcb0e58949
Revises: 
Create Date: 2020-11-21 22:30:49.046109

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '9dbcb0e58949'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('admin_actions',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('guild_id', sa.BigInteger(), nullable=True),
    sa.Column('author_id', sa.BigInteger(), nullable=True),
    sa.Column('subject_id', sa.BigInteger(), nullable=True),
    sa.Column('action_type', sa.Enum('STRIKE', 'TEMP_BAN', 'PERMA_BAN', 'MUTE', name='adminaction'), nullable=True),
    sa.Column('reason', sa.Text(), nullable=True),
    sa.Column('is_active', sa.Boolean(), nullable=True),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('expires_at', sa.DateTime(), nullable=True),
    sa.Column('deleted_at', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('guilds',
    sa.Column('id', sa.BigInteger(), autoincrement=False, nullable=False),
    sa.Column('admin_actions_enabled', sa.Boolean(), nullable=True),
    sa.Column('subscribers_enabled', sa.Boolean(), nullable=True),
    sa.Column('subscriber_role_id', sa.BigInteger(), nullable=True),
    sa.Column('role_management_enabled', sa.Boolean(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('channels',
    sa.Column('id', sa.BigInteger(), autoincrement=False, nullable=False),
    sa.Column('guild_id', sa.BigInteger(), nullable=True),
    sa.Column('channel_type', sa.Enum('LOG', 'MESSAGE_CHANGE_LOG', name='channeltype'), nullable=True),
    sa.ForeignKeyConstraint(['guild_id'], ['guilds.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('managed_roles',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('guild_id', sa.BigInteger(), nullable=True),
    sa.Column('role_id', sa.BigInteger(), nullable=True),
    sa.Column('name', sa.String(length=100), nullable=True),
    sa.ForeignKeyConstraint(['guild_id'], ['guilds.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('subscribers',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('guild_id', sa.BigInteger(), nullable=True),
    sa.Column('subject_id', sa.BigInteger(), nullable=True),
    sa.Column('once', sa.Boolean(), nullable=True),
    sa.ForeignKeyConstraint(['guild_id'], ['guilds.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('whitelisted_cogs',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('guild_id', sa.BigInteger(), nullable=True),
    sa.Column('name', sa.String(length=100), nullable=True),
    sa.ForeignKeyConstraint(['guild_id'], ['guilds.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('whitelisted_cogs')
    op.drop_table('subscribers')
    op.drop_table('managed_roles')
    op.drop_table('channels')
    op.drop_table('guilds')
    op.drop_table('admin_actions')
    # ### end Alembic commands ###
