"""initial commit

Revision ID: 86729abe3be1
Revises: 
Create Date: 2021-02-22 11:37:30.014686

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '86729abe3be1'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('channels',
    sa.Column('id', sa.BigInteger(), nullable=False),
    sa.Column('enable_signature', sa.Boolean(), server_default=sa.text('true'), nullable=True),
    sa.Column('signature_text', sa.String(length=250), nullable=True),
    sa.Column('enable_counter', sa.Boolean(), server_default=sa.text('true'), nullable=True),
    sa.Column('counter_value', sa.Integer(), nullable=True),
    sa.Column('scheduler_hours', sa.Integer(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_channels_id'), 'channels', ['id'], unique=False)
    op.create_table('users',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_users_id'), 'users', ['id'], unique=False)
    op.create_table('channel_link',
    sa.Column('id', sa.BigInteger(), nullable=False),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.Column('channel_id', sa.BigInteger(), nullable=True),
    sa.ForeignKeyConstraint(['channel_id'], ['channels.id'], onupdate='CASCADE', ondelete='CASCADE'),
    sa.ForeignKeyConstraint(['user_id'], ['users.id'], onupdate='CASCADE', ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_channel_link_id'), 'channel_link', ['id'], unique=False)
    op.create_table('wallpapers',
    sa.Column('id', sa.BigInteger(), nullable=False),
    sa.Column('file_id', sa.String(length=100), nullable=False),
    sa.Column('unique_file_id', sa.String(length=100), nullable=False),
    sa.Column('extension', sa.String(length=10), nullable=True),
    sa.Column('custom_signature', sa.String(length=250), nullable=True),
    sa.Column('telegraph_link', sa.String(length=100), nullable=True),
    sa.Column('channel_id', sa.BigInteger(), nullable=True),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['channel_id'], ['channels.id'], onupdate='CASCADE', ondelete='CASCADE'),
    sa.ForeignKeyConstraint(['user_id'], ['users.id'], onupdate='CASCADE', ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_wallpapers_id'), 'wallpapers', ['id'], unique=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_wallpapers_id'), table_name='wallpapers')
    op.drop_table('wallpapers')
    op.drop_index(op.f('ix_channel_link_id'), table_name='channel_link')
    op.drop_table('channel_link')
    op.drop_index(op.f('ix_users_id'), table_name='users')
    op.drop_table('users')
    op.drop_index(op.f('ix_channels_id'), table_name='channels')
    op.drop_table('channels')
    # ### end Alembic commands ###
