"""empty message

Revision ID: 95eb2674e0a3
Revises: 330f465e5b02
Create Date: 2020-01-26 13:56:00.531603

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

# revision identifiers, used by Alembic.
revision = '95eb2674e0a3'
down_revision = '330f465e5b02'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('post_view',
    sa.Column('id', mysql.BIGINT(unsigned=True), nullable=False, comment='用户查看pdf主键'),
    sa.Column('user_id', mysql.BIGINT(unsigned=True), nullable=True, comment='用户'),
    sa.Column('pdf_id', mysql.BIGINT(unsigned=True), nullable=True, comment='PDF'),
    sa.Column('view_date', sa.Date(), nullable=True, comment='浏览事件'),
    sa.ForeignKeyConstraint(['pdf_id'], ['pdf.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('user_id', 'pdf_id', 'view_date', name='unique_constrain_user_view_pdf')
    )
    # ### end Alembic commands ###


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