"""init instant table

Revision ID: 3ce691fe5397
Revises: 67dc9bc168c6
Create Date: 2019-02-12 10:54:31.228012

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

# revision identifiers, used by Alembic.
revision = '3ce691fe5397'
down_revision = '67dc9bc168c6'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('instant_game_instance',
    sa.Column('_id', sa.BigInteger(), autoincrement=True, nullable=False),
    sa.Column('created_at', sa.DateTime(), server_default='0000-00-00 00:00:00', nullable=False),
    sa.Column('update_at', sa.DateTime(), server_default='0000-00-00 00:00:00', nullable=False),
    sa.Column('deleted_at', sa.DateTime(), server_default='0000-00-00 00:00:00', nullable=False),
    sa.Column('deleted', sa.Boolean(), server_default='0', nullable=False),
    sa.Column('template_id', sa.BigInteger(), nullable=True),
    sa.Column('game_serial', sa.String(length=64), server_default='', nullable=False),
    sa.Column('game_title', sa.String(length=255), server_default='', nullable=False),
    sa.Column('bet_token', mysql.INTEGER(), server_default='0', nullable=False),
    sa.Column('bet_unit', mysql.INTEGER(), server_default='0', nullable=False),
    sa.Column('bet_number', mysql.INTEGER(), server_default='0', nullable=False),
    sa.Column('participation', mysql.INTEGER(), server_default='0', nullable=False),
    sa.Column('need', mysql.INTEGER(), server_default='0', nullable=False),
    sa.Column('status', mysql.TINYINT(), server_default='0', nullable=False),
    sa.Column('support_token', mysql.INTEGER(), server_default='0', nullable=False),
    sa.Column('reward_token', mysql.INTEGER(), server_default='1', nullable=False),
    sa.Column('reward_quantity', mysql.INTEGER(), server_default='0', nullable=False),
    sa.Column('release_time', sa.DateTime(), server_default='1970-01-01 00:00:00', nullable=False),
    sa.Column('full_load_time', sa.DateTime(), server_default='1970-01-01 00:00:00', nullable=False),
    sa.Column('lottery_time', sa.DateTime(), server_default='1970-01-01 00:00:00', nullable=False),
    sa.Column('release_type', mysql.TINYINT(), server_default='0', nullable=False),
    sa.Column('handling_fee', sa.Numeric(precision=21, scale=2), server_default='0.00', nullable=False),
    sa.Column('merge_threshold', mysql.INTEGER(), server_default='0', nullable=False),
    sa.Column('game_describe', sa.String(length=255), server_default='', nullable=False),
    sa.Column('chain_status', mysql.INTEGER(), server_default='0', nullable=False),
    sa.Column('experience', mysql.INTEGER(), server_default='0', nullable=False),
    sa.PrimaryKeyConstraint('_id'),
    sa.UniqueConstraint('game_serial')
    )
    op.create_table('instant_game_template',
    sa.Column('_id', sa.BigInteger(), autoincrement=True, nullable=False),
    sa.Column('created_at', sa.DateTime(), server_default='0000-00-00 00:00:00', nullable=False),
    sa.Column('update_at', sa.DateTime(), server_default='0000-00-00 00:00:00', nullable=False),
    sa.Column('deleted_at', sa.DateTime(), server_default='0000-00-00 00:00:00', nullable=False),
    sa.Column('deleted', sa.Boolean(), server_default='0', nullable=False),
    sa.Column('game_title', sa.String(length=128), server_default='', nullable=False),
    sa.Column('reward_token', mysql.INTEGER(), server_default='0', nullable=False),
    sa.Column('bet_token', mysql.INTEGER(), server_default='0', nullable=False),
    sa.Column('bet_unit', mysql.INTEGER(), server_default='0', nullable=False),
    sa.Column('reward_quantity', mysql.INTEGER(), server_default='0', nullable=False),
    sa.Column('need_ceiling', mysql.INTEGER(), server_default='0', nullable=False),
    sa.Column('need_floor', mysql.INTEGER(), server_default='0', nullable=False),
    sa.Column('exceeded_ratio', mysql.INTEGER(), server_default='0', nullable=False),
    sa.Column('experience', mysql.INTEGER(), server_default='0', nullable=False),
    sa.Column('handling_fee', sa.Numeric(precision=21, scale=2), server_default='0', nullable=False),
    sa.Column('merge_threshold', mysql.INTEGER(), server_default='0', nullable=False),
    sa.Column('support_token', mysql.INTEGER(), server_default='0', nullable=False),
    sa.Column('template_status', mysql.INTEGER(), server_default='0', nullable=False),
    sa.Column('auto_release', mysql.INTEGER(), server_default='0', nullable=False),
    sa.Column('game_describe', sa.String(length=128), server_default='', nullable=False),
    sa.Column('phase_prefix', sa.String(length=128), server_default='', nullable=False),
    sa.Column('phase_date', sa.String(length=128), server_default='', nullable=False),
    sa.Column('phase_serial', sa.String(length=128), server_default='', nullable=False),
    sa.Column('agreement_name', sa.String(length=128), server_default='', nullable=False),
    sa.Column('agreement', sa.String(length=128), server_default='', nullable=False),
    sa.PrimaryKeyConstraint('_id')
    )
    op.create_table('instant_participate_in',
    sa.Column('_id', sa.BigInteger(), autoincrement=True, nullable=False),
    sa.Column('created_at', sa.DateTime(), server_default='0000-00-00 00:00:00', nullable=False),
    sa.Column('update_at', sa.DateTime(), server_default='0000-00-00 00:00:00', nullable=False),
    sa.Column('deleted_at', sa.DateTime(), server_default='0000-00-00 00:00:00', nullable=False),
    sa.Column('deleted', sa.Boolean(), server_default='0', nullable=False),
    sa.Column('game_instance_id', sa.BigInteger(), nullable=False),
    sa.Column('template_id', sa.BigInteger(), server_default='0', nullable=False),
    sa.Column('game_serial', sa.String(length=64), server_default='', nullable=False),
    sa.Column('game_title', sa.String(length=255), server_default='', nullable=False),
    sa.Column('bet_token', mysql.INTEGER(), server_default='0', nullable=False),
    sa.Column('release_type', mysql.TINYINT(), server_default='0', nullable=False),
    sa.Column('user_id', sa.String(length=64), server_default='', nullable=False),
    sa.Column('nick_name', sa.String(length=64), server_default='', nullable=False),
    sa.Column('channel', sa.String(length=64), server_default='', nullable=False),
    sa.Column('pay_token', mysql.INTEGER(), server_default='0', nullable=False),
    sa.Column('bet_unit', mysql.INTEGER(), server_default='0', nullable=False),
    sa.Column('bet_number', mysql.INTEGER(), server_default='0', nullable=False),
    sa.Column('pay_number', sa.Numeric(precision=21, scale=18), server_default='0.0000', nullable=False),
    sa.Column('award_numbers', mysql.MEDIUMTEXT(), nullable=True),
    sa.Column('user_type', mysql.INTEGER(), server_default='0', nullable=False),
    sa.Column('chain_status', mysql.INTEGER(), server_default='0', nullable=False),
    sa.Column('merge_id', sa.BigInteger(), server_default='-1', nullable=False),
    sa.PrimaryKeyConstraint('_id')
    )
    op.create_table('instant_winning_record',
    sa.Column('_id', sa.BigInteger(), autoincrement=True, nullable=False),
    sa.Column('created_at', sa.DateTime(), server_default='0000-00-00 00:00:00', nullable=False),
    sa.Column('update_at', sa.DateTime(), server_default='0000-00-00 00:00:00', nullable=False),
    sa.Column('deleted_at', sa.DateTime(), server_default='0000-00-00 00:00:00', nullable=False),
    sa.Column('deleted', sa.Boolean(), server_default='0', nullable=False),
    sa.Column('game_instance_id', sa.BigInteger(), nullable=False),
    sa.Column('game_serial', sa.String(length=64), server_default='', nullable=False),
    sa.Column('bet_serial', sa.String(length=64), server_default='', nullable=False),
    sa.Column('bet_hash', sa.String(length=255), server_default='', nullable=False),
    sa.Column('reward_token', mysql.INTEGER(), server_default='1', nullable=False),
    sa.Column('reward_quantity', mysql.INTEGER(), server_default='0', nullable=False),
    sa.Column('user_id', sa.String(length=64), server_default='', nullable=False),
    sa.Column('bet_token', mysql.INTEGER(), server_default='0', nullable=False),
    sa.Column('bet_number', mysql.INTEGER(), server_default='0', nullable=False),
    sa.Column('user_type', mysql.INTEGER(), server_default='0', nullable=False),
    sa.Column('block_no', mysql.INTEGER(), server_default='0', nullable=False),
    sa.Column('timestamp', sa.String(length=128), server_default='', nullable=False),
    sa.Column('received_time', sa.String(length=128), server_default='', nullable=False),
    sa.Column('block_type', sa.String(length=128), server_default='', nullable=False),
    sa.Column('participation', mysql.INTEGER(), server_default='0', nullable=False),
    sa.Column('chain_status', mysql.INTEGER(), server_default='0', nullable=False),
    sa.Column('merge_id', sa.BigInteger(), server_default='-1', nullable=False),
    sa.PrimaryKeyConstraint('_id')
    )
    # ### end Alembic commands ###


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