"""empty message

Revision ID: 4580ceb1a0bf
Revises: 0da04f5233e4
Create Date: 2020-01-25 21:26:20.140974

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql

# revision identifiers, used by Alembic.
revision = '4580ceb1a0bf'
down_revision = '0da04f5233e4'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('user_group',
    sa.Column('id', mysql.BIGINT(unsigned=True), nullable=False, comment='用户所属组主键'),
    sa.Column('user_id', mysql.BIGINT(unsigned=True), nullable=True, comment='用户'),
    sa.Column('group_id', mysql.BIGINT(unsigned=True), nullable=True, comment='用户组'),
    sa.ForeignKeyConstraint(['group_id'], ['group.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('user_id', 'group_id', name='user_group_unique_constraint'),
    comment='用户-用户组'
    )
    # ### end Alembic commands ###


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