mirror of
https://gitea.tendokyu.moe/Hay1tsme/artemis.git
synced 2026-02-08 08:37:38 +08:00
Merge branch 'refs/heads/develop' into prism_plus_support
# Conflicts: # core/data/alembic/versions/16f34bf7b968_mai2_kaleidx_scope_support.py # core/data/alembic/versions/5cf98cfe52ad_mai2_prism_support.py # core/data/alembic/versions/5d7b38996e67_mai2_prism_support.py # core/data/alembic/versions/bdf710616ba4_mai2_add_prism_playlog_support.py # titles/mai2/index.py # titles/mai2/prism.py # titles/mai2/read.py # titles/mai2/schema/static.py
This commit is contained in:
164
core/data/alembic/versions/263884e774cc_acc_opt_tables.py
Normal file
164
core/data/alembic/versions/263884e774cc_acc_opt_tables.py
Normal file
@@ -0,0 +1,164 @@
|
||||
"""acc_opt_tables
|
||||
|
||||
Revision ID: 263884e774cc
|
||||
Revises: 1d0014d35220
|
||||
Create Date: 2025-04-07 18:05:53.349320
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import mysql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '263884e774cc'
|
||||
down_revision = '1d0014d35220'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('chuni_static_opt',
|
||||
sa.Column('id', sa.BIGINT(), nullable=False),
|
||||
sa.Column('version', sa.INTEGER(), nullable=False),
|
||||
sa.Column('name', sa.VARCHAR(length=4), nullable=False),
|
||||
sa.Column('sequence', sa.INTEGER(), nullable=False),
|
||||
sa.Column('whenRead', sa.TIMESTAMP(), server_default=sa.text('now()'), nullable=False),
|
||||
sa.Column('isEnable', sa.BOOLEAN(), server_default='1', nullable=False),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('version', 'name', name='chuni_static_opt_uk'),
|
||||
mysql_charset='utf8mb4'
|
||||
)
|
||||
op.create_table('cm_static_opts',
|
||||
sa.Column('id', sa.BIGINT(), nullable=False),
|
||||
sa.Column('version', sa.INTEGER(), nullable=False),
|
||||
sa.Column('name', sa.VARCHAR(length=4), nullable=False),
|
||||
sa.Column('sequence', sa.INTEGER(), nullable=True),
|
||||
sa.Column('gekiVersion', sa.INTEGER(), nullable=True),
|
||||
sa.Column('gekiReleaseVer', sa.INTEGER(), nullable=True),
|
||||
sa.Column('maiVersion', sa.INTEGER(), nullable=True),
|
||||
sa.Column('maiReleaseVer', sa.INTEGER(), nullable=True),
|
||||
sa.Column('whenRead', sa.TIMESTAMP(), server_default=sa.text('now()'), nullable=False),
|
||||
sa.Column('isEnable', sa.BOOLEAN(), server_default='1', nullable=False),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('version', 'name', name='cm_static_opts_uk'),
|
||||
mysql_charset='utf8mb4'
|
||||
)
|
||||
op.create_table('mai2_static_opt',
|
||||
sa.Column('id', sa.BIGINT(), nullable=False),
|
||||
sa.Column('version', sa.INTEGER(), nullable=False),
|
||||
sa.Column('name', sa.VARCHAR(length=4), nullable=False),
|
||||
sa.Column('sequence', sa.INTEGER(), nullable=False),
|
||||
sa.Column('cmReleaseVer', sa.INTEGER(), nullable=False),
|
||||
sa.Column('whenRead', sa.TIMESTAMP(), server_default=sa.text('now()'), nullable=False),
|
||||
sa.Column('isEnable', sa.BOOLEAN(), server_default='1', nullable=False),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('version', 'name', name='mai2_static_opt_uk'),
|
||||
mysql_charset='utf8mb4'
|
||||
)
|
||||
op.create_table('ongeki_static_opt',
|
||||
sa.Column('id', sa.BIGINT(), nullable=False),
|
||||
sa.Column('version', sa.INTEGER(), nullable=False),
|
||||
sa.Column('name', sa.VARCHAR(length=4), nullable=False),
|
||||
sa.Column('sequence', sa.INTEGER(), nullable=False),
|
||||
sa.Column('cmReleaseVer', sa.INTEGER(), nullable=False),
|
||||
sa.Column('whenRead', sa.TIMESTAMP(), server_default=sa.text('now()'), nullable=False),
|
||||
sa.Column('isEnable', sa.BOOLEAN(), server_default='1', nullable=False),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('version', 'name', name='ongeki_static_opt_uk'),
|
||||
mysql_charset='utf8mb4'
|
||||
)
|
||||
op.add_column('chuni_static_avatar', sa.Column('opt', sa.BIGINT(), nullable=True))
|
||||
op.create_foreign_key(None, 'chuni_static_avatar', 'chuni_static_opt', ['opt'], ['id'], onupdate='cascade', ondelete='SET NULL')
|
||||
op.add_column('chuni_static_cards', sa.Column('opt', sa.BIGINT(), nullable=True))
|
||||
op.create_foreign_key(None, 'chuni_static_cards', 'cm_static_opts', ['opt'], ['id'], onupdate='cascade', ondelete='SET NULL')
|
||||
op.add_column('chuni_static_character', sa.Column('opt', sa.BIGINT(), nullable=True))
|
||||
op.create_foreign_key(None, 'chuni_static_character', 'chuni_static_opt', ['opt'], ['id'], onupdate='cascade', ondelete='SET NULL')
|
||||
op.add_column('chuni_static_charge', sa.Column('opt', sa.BIGINT(), nullable=True))
|
||||
op.create_foreign_key(None, 'chuni_static_charge', 'chuni_static_opt', ['opt'], ['id'], onupdate='cascade', ondelete='SET NULL')
|
||||
op.add_column('chuni_static_events', sa.Column('opt', sa.BIGINT(), nullable=True))
|
||||
op.create_foreign_key(None, 'chuni_static_events', 'chuni_static_opt', ['opt'], ['id'], onupdate='cascade', ondelete='SET NULL')
|
||||
op.add_column('chuni_static_gachas', sa.Column('opt', sa.BIGINT(), nullable=True))
|
||||
op.create_foreign_key(None, 'chuni_static_gachas', 'cm_static_opts', ['opt'], ['id'], onupdate='cascade', ondelete='SET NULL')
|
||||
op.add_column('chuni_static_login_bonus', sa.Column('opt', sa.BIGINT(), nullable=True))
|
||||
op.create_foreign_key(None, 'chuni_static_login_bonus', 'chuni_static_opt', ['opt'], ['id'], onupdate='cascade', ondelete='SET NULL')
|
||||
op.add_column('chuni_static_login_bonus_preset', sa.Column('opt', sa.BIGINT(), nullable=True))
|
||||
op.create_foreign_key(None, 'chuni_static_login_bonus_preset', 'chuni_static_opt', ['opt'], ['id'], onupdate='cascade', ondelete='SET NULL')
|
||||
op.add_column('chuni_static_map_icon', sa.Column('opt', sa.BIGINT(), nullable=True))
|
||||
op.create_foreign_key(None, 'chuni_static_map_icon', 'chuni_static_opt', ['opt'], ['id'], onupdate='cascade', ondelete='SET NULL')
|
||||
op.add_column('chuni_static_music', sa.Column('opt', sa.BIGINT(), nullable=True))
|
||||
op.create_foreign_key(None, 'chuni_static_music', 'chuni_static_opt', ['opt'], ['id'], onupdate='cascade', ondelete='SET NULL')
|
||||
op.add_column('chuni_static_system_voice', sa.Column('opt', sa.BIGINT(), nullable=True))
|
||||
op.create_foreign_key(None, 'chuni_static_system_voice', 'chuni_static_opt', ['opt'], ['id'], onupdate='cascade', ondelete='SET NULL')
|
||||
op.add_column('chuni_static_trophy', sa.Column('opt', sa.BIGINT(), nullable=True))
|
||||
op.create_foreign_key(None, 'chuni_static_trophy', 'chuni_static_opt', ['opt'], ['id'], onupdate='cascade', ondelete='SET NULL')
|
||||
op.add_column('mai2_static_cards', sa.Column('opt', sa.BIGINT(), nullable=True))
|
||||
op.create_foreign_key(None, 'mai2_static_cards', 'cm_static_opts', ['opt'], ['id'], onupdate='cascade', ondelete='SET NULL')
|
||||
op.add_column('mai2_static_event', sa.Column('opt', sa.BIGINT(), nullable=True))
|
||||
op.create_foreign_key(None, 'mai2_static_event', 'mai2_static_opt', ['opt'], ['id'], onupdate='cascade', ondelete='SET NULL')
|
||||
op.add_column('mai2_static_music', sa.Column('opt', sa.BIGINT(), nullable=True))
|
||||
op.create_foreign_key(None, 'mai2_static_music', 'mai2_static_opt', ['opt'], ['id'], onupdate='cascade', ondelete='SET NULL')
|
||||
op.add_column('mai2_static_ticket', sa.Column('opt', sa.BIGINT(), nullable=True))
|
||||
op.create_foreign_key(None, 'mai2_static_ticket', 'mai2_static_opt', ['opt'], ['id'], onupdate='cascade', ondelete='SET NULL')
|
||||
op.add_column('ongeki_static_cards', sa.Column('opt', sa.BIGINT(), nullable=True))
|
||||
op.create_foreign_key(None, 'ongeki_static_cards', 'ongeki_static_opt', ['opt'], ['id'], onupdate='cascade', ondelete='SET NULL')
|
||||
op.add_column('ongeki_static_events', sa.Column('opt', sa.BIGINT(), nullable=True))
|
||||
op.create_foreign_key(None, 'ongeki_static_events', 'ongeki_static_opt', ['opt'], ['id'], onupdate='cascade', ondelete='SET NULL')
|
||||
op.add_column('ongeki_static_gachas', sa.Column('opt', sa.BIGINT(), nullable=True))
|
||||
op.create_foreign_key(None, 'ongeki_static_gachas', 'cm_static_opts', ['opt'], ['id'], onupdate='cascade', ondelete='SET NULL')
|
||||
op.add_column('ongeki_static_music', sa.Column('opt', sa.BIGINT(), nullable=True))
|
||||
op.create_foreign_key(None, 'ongeki_static_music', 'ongeki_static_opt', ['opt'], ['id'], onupdate='cascade', ondelete='SET NULL')
|
||||
op.add_column('ongeki_static_rewards', sa.Column('opt', sa.BIGINT(), nullable=True))
|
||||
op.create_foreign_key(None, 'ongeki_static_rewards', 'ongeki_static_opt', ['opt'], ['id'], onupdate='cascade', ondelete='SET NULL')
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_constraint("ongeki_static_rewards_ibfk_1", 'ongeki_static_rewards', type_='foreignkey')
|
||||
op.drop_column('ongeki_static_rewards', 'opt')
|
||||
op.drop_constraint("ongeki_static_music_ibfk_1", 'ongeki_static_music', type_='foreignkey')
|
||||
op.drop_column('ongeki_static_music', 'opt')
|
||||
op.drop_constraint("ongeki_static_gachas_ibfk_1", 'ongeki_static_gachas', type_='foreignkey')
|
||||
op.drop_column('ongeki_static_gachas', 'opt')
|
||||
op.drop_constraint("ongeki_static_events_ibfk_1", "ongeki_static_events", type_='foreignkey')
|
||||
op.drop_column('ongeki_static_events', 'opt')
|
||||
op.drop_constraint("ongeki_static_cards_ibfk_1", "ongeki_static_cards", type_='foreignkey')
|
||||
op.drop_column('ongeki_static_cards', 'opt')
|
||||
op.drop_constraint("mai2_static_ticket_ibfk_1", "mai2_static_ticket", type_='foreignkey')
|
||||
op.drop_column('mai2_static_ticket', 'opt')
|
||||
op.drop_constraint("mai2_static_music_ibfk_1", "mai2_static_music", type_='foreignkey')
|
||||
op.drop_column('mai2_static_music', 'opt')
|
||||
op.drop_constraint("mai2_static_event_ibfk_1", "mai2_static_event", type_='foreignkey')
|
||||
op.drop_column('mai2_static_event', 'opt')
|
||||
op.drop_constraint("mai2_static_cards_ibfk_1", "mai2_static_cards", type_='foreignkey')
|
||||
op.drop_column('mai2_static_cards', 'opt')
|
||||
op.drop_constraint("chuni_static_trophy_ibfk_1", "chuni_static_trophy", type_='foreignkey')
|
||||
op.drop_column('chuni_static_trophy', 'opt')
|
||||
op.drop_constraint("chuni_static_system_voice_ibfk_1", "chuni_static_system_voice", type_='foreignkey')
|
||||
op.drop_column('chuni_static_system_voice', 'opt')
|
||||
op.drop_constraint("chuni_static_music_ibfk_1", "chuni_static_music", type_='foreignkey')
|
||||
op.drop_column('chuni_static_music', 'opt')
|
||||
op.drop_constraint("chuni_static_map_icon_ibfk_1", "chuni_static_map_icon", type_='foreignkey')
|
||||
op.drop_column('chuni_static_map_icon', 'opt')
|
||||
op.drop_constraint("chuni_static_login_bonus_preset_ibfk_1", "chuni_static_login_bonus_preset", type_='foreignkey')
|
||||
op.drop_column('chuni_static_login_bonus_preset', 'opt')
|
||||
op.drop_constraint("chuni_static_login_bonus_ibfk_2", "chuni_static_login_bonus", type_='foreignkey')
|
||||
op.drop_column('chuni_static_login_bonus', 'opt')
|
||||
op.drop_constraint("chuni_static_gachas_ibfk_1", "chuni_static_gachas", type_='foreignkey')
|
||||
op.drop_column('chuni_static_gachas', 'opt')
|
||||
op.drop_constraint("chuni_static_events_ibfk_1", "chuni_static_events", type_='foreignkey')
|
||||
op.drop_column('chuni_static_events', 'opt')
|
||||
op.drop_constraint("chuni_static_charge_ibfk_1", "chuni_static_charge", type_='foreignkey')
|
||||
op.drop_column('chuni_static_charge', 'opt')
|
||||
op.drop_constraint("chuni_static_character_ibfk_1", "chuni_static_character", type_='foreignkey')
|
||||
op.drop_column('chuni_static_character', 'opt')
|
||||
op.drop_constraint("chuni_static_cards_ibfk_1", "chuni_static_cards", type_='foreignkey')
|
||||
op.drop_column('chuni_static_cards', 'opt')
|
||||
op.drop_constraint("chuni_static_avatar_ibfk_1", "chuni_static_avatar", type_='foreignkey')
|
||||
op.drop_column('chuni_static_avatar', 'opt')
|
||||
op.drop_table('ongeki_static_opt')
|
||||
op.drop_table('mai2_static_opt')
|
||||
op.drop_table('cm_static_opts')
|
||||
op.drop_table('chuni_static_opt')
|
||||
# ### end Alembic commands ###
|
||||
@@ -0,0 +1,66 @@
|
||||
"""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 ###
|
||||
@@ -1,8 +1,14 @@
|
||||
"""Mai2 PRiSM support
|
||||
|
||||
<<<<<<<< HEAD:core/data/alembic/versions/5d7b38996e67_mai2_prism_support.py
|
||||
Revision ID: 5d7b38996e67
|
||||
Revises: 1d0014d35220
|
||||
Create Date: 2025-04-04 06:28:24.898912
|
||||
========
|
||||
Revision ID: 5cf98cfe52ad
|
||||
Revises: 263884e774cc
|
||||
Create Date: 2025-04-08 08:00:51.243089
|
||||
>>>>>>>> refs/heads/develop:core/data/alembic/versions/5cf98cfe52ad_mai2_prism_support.py
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
@@ -10,14 +16,20 @@ import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
<<<<<<<< HEAD:core/data/alembic/versions/5d7b38996e67_mai2_prism_support.py
|
||||
revision = '5d7b38996e67'
|
||||
down_revision = '1d0014d35220'
|
||||
========
|
||||
revision = '5cf98cfe52ad'
|
||||
down_revision = '263884e774cc'
|
||||
>>>>>>>> refs/heads/develop:core/data/alembic/versions/5cf98cfe52ad_mai2_prism_support.py
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
<<<<<<<< HEAD:core/data/alembic/versions/5d7b38996e67_mai2_prism_support.py
|
||||
op.create_table('mai2_static_kaleidxscope_condition',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('conditionId', sa.Integer(), nullable=True),
|
||||
@@ -28,6 +40,8 @@ def upgrade():
|
||||
sa.UniqueConstraint('conditionId', 'conditionName', 'songId', 'songName', name='mai2_static_kaleidxscope_uk'),
|
||||
mysql_charset='utf8mb4'
|
||||
)
|
||||
========
|
||||
>>>>>>>> refs/heads/develop:core/data/alembic/versions/5cf98cfe52ad_mai2_prism_support.py
|
||||
op.create_table('mai2_score_kaleidxscope',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('user', sa.Integer(), nullable=False),
|
||||
@@ -59,5 +73,8 @@ def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('mai2_playlog', 'extBool2')
|
||||
op.drop_table('mai2_score_kaleidxscope')
|
||||
<<<<<<<< HEAD:core/data/alembic/versions/5d7b38996e67_mai2_prism_support.py
|
||||
op.drop_table('mai2_static_kaleidxscope_condition')
|
||||
========
|
||||
>>>>>>>> refs/heads/develop:core/data/alembic/versions/5cf98cfe52ad_mai2_prism_support.py
|
||||
# ### end Alembic commands ###
|
||||
@@ -0,0 +1,30 @@
|
||||
"""chuni_nameplate_add_opt
|
||||
|
||||
Revision ID: ae364c078429
|
||||
Revises: 5cf98cfe52ad
|
||||
Create Date: 2025-04-08 00:22:22.370660
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import mysql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'ae364c078429'
|
||||
down_revision = '5cf98cfe52ad'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('chuni_static_nameplate', sa.Column('opt', sa.BIGINT(), nullable=True))
|
||||
op.create_foreign_key(None, 'chuni_static_nameplate', 'chuni_static_opt', ['opt'], ['id'], onupdate='cascade', ondelete='SET NULL')
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_constraint("chuni_static_nameplate_ibfk_1", 'chuni_static_nameplate', type_='foreignkey')
|
||||
op.drop_column('chuni_static_nameplate', 'opt')
|
||||
# ### end Alembic commands ###
|
||||
@@ -1,28 +0,0 @@
|
||||
"""Mai2 add PRiSM+ playlog support
|
||||
|
||||
Revision ID: bdf710616ba4
|
||||
Revises: 16f34bf7b968
|
||||
Create Date: 2025-04-02 12:42:08.981516
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'bdf710616ba4'
|
||||
down_revision = '16f34bf7b968'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('mai2_playlog', sa.Column('extBool3', sa.Boolean(), nullable=True,server_default=sa.text("NULL")))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('mai2_playlog', 'extBool3')
|
||||
# ### end Alembic commands ###
|
||||
@@ -0,0 +1,50 @@
|
||||
"""add_billing_playcount
|
||||
|
||||
Revision ID: f6007bbf057d
|
||||
Revises: 27e3434740df
|
||||
Create Date: 2025-04-19 18:20:35.554137
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import mysql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'f6007bbf057d'
|
||||
down_revision = '27e3434740df'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('machine_billing_playcount',
|
||||
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('year', sa.INTEGER(), nullable=False),
|
||||
sa.Column('month', sa.INTEGER(), nullable=False),
|
||||
sa.Column('playct', sa.BIGINT(), server_default='1', nullable=False),
|
||||
sa.ForeignKeyConstraint(['machine'], ['machine.id'], onupdate='cascade', ondelete='cascade'),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('machine'),
|
||||
sa.UniqueConstraint('machine', 'game_id', 'year', 'month', name='machine_billing_playcount_uk'),
|
||||
mysql_charset='utf8mb4'
|
||||
)
|
||||
op.add_column('machine_billing_credit', sa.Column('game_id', sa.CHAR(length=5), nullable=False))
|
||||
op.drop_constraint("machine_billing_credit_ibfk_1", "machine_billing_credit", "foreignkey")
|
||||
op.drop_index('machine', table_name='machine_billing_credit')
|
||||
op.create_unique_constraint('machine_billing_credit_uk', 'machine_billing_credit', ['machine', 'game_id'])
|
||||
op.create_foreign_key("machine_billing_credit_ibfk_1", "machine_billing_credit", "machine", ["machine"], ["id"], onupdate='cascade', ondelete='cascade')
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_constraint("machine_billing_credit_ibfk_1", "machine_billing_credit", "foreignkey")
|
||||
op.drop_constraint('machine_billing_credit_uk', 'machine_billing_credit', type_='unique')
|
||||
op.create_index('machine', 'machine_billing_credit', ['machine'], unique=True)
|
||||
op.create_foreign_key("machine_billing_credit_ibfk_1", "machine_billing_credit", "machine", ["machine"], ["id"], onupdate='cascade', ondelete='cascade')
|
||||
op.drop_column('machine_billing_credit', 'game_id')
|
||||
op.drop_table('machine_billing_playcount')
|
||||
# ### end Alembic commands ###
|
||||
@@ -1,12 +1,13 @@
|
||||
import re
|
||||
from typing import List, Optional
|
||||
from datetime import datetime
|
||||
|
||||
from sqlalchemy import Column, Table, and_, or_
|
||||
from sqlalchemy import Column, Table, and_, or_, UniqueConstraint
|
||||
from sqlalchemy.dialects.mysql import insert
|
||||
from sqlalchemy.engine import Row
|
||||
from sqlalchemy.sql import func, select
|
||||
from sqlalchemy.sql.schema import ForeignKey, PrimaryKeyConstraint
|
||||
from sqlalchemy.types import JSON, Boolean, Integer, String
|
||||
from sqlalchemy.types import JSON, Boolean, Integer, String, BIGINT, INTEGER, CHAR, FLOAT
|
||||
|
||||
from core.data.schema.base import BaseData, metadata
|
||||
|
||||
@@ -67,6 +68,76 @@ arcade_owner: Table = Table(
|
||||
mysql_charset="utf8mb4",
|
||||
)
|
||||
|
||||
billing_charge: Table = Table(
|
||||
"machine_billing_charge",
|
||||
metadata,
|
||||
Column("id", BIGINT, primary_key=True, nullable=False),
|
||||
Column(
|
||||
"machine",
|
||||
Integer,
|
||||
ForeignKey("machine.id", ondelete="cascade", onupdate="cascade"),
|
||||
nullable=False,
|
||||
),
|
||||
Column("game_id", CHAR(5), nullable=False),
|
||||
Column("game_ver", FLOAT, nullable=False),
|
||||
Column("play_count", INTEGER, nullable=False),
|
||||
Column("play_limit", INTEGER, nullable=False),
|
||||
Column("product_code", INTEGER, nullable=False),
|
||||
Column("product_count", INTEGER, nullable=False),
|
||||
Column("func_type", INTEGER, nullable=False),
|
||||
Column("player_number", INTEGER, nullable=False),
|
||||
mysql_charset="utf8mb4",
|
||||
)
|
||||
|
||||
# These settings are only really of interest
|
||||
# for real cabinets operating as pay-to-play
|
||||
billing_credit: Table = Table(
|
||||
"machine_billing_credit",
|
||||
metadata,
|
||||
Column("id", BIGINT, primary_key=True, nullable=False),
|
||||
Column(
|
||||
"machine",
|
||||
Integer,
|
||||
ForeignKey("machine.id", ondelete="cascade", onupdate="cascade"),
|
||||
nullable=False
|
||||
),
|
||||
Column("game_id", CHAR(5), nullable=False),
|
||||
Column("chute_type", INTEGER, nullable=False),
|
||||
Column("service_type", INTEGER, nullable=False),
|
||||
Column("operation_type", INTEGER, nullable=False),
|
||||
Column("coin_rate0", INTEGER, nullable=False),
|
||||
Column("coin_rate1", INTEGER, nullable=False),
|
||||
Column("coin_bonus", INTEGER, nullable=False),
|
||||
Column("credit_rate", INTEGER, nullable=False),
|
||||
Column("coin_count_slot0", INTEGER, nullable=False),
|
||||
Column("coin_count_slot1", INTEGER, nullable=False),
|
||||
Column("coin_count_slot2", INTEGER, nullable=False),
|
||||
Column("coin_count_slot3", INTEGER, nullable=False),
|
||||
Column("coin_count_slot4", INTEGER, nullable=False),
|
||||
Column("coin_count_slot5", INTEGER, nullable=False),
|
||||
Column("coin_count_slot6", INTEGER, nullable=False),
|
||||
Column("coin_count_slot7", INTEGER, nullable=False),
|
||||
UniqueConstraint("machine", "game_id", name="machine_billing_credit_uk"),
|
||||
mysql_charset="utf8mb4",
|
||||
)
|
||||
|
||||
billing_playct: Table = Table(
|
||||
"machine_billing_playcount",
|
||||
metadata,
|
||||
Column("id", BIGINT, primary_key=True, nullable=False),
|
||||
Column(
|
||||
"machine",
|
||||
Integer,
|
||||
ForeignKey("machine.id", ondelete="cascade", onupdate="cascade"),
|
||||
nullable=False, unique=True
|
||||
),
|
||||
Column("game_id", CHAR(5), nullable=False),
|
||||
Column("year", INTEGER, nullable=False),
|
||||
Column("month", INTEGER, nullable=False),
|
||||
Column("playct", BIGINT, nullable=False, server_default="1"),
|
||||
UniqueConstraint("machine", "game_id", "year", "month", name="machine_billing_playcount_uk"),
|
||||
mysql_charset="utf8mb4",
|
||||
)
|
||||
|
||||
class ArcadeData(BaseData):
|
||||
async def get_machine(self, serial: Optional[str] = None, id: Optional[int] = None) -> Optional[Row]:
|
||||
@@ -345,6 +416,120 @@ class ArcadeData(BaseData):
|
||||
return result.fetchone()['count_1']
|
||||
self.logger.error("Failed to count machine serials that start with A69A!")
|
||||
|
||||
async def billing_add_charge(self, machine_id: int, game_id: str, game_ver: float, playcount: int, playlimit, product_code: int, product_count: int, func_type: int, player_num: int) -> Optional[int]:
|
||||
result = await self.execute(billing_charge.insert().values(
|
||||
machine=machine_id,
|
||||
game_id=game_id,
|
||||
game_ver=game_ver,
|
||||
play_count=playcount,
|
||||
play_limit=playlimit,
|
||||
product_code=product_code,
|
||||
product_count=product_count,
|
||||
func_type=func_type,
|
||||
player_number=player_num
|
||||
))
|
||||
|
||||
if result is None:
|
||||
self.logger.error(f"Failed to add billing charge for machine {machine_id}!")
|
||||
return None
|
||||
return result.lastrowid
|
||||
|
||||
async def billing_get_last_charge(self, machine_id: int, game_id: str) -> Optional[Row]:
|
||||
result = await self.execute(billing_charge.select(
|
||||
and_(billing_charge.c.machine == machine_id, billing_charge.c.game_id == game_id)
|
||||
).order_by(billing_charge.c.id.desc()).limit(3))
|
||||
if result:
|
||||
return result.fetchone()
|
||||
|
||||
async def billing_set_credit(self, machine_id: int, game_id: str, chute_type: int, service_type: int, op_mode: int, coin_rate0: int, coin_rate1: int,
|
||||
bonus_adder: int, coin_to_credit_rate: int, coin_count_slot0: int, coin_count_slot1: int, coin_count_slot2: int, coin_count_slot3: int,
|
||||
coin_count_slot4: int, coin_count_slot5: int, coin_count_slot6: int, coin_count_slot7: int) -> Optional[int]:
|
||||
|
||||
sql = insert(billing_credit).values(
|
||||
machine=machine_id,
|
||||
game_id=game_id,
|
||||
chute_type=chute_type,
|
||||
service_type=service_type,
|
||||
operation_type=op_mode,
|
||||
coin_rate0=coin_rate0,
|
||||
coin_rate1=coin_rate1,
|
||||
coin_bonus=bonus_adder,
|
||||
credit_rate=coin_to_credit_rate,
|
||||
coin_count_slot0=coin_count_slot0,
|
||||
coin_count_slot1=coin_count_slot1,
|
||||
coin_count_slot2=coin_count_slot2,
|
||||
coin_count_slot3=coin_count_slot3,
|
||||
coin_count_slot4=coin_count_slot4,
|
||||
coin_count_slot5=coin_count_slot5,
|
||||
coin_count_slot6=coin_count_slot6,
|
||||
coin_count_slot7=coin_count_slot7,
|
||||
)
|
||||
|
||||
conflict = sql.on_duplicate_key_update(
|
||||
chute_type=chute_type,
|
||||
service_type=service_type,
|
||||
operation_type=op_mode,
|
||||
coin_rate0=coin_rate0,
|
||||
coin_rate1=coin_rate1,
|
||||
coin_bonus=bonus_adder,
|
||||
credit_rate=coin_to_credit_rate,
|
||||
coin_count_slot0=coin_count_slot0,
|
||||
coin_count_slot1=coin_count_slot1,
|
||||
coin_count_slot2=coin_count_slot2,
|
||||
coin_count_slot3=coin_count_slot3,
|
||||
coin_count_slot4=coin_count_slot4,
|
||||
coin_count_slot5=coin_count_slot5,
|
||||
coin_count_slot6=coin_count_slot6,
|
||||
coin_count_slot7=coin_count_slot7,
|
||||
)
|
||||
|
||||
result = await self.execute(conflict)
|
||||
if result is None:
|
||||
self.logger.error(f"Failed to set billing credit settings for machine {machine_id}!")
|
||||
return None
|
||||
return result.lastrowid
|
||||
|
||||
async def billing_get_credit(self, machine_id: int, game_id: str) -> Optional[Row]:
|
||||
result = await self.execute(billing_credit.select(
|
||||
and_(billing_credit.c.machine == machine_id, billing_credit.c.game_id == game_id)
|
||||
))
|
||||
if result:
|
||||
return result.fetchone()
|
||||
|
||||
async def billing_add_playcount(self, machine_id: int, game_id: str, playct: int = 1) -> None:
|
||||
now = datetime.now()
|
||||
sql = insert(billing_playct).values(
|
||||
machine=machine_id,
|
||||
game_id=game_id,
|
||||
year=now.year,
|
||||
month=now.month,
|
||||
playct=playct
|
||||
)
|
||||
|
||||
conflict = sql.on_duplicate_key_update(playct=billing_playct.c.playct + playct)
|
||||
result = await self.execute(conflict)
|
||||
|
||||
if result is None:
|
||||
self.logger.error(f"Failed to add playcount for machine {machine_id} running {game_id}")
|
||||
|
||||
async def billing_get_playcount_3mo(self, machine_id: int, game_id: str) -> Optional[List[Row]]:
|
||||
result = await self.execute(billing_playct.select(and_(
|
||||
billing_playct.c.machine == machine_id,
|
||||
billing_playct.c.game_id == game_id
|
||||
)).order_by(billing_playct.c.year.desc(), billing_playct.c.month.desc()).limit(3))
|
||||
|
||||
if result is not None:
|
||||
return result.fetchall()
|
||||
|
||||
async def billing_get_last_playcount(self, machine_id: int, game_id: str) -> Optional[Row]:
|
||||
result = await self.execute(billing_playct.select(and_(
|
||||
billing_playct.c.machine == machine_id,
|
||||
billing_playct.c.game_id == game_id
|
||||
)).order_by(billing_playct.c.year.desc(), billing_playct.c.month.desc()).limit(1))
|
||||
|
||||
if result is not None:
|
||||
return result.fetchone()
|
||||
|
||||
def format_serial(
|
||||
self, platform_code: str, platform_rev: int, serial_letter: str, serial_num: int, append: int, dash: bool = False
|
||||
) -> str:
|
||||
@@ -371,7 +556,6 @@ class ArcadeData(BaseData):
|
||||
month = ((month - 1) + 9) % 12 # Offset so April=0
|
||||
return f"{year:02}{month // 6:01}{month % 6 + 1:01}"
|
||||
|
||||
|
||||
def parse_keychip_suffix(self, suffix: str) -> tuple[int, int]:
|
||||
year = int(suffix[0:2])
|
||||
half = int(suffix[2])
|
||||
|
||||
Reference in New Issue
Block a user