"""Added comment_author

Revision ID: d32fddec14d5
Revises: 
Create Date: 2021-03-27 19:35:03.860621

"""
from alembic import op
import sqlalchemy as sa


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


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('news_table',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('head', sa.String(), nullable=True),
    sa.Column('body', sa.String(length=350), nullable=True),
    sa.Column('date', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_news_table_id'), 'news_table', ['id'], unique=False)
    op.create_table('users_table',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=50), nullable=True),
    sa.Column('email', sa.String(), nullable=True),
    sa.Column('hashed_password', sa.String(), nullable=True),
    sa.Column('is_active', sa.Boolean(), nullable=True),
    sa.Column('is_superuser', sa.Boolean(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_users_table_email'), 'users_table', ['email'], unique=True)
    op.create_index(op.f('ix_users_table_id'), 'users_table', ['id'], unique=False)
    op.create_table('comments_table',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('body_c', sa.String(), nullable=True),
    sa.Column('news_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['news_id'], ['news_table.id'], ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_comments_table_id'), 'comments_table', ['id'], unique=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_comments_table_id'), table_name='comments_table')
    op.drop_table('comments_table')
    op.drop_index(op.f('ix_users_table_id'), table_name='users_table')
    op.drop_index(op.f('ix_users_table_email'), table_name='users_table')
    op.drop_table('users_table')
    op.drop_index(op.f('ix_news_table_id'), table_name='news_table')
    op.drop_table('news_table')
    # ### end Alembic commands ###
