"""add_billing_tables

Revision ID: 27e3434740df
Revises: ae364c078429
Create Date: 2025-04-17 18:32:06.008601

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

# revision identifiers, used by Alembic.
revision = '27e3434740df'
down_revision = 'ae364c078429'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('machine_billing_charge',
    sa.Column('id', sa.BIGINT(), nullable=False),
    sa.Column('machine', sa.Integer(), nullable=False),
    sa.Column('game_id', sa.CHAR(length=5), nullable=False),
    sa.Column('game_ver', sa.FLOAT(), nullable=False),
    sa.Column('play_count', sa.INTEGER(), nullable=False),
    sa.Column('play_limit', sa.INTEGER(), nullable=False),
    sa.Column('product_code', sa.INTEGER(), nullable=False),
    sa.Column('product_count', sa.INTEGER(), nullable=False),
    sa.Column('func_type', sa.INTEGER(), nullable=False),
    sa.Column('player_number', sa.INTEGER(), nullable=False),
    sa.ForeignKeyConstraint(['machine'], ['machine.id'], onupdate='cascade', ondelete='cascade'),
    sa.PrimaryKeyConstraint('id'),
    mysql_charset='utf8mb4'
    )
    op.create_table('machine_billing_credit',
    sa.Column('id', sa.BIGINT(), nullable=False),
    sa.Column('machine', sa.Integer(), nullable=False),
    sa.Column('chute_type', sa.INTEGER(), nullable=False),
    sa.Column('service_type', sa.INTEGER(), nullable=False),
    sa.Column('operation_type', sa.INTEGER(), nullable=False),
    sa.Column('coin_rate0', sa.INTEGER(), nullable=False),
    sa.Column('coin_rate1', sa.INTEGER(), nullable=False),
    sa.Column('coin_bonus', sa.INTEGER(), nullable=False),
    sa.Column('credit_rate', sa.INTEGER(), nullable=False),
    sa.Column('coin_count_slot0', sa.INTEGER(), nullable=False),
    sa.Column('coin_count_slot1', sa.INTEGER(), nullable=False),
    sa.Column('coin_count_slot2', sa.INTEGER(), nullable=False),
    sa.Column('coin_count_slot3', sa.INTEGER(), nullable=False),
    sa.Column('coin_count_slot4', sa.INTEGER(), nullable=False),
    sa.Column('coin_count_slot5', sa.INTEGER(), nullable=False),
    sa.Column('coin_count_slot6', sa.INTEGER(), nullable=False),
    sa.Column('coin_count_slot7', sa.INTEGER(), nullable=False),
    sa.ForeignKeyConstraint(['machine'], ['machine.id'], onupdate='cascade', ondelete='cascade'),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('machine'),
    mysql_charset='utf8mb4'
    )
    # ### end Alembic commands ###


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