"""empty message

Revision ID: 273db5f3044f
Revises: eb0dc173df2
Create Date: 2016-02-01 14:34:36.314339

"""

# revision identifiers, used by Alembic.
revision = '273db5f3044f'
down_revision = 'eb0dc173df2'

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
import models
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('redpack_question',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('content', sa.String(length=1000), nullable=True),
    sa.Column('create_time', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('redpack_user_question',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('qr_user_id', sa.Integer(), nullable=True),
    sa.Column('question_id', sa.Integer(), nullable=True),
    sa.Column('question', sa.String(length=1000), nullable=True),
    sa.Column('answer', sa.String(length=1000), nullable=True),
    sa.Column('is_custom', mysql.TINYINT(display_width=1), nullable=False),
    sa.Column('is_random', mysql.TINYINT(display_width=1), nullable=False),
    sa.Column('price', models.MoneyField(precision=10, scale=2), nullable=True),
    sa.Column('status', mysql.TINYINT(display_width=1), nullable=False),
    sa.Column('create_time', sa.DateTime(), nullable=True),
    sa.ForeignKeyConstraint(['qr_user_id'], ['qr_code_user.id'], ),
    sa.ForeignKeyConstraint(['question_id'], ['redpack_question.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('redpack_pay',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('qr_user_id', sa.Integer(), nullable=True),
    sa.Column('user_question_id', sa.Integer(), nullable=True),
    sa.Column('order_no', sa.String(length=30), nullable=True),
    sa.Column('transaction_id', sa.String(length=100), nullable=True),
    sa.Column('price', models.MoneyField(precision=10, scale=2), nullable=True),
    sa.Column('status', mysql.TINYINT(display_width=1), nullable=False),
    sa.Column('create_time', sa.DateTime(), nullable=True),
    sa.ForeignKeyConstraint(['qr_user_id'], ['qr_code_user.id'], ),
    sa.ForeignKeyConstraint(['user_question_id'], ['redpack_user_question.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('order_no')
    )
    op.create_table('redpack_pay_user',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('qr_user_id', sa.Integer(), nullable=True),
    sa.Column('price', models.MoneyField(precision=10, scale=2), nullable=True),
    sa.Column('user_question_id', sa.Integer(), nullable=True),
    sa.Column('pay_id', sa.Integer(), nullable=True),
    sa.Column('create_time', sa.DateTime(), nullable=True),
    sa.ForeignKeyConstraint(['pay_id'], ['redpack_pay.id'], ),
    sa.ForeignKeyConstraint(['qr_user_id'], ['qr_code_user.id'], ),
    sa.ForeignKeyConstraint(['user_question_id'], ['redpack_user_question.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    ### end Alembic commands ###


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