"""community ban

Revision ID: cc98a471a1ad
Revises: 251be00ae302
Create Date: 2023-09-08 20:03:14.527356

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'cc98a471a1ad'
down_revision = '251be00ae302'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('community_ban',
    sa.Column('user_id', sa.Integer(), nullable=False),
    sa.Column('community_id', sa.Integer(), nullable=False),
    sa.Column('banned_by', sa.Integer(), nullable=True),
    sa.Column('reason', sa.String(length=50), nullable=True),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('ban_until', sa.DateTime(), nullable=True),
    sa.ForeignKeyConstraint(['banned_by'], ['user.id'], ),
    sa.ForeignKeyConstraint(['community_id'], ['community.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
    sa.PrimaryKeyConstraint('user_id', 'community_id')
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('community_ban')
    # ### end Alembic commands ###