"""create

Revision ID: 61632731b77a
Revises: 
Create Date: 2021-06-23 19:03:03.028445

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '61632731b77a'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('authors',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('username', sa.String(length=20), nullable=True),
    sa.Column('nickname', sa.String(length=20), nullable=True),
    sa.Column('email', sa.String(length=100), nullable=True),
    sa.Column('hashed_password', sa.String(length=300), nullable=True),
    sa.Column('token', sa.String(length=200), nullable=True),
    sa.Column('is_active', sa.Boolean(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_authors_email'), 'authors', ['email'], unique=True)
    op.create_index(op.f('ix_authors_id'), 'authors', ['id'], unique=False)
    op.create_index(op.f('ix_authors_username'), 'authors', ['username'], unique=True)
    op.create_table('stages',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('title', sa.String(length=200), nullable=True),
    sa.Column('content', sa.Text(), nullable=True),
    sa.Column('type', sa.SmallInteger(), nullable=True),
    sa.Column('owner_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['owner_id'], ['authors.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_stages_id'), 'stages', ['id'], unique=False)
    op.create_index(op.f('ix_stages_title'), 'stages', ['title'], unique=False)
    op.create_index(op.f('ix_stages_type'), 'stages', ['type'], unique=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_stages_type'), table_name='stages')
    op.drop_index(op.f('ix_stages_title'), table_name='stages')
    op.drop_index(op.f('ix_stages_id'), table_name='stages')
    op.drop_table('stages')
    op.drop_index(op.f('ix_authors_username'), table_name='authors')
    op.drop_index(op.f('ix_authors_id'), table_name='authors')
    op.drop_index(op.f('ix_authors_email'), table_name='authors')
    op.drop_table('authors')
    # ### end Alembic commands ###

"""create

Revision ID: 61632731b77a
Revises: 
Create Date: 2021-06-23 19:03:03.028445

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '61632731b77a'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('authors',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('username', sa.String(length=20), nullable=True),
    sa.Column('nickname', sa.String(length=20), nullable=True),
    sa.Column('email', sa.String(length=100), nullable=True),
    sa.Column('hashed_password', sa.String(length=300), nullable=True),
    sa.Column('token', sa.String(length=200), nullable=True),
    sa.Column('is_active', sa.Boolean(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_authors_email'), 'authors', ['email'], unique=True)
    op.create_index(op.f('ix_authors_id'), 'authors', ['id'], unique=False)
    op.create_index(op.f('ix_authors_username'), 'authors', ['username'], unique=True)
    op.create_table('stages',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('title', sa.String(length=200), nullable=True),
    sa.Column('content', sa.Text(), nullable=True),
    sa.Column('type', sa.SmallInteger(), nullable=True),
    sa.Column('owner_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['owner_id'], ['authors.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_stages_id'), 'stages', ['id'], unique=False)
    op.create_index(op.f('ix_stages_title'), 'stages', ['title'], unique=False)
    op.create_index(op.f('ix_stages_type'), 'stages', ['type'], unique=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_stages_type'), table_name='stages')
    op.drop_index(op.f('ix_stages_title'), table_name='stages')
    op.drop_index(op.f('ix_stages_id'), table_name='stages')
    op.drop_table('stages')
    op.drop_index(op.f('ix_authors_username'), table_name='authors')
    op.drop_index(op.f('ix_authors_id'), table_name='authors')
    op.drop_index(op.f('ix_authors_email'), table_name='authors')
    op.drop_table('authors')
    # ### end Alembic commands ###

create  Revision ID: 61632731b77a Revises:  Create Date: 2021-06-23 19:03:03.028445 # revision identifiers, used by Alembic. # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ### # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ###