mirror of
https://github.com/DarkflameUniverse/NexusDashboard.git
synced 2025-08-09 20:14:01 +00:00
Move Code into repo
This commit is contained in:
1
migrations/README
Normal file
1
migrations/README
Normal file
@@ -0,0 +1 @@
|
||||
Single-database configuration for Flask.
|
50
migrations/alembic.ini
Normal file
50
migrations/alembic.ini
Normal file
@@ -0,0 +1,50 @@
|
||||
# A generic, single database configuration.
|
||||
|
||||
[alembic]
|
||||
# template used to generate migration files
|
||||
# file_template = %%(rev)s_%%(slug)s
|
||||
|
||||
# set to 'true' to run the environment during
|
||||
# the 'revision' command, regardless of autogenerate
|
||||
# revision_environment = false
|
||||
|
||||
|
||||
# Logging configuration
|
||||
[loggers]
|
||||
keys = root,sqlalchemy,alembic,flask_migrate
|
||||
|
||||
[handlers]
|
||||
keys = console
|
||||
|
||||
[formatters]
|
||||
keys = generic
|
||||
|
||||
[logger_root]
|
||||
level = WARN
|
||||
handlers = console
|
||||
qualname =
|
||||
|
||||
[logger_sqlalchemy]
|
||||
level = WARN
|
||||
handlers =
|
||||
qualname = sqlalchemy.engine
|
||||
|
||||
[logger_alembic]
|
||||
level = INFO
|
||||
handlers =
|
||||
qualname = alembic
|
||||
|
||||
[logger_flask_migrate]
|
||||
level = INFO
|
||||
handlers =
|
||||
qualname = flask_migrate
|
||||
|
||||
[handler_console]
|
||||
class = StreamHandler
|
||||
args = (sys.stderr,)
|
||||
level = NOTSET
|
||||
formatter = generic
|
||||
|
||||
[formatter_generic]
|
||||
format = %(levelname)-5.5s [%(name)s] %(message)s
|
||||
datefmt = %H:%M:%S
|
91
migrations/env.py
Normal file
91
migrations/env.py
Normal file
@@ -0,0 +1,91 @@
|
||||
from __future__ import with_statement
|
||||
|
||||
import logging
|
||||
from logging.config import fileConfig
|
||||
|
||||
from flask import current_app
|
||||
|
||||
from alembic import context
|
||||
|
||||
# this is the Alembic Config object, which provides
|
||||
# access to the values within the .ini file in use.
|
||||
config = context.config
|
||||
|
||||
# Interpret the config file for Python logging.
|
||||
# This line sets up loggers basically.
|
||||
fileConfig(config.config_file_name)
|
||||
logger = logging.getLogger('alembic.env')
|
||||
|
||||
# add your model's MetaData object here
|
||||
# for 'autogenerate' support
|
||||
# from myapp import mymodel
|
||||
# target_metadata = mymodel.Base.metadata
|
||||
config.set_main_option(
|
||||
'sqlalchemy.url',
|
||||
str(current_app.extensions['migrate'].db.get_engine().url).replace(
|
||||
'%', '%%'))
|
||||
target_metadata = current_app.extensions['migrate'].db.metadata
|
||||
|
||||
# other values from the config, defined by the needs of env.py,
|
||||
# can be acquired:
|
||||
# my_important_option = config.get_main_option("my_important_option")
|
||||
# ... etc.
|
||||
|
||||
|
||||
def run_migrations_offline():
|
||||
"""Run migrations in 'offline' mode.
|
||||
|
||||
This configures the context with just a URL
|
||||
and not an Engine, though an Engine is acceptable
|
||||
here as well. By skipping the Engine creation
|
||||
we don't even need a DBAPI to be available.
|
||||
|
||||
Calls to context.execute() here emit the given string to the
|
||||
script output.
|
||||
|
||||
"""
|
||||
url = config.get_main_option("sqlalchemy.url")
|
||||
context.configure(
|
||||
url=url, target_metadata=target_metadata, literal_binds=True
|
||||
)
|
||||
|
||||
with context.begin_transaction():
|
||||
context.run_migrations()
|
||||
|
||||
|
||||
def run_migrations_online():
|
||||
"""Run migrations in 'online' mode.
|
||||
|
||||
In this scenario we need to create an Engine
|
||||
and associate a connection with the context.
|
||||
|
||||
"""
|
||||
|
||||
# this callback is used to prevent an auto-migration from being generated
|
||||
# when there are no changes to the schema
|
||||
# reference: http://alembic.zzzcomputing.com/en/latest/cookbook.html
|
||||
def process_revision_directives(context, revision, directives):
|
||||
if getattr(config.cmd_opts, 'autogenerate', False):
|
||||
script = directives[0]
|
||||
if script.upgrade_ops.is_empty():
|
||||
directives[:] = []
|
||||
logger.info('No changes in schema detected.')
|
||||
|
||||
connectable = current_app.extensions['migrate'].db.get_engine()
|
||||
|
||||
with connectable.connect() as connection:
|
||||
context.configure(
|
||||
connection=connection,
|
||||
target_metadata=target_metadata,
|
||||
process_revision_directives=process_revision_directives,
|
||||
**current_app.extensions['migrate'].configure_args
|
||||
)
|
||||
|
||||
with context.begin_transaction():
|
||||
context.run_migrations()
|
||||
|
||||
|
||||
if context.is_offline_mode():
|
||||
run_migrations_offline()
|
||||
else:
|
||||
run_migrations_online()
|
24
migrations/script.py.mako
Normal file
24
migrations/script.py.mako
Normal file
@@ -0,0 +1,24 @@
|
||||
"""${message}
|
||||
|
||||
Revision ID: ${up_revision}
|
||||
Revises: ${down_revision | comma,n}
|
||||
Create Date: ${create_date}
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
${imports if imports else ""}
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = ${repr(up_revision)}
|
||||
down_revision = ${repr(down_revision)}
|
||||
branch_labels = ${repr(branch_labels)}
|
||||
depends_on = ${repr(depends_on)}
|
||||
|
||||
|
||||
def upgrade():
|
||||
${upgrades if upgrades else "pass"}
|
||||
|
||||
|
||||
def downgrade():
|
||||
${downgrades if downgrades else "pass"}
|
270
migrations/versions/712d42956a47_initial_migration.py
Normal file
270
migrations/versions/712d42956a47_initial_migration.py
Normal file
@@ -0,0 +1,270 @@
|
||||
"""initial migration
|
||||
|
||||
Revision ID: 712d42956a47
|
||||
Revises:
|
||||
Create Date: 2021-12-10 12:00:00.848561
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import mysql
|
||||
from sqlalchemy import engine_from_config
|
||||
from sqlalchemy.engine import reflection
|
||||
from sqlalchemy.engine.reflection import Inspector
|
||||
|
||||
conn = op.get_bind()
|
||||
inspector = Inspector.from_engine(conn)
|
||||
tables = inspector.get_table_names()
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '712d42956a47'
|
||||
down_revision = None
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
if 'charxml' not in tables:
|
||||
op.create_table('charxml',
|
||||
sa.Column('id', mysql.BIGINT(), nullable=False),
|
||||
sa.Column('xml_data', sa.Text(length=4294000000), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
if 'object_id_tracker' not in tables:
|
||||
op.create_table('object_id_tracker',
|
||||
sa.Column('last_object_id', mysql.BIGINT(unsigned=True), server_default='0', nullable=False),
|
||||
sa.PrimaryKeyConstraint('last_object_id')
|
||||
)
|
||||
if 'pet_names' not in tables:
|
||||
op.create_table('pet_names',
|
||||
sa.Column('id', mysql.BIGINT(), nullable=False),
|
||||
sa.Column('pet_name', mysql.TEXT(), nullable=False),
|
||||
sa.Column('approved', mysql.INTEGER(unsigned=True), server_default='0', nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
if 'play_keys' not in tables:
|
||||
op.create_table('play_keys',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('key_string', mysql.CHAR(length=19), nullable=False),
|
||||
sa.Column('key_uses', mysql.INTEGER(), server_default='1', nullable=False),
|
||||
sa.Column('created_at', mysql.TIMESTAMP(), server_default=sa.text('now()'), nullable=False),
|
||||
sa.Column('active', sa.BOOLEAN(), server_default='1', nullable=False),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('key_string')
|
||||
)
|
||||
|
||||
op.add_column('play_keys', sa.Column('notes', mysql.TEXT(), nullable=True))
|
||||
|
||||
if 'servers' not in tables:
|
||||
op.create_table('servers',
|
||||
sa.Column('id', mysql.INTEGER(), nullable=False),
|
||||
sa.Column('name', mysql.TEXT(), nullable=False),
|
||||
sa.Column('ip', mysql.TEXT(), nullable=False),
|
||||
sa.Column('port', mysql.INTEGER(), nullable=False),
|
||||
sa.Column('state', mysql.INTEGER(), nullable=False),
|
||||
sa.Column('version', mysql.INTEGER(), server_default='0', nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
|
||||
if 'accounts' not in tables:
|
||||
op.create_table('accounts',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('name', sa.VARCHAR(length=35), nullable=False),
|
||||
sa.Column('password', sa.Text(), server_default='', nullable=False),
|
||||
sa.Column('gm_level', mysql.INTEGER(unsigned=True), server_default='0', nullable=False),
|
||||
sa.Column('locked', sa.BOOLEAN(), server_default='0', nullable=False),
|
||||
sa.Column('banned', sa.BOOLEAN(), server_default='0', nullable=False),
|
||||
sa.Column('created_at', mysql.TIMESTAMP(), server_default=sa.text('now()'), nullable=False),
|
||||
sa.Column('play_key_id', mysql.INTEGER(), nullable=True),
|
||||
sa.Column('mute_expire', mysql.BIGINT(unsigned=True), server_default='0', nullable=False),
|
||||
sa.ForeignKeyConstraint(['play_key_id'], ['play_keys.id'], ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('name')
|
||||
)
|
||||
|
||||
op.add_column('accounts', sa.Column('active', sa.BOOLEAN(), server_default='1', nullable=False))
|
||||
op.add_column('accounts', sa.Column('email_confirmed_at', sa.DateTime(), nullable=True))
|
||||
op.add_column('accounts', sa.Column('email', sa.Unicode(length=255), server_default='', nullable=True))
|
||||
|
||||
op.create_table('account_invites',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('email', sa.String(length=255), nullable=False),
|
||||
sa.Column('invited_by_user_id', sa.Integer(), nullable=True),
|
||||
sa.Column('token', sa.String(length=100), server_default='', nullable=False),
|
||||
sa.ForeignKeyConstraint(['invited_by_user_id'], ['accounts.id'], ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
|
||||
if 'bug_reports' not in tables:
|
||||
op.create_table('bug_reports',
|
||||
sa.Column('id', mysql.INTEGER(), nullable=False),
|
||||
sa.Column('body', mysql.TEXT(), nullable=False),
|
||||
sa.Column('client_version', mysql.TEXT(), nullable=False),
|
||||
sa.Column('other_player_id', mysql.TEXT(), nullable=False),
|
||||
sa.Column('selection', mysql.TEXT(), nullable=False),
|
||||
sa.Column('submitted', mysql.TIMESTAMP(), server_default=sa.text('now()'), nullable=False),
|
||||
sa.ForeignKeyConstraint(['resoleved_by_id'], ['accounts.id'], ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
|
||||
op.add_column('bug_reports', sa.Column('resolved_time', mysql.TIMESTAMP(), nullable=True))
|
||||
op.add_column('bug_reports', sa.Column('resoleved_by_id', sa.Integer(), nullable=True))
|
||||
op.add_column('bug_reports', sa.Column('resolution', mysql.TEXT(), nullable=True))
|
||||
op.create_foreign_key(None, 'bug_reports', 'accounts', ['resoleved_by_id'], ['id'])
|
||||
|
||||
if 'charinfo' not in tables:
|
||||
op.create_table('charinfo',
|
||||
sa.Column('id', mysql.BIGINT(), autoincrement=False, nullable=False),
|
||||
sa.Column('account_id', sa.Integer(), nullable=False),
|
||||
sa.Column('name', mysql.VARCHAR(length=35), nullable=False),
|
||||
sa.Column('pending_name', mysql.VARCHAR(length=35), nullable=False),
|
||||
sa.Column('needs_rename', sa.BOOLEAN(), server_default='0', nullable=False),
|
||||
sa.Column('prop_clone_id', mysql.BIGINT(unsigned=True), autoincrement=True, nullable=False),
|
||||
sa.Column('last_login', mysql.BIGINT(unsigned=True), server_default='0', nullable=False),
|
||||
sa.Column('permission_map', mysql.BIGINT(unsigned=True), server_default='0', nullable=False),
|
||||
sa.ForeignKeyConstraint(['account_id'], ['accounts.id'], ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('id', 'prop_clone_id'),
|
||||
sa.UniqueConstraint('prop_clone_id')
|
||||
)
|
||||
|
||||
# drop the primary key contstrain on prop_clone_id
|
||||
# see the model for an explanation
|
||||
op.execute('ALTER TABLE `charinfo` DROP PRIMARY KEY, ADD PRIMARY KEY (`id`) USING BTREE; ')
|
||||
|
||||
if 'activity_log' not in tables:
|
||||
op.create_table('activity_log',
|
||||
sa.Column('id', mysql.INTEGER(), nullable=False),
|
||||
sa.Column('character_id', mysql.BIGINT(), nullable=False),
|
||||
sa.Column('activity', mysql.INTEGER(), nullable=False),
|
||||
sa.Column('time', mysql.BIGINT(unsigned=True), nullable=False),
|
||||
sa.Column('map_id', mysql.INTEGER(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['character_id'], ['charinfo.id'], ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
|
||||
if 'command_log' not in tables:
|
||||
op.create_table('command_log',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('character_id', mysql.BIGINT(), nullable=False),
|
||||
sa.Column('command', mysql.VARCHAR(length=256), nullable=False),
|
||||
sa.ForeignKeyConstraint(['character_id'], ['charinfo.id'], ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
|
||||
if 'friends' not in tables:
|
||||
op.create_table('friends',
|
||||
sa.Column('player_id', mysql.BIGINT(), nullable=False),
|
||||
sa.Column('friend_id', mysql.BIGINT(), nullable=False),
|
||||
sa.Column('best_friend', sa.BOOLEAN(), server_default='0', nullable=False),
|
||||
sa.ForeignKeyConstraint(['friend_id'], ['charinfo.id'], ondelete='CASCADE'),
|
||||
sa.ForeignKeyConstraint(['player_id'], ['charinfo.id'], ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('player_id', 'friend_id')
|
||||
)
|
||||
|
||||
if 'leaderboard' not in tables:
|
||||
op.create_table('leaderboard',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('game_id', mysql.INTEGER(unsigned=True), server_default='0', nullable=False),
|
||||
sa.Column('last_played', mysql.TIMESTAMP(), server_default=sa.text('now()'), nullable=False),
|
||||
sa.Column('character_id', mysql.BIGINT(), nullable=False),
|
||||
sa.Column('time', mysql.BIGINT(unsigned=True), server_default='0', nullable=False),
|
||||
sa.Column('score', mysql.BIGINT(unsigned=True), server_default='0', nullable=False),
|
||||
sa.ForeignKeyConstraint(['character_id'], ['charinfo.id'], ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
|
||||
if 'mail' not in tables:
|
||||
op.create_table('mail',
|
||||
sa.Column('id', mysql.INTEGER(), nullable=False),
|
||||
sa.Column('sender_id', mysql.INTEGER(), nullable=False),
|
||||
sa.Column('sender_name', mysql.VARCHAR(length=35), nullable=False),
|
||||
sa.Column('receiver_id', mysql.BIGINT(), nullable=False),
|
||||
sa.Column('receiver_name', mysql.VARCHAR(length=35), nullable=False),
|
||||
sa.Column('time_sent', mysql.BIGINT(unsigned=True), nullable=False),
|
||||
sa.Column('subject', mysql.TEXT(), nullable=False),
|
||||
sa.Column('body', mysql.TEXT(), nullable=False),
|
||||
sa.Column('attachment_id', mysql.BIGINT(), server_default='0', nullable=False),
|
||||
sa.Column('attachment_lot', mysql.INTEGER(), server_default='0', nullable=False),
|
||||
sa.Column('attachment_subkey', mysql.BIGINT(), server_default='0', nullable=False),
|
||||
sa.Column('attachment_count', mysql.INTEGER(), server_default='0', nullable=False),
|
||||
sa.Column('was_read', sa.BOOLEAN(), server_default='0', nullable=False),
|
||||
sa.ForeignKeyConstraint(['receiver_id'], ['charinfo.id'], ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
|
||||
if 'properties' not in tables:
|
||||
op.create_table('properties',
|
||||
sa.Column('id', mysql.BIGINT(), autoincrement=False, nullable=False),
|
||||
sa.Column('owner_id', mysql.BIGINT(), nullable=False),
|
||||
sa.Column('template_id', mysql.INTEGER(unsigned=True), nullable=False),
|
||||
sa.Column('clone_id', mysql.BIGINT(unsigned=True), nullable=True),
|
||||
sa.Column('name', mysql.TEXT(), nullable=False),
|
||||
sa.Column('description', mysql.TEXT(), nullable=False),
|
||||
sa.Column('rent_amount', mysql.INTEGER(), nullable=False),
|
||||
sa.Column('rent_due', mysql.BIGINT(), nullable=False),
|
||||
sa.Column('privacy_option', mysql.INTEGER(), nullable=False),
|
||||
sa.Column('mod_approved', sa.BOOLEAN(), server_default='0', nullable=False),
|
||||
sa.Column('last_updated', mysql.BIGINT(), nullable=False),
|
||||
sa.Column('time_claimed', mysql.BIGINT(), nullable=False),
|
||||
sa.Column('rejection_reason', mysql.TEXT(), nullable=False),
|
||||
sa.Column('reputation', mysql.BIGINT(unsigned=True), nullable=False),
|
||||
sa.Column('zone_id', mysql.INTEGER(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['clone_id'], ['charinfo.prop_clone_id'], ondelete='CASCADE'),
|
||||
sa.ForeignKeyConstraint(['owner_id'], ['charinfo.id'], ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
|
||||
if 'ugc' not in tables:
|
||||
op.create_table('ugc',
|
||||
sa.Column('id', mysql.INTEGER(), nullable=False),
|
||||
sa.Column('account_id', sa.Integer(), nullable=False),
|
||||
sa.Column('character_id', mysql.BIGINT(), nullable=False),
|
||||
sa.Column('is_optimized', sa.BOOLEAN(), server_default='0', nullable=False),
|
||||
sa.Column('lxfml', mysql.MEDIUMBLOB(), nullable=False),
|
||||
sa.Column('bake_ao', sa.BOOLEAN(), server_default='0', nullable=False),
|
||||
sa.Column('filename', mysql.TEXT(), server_default='', nullable=False),
|
||||
sa.ForeignKeyConstraint(['account_id'], ['accounts.id'], ondelete='CASCADE'),
|
||||
sa.ForeignKeyConstraint(['character_id'], ['charinfo.id'], ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
|
||||
if 'properties_contents' not in tables:
|
||||
op.create_table('properties_contents',
|
||||
sa.Column('id', mysql.BIGINT(), autoincrement=False, nullable=False),
|
||||
sa.Column('property_id', sa.BIGINT(), nullable=False),
|
||||
sa.Column('ugc_id', sa.INTEGER(), nullable=True),
|
||||
sa.Column('lot', mysql.INTEGER(), nullable=False),
|
||||
sa.Column('x', mysql.FLOAT(), nullable=False),
|
||||
sa.Column('y', mysql.FLOAT(), nullable=False),
|
||||
sa.Column('z', mysql.FLOAT(), nullable=False),
|
||||
sa.Column('rx', mysql.FLOAT(), nullable=False),
|
||||
sa.Column('ry', mysql.FLOAT(), nullable=False),
|
||||
sa.Column('rz', mysql.FLOAT(), nullable=False),
|
||||
sa.Column('rw', mysql.FLOAT(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['property_id'], ['properties.id'], ondelete='CASCADE'),
|
||||
sa.ForeignKeyConstraint(['ugc_id'], ['ugc.id'], ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('properties_contents')
|
||||
op.drop_table('ugc')
|
||||
op.drop_table('properties')
|
||||
op.drop_table('mail')
|
||||
op.drop_table('leaderboard')
|
||||
op.drop_table('friends')
|
||||
op.drop_table('command_log')
|
||||
op.drop_table('activity_log')
|
||||
op.drop_table('charinfo')
|
||||
op.drop_table('bug_reports')
|
||||
op.drop_table('account_invites')
|
||||
op.drop_table('accounts')
|
||||
op.drop_table('servers')
|
||||
op.drop_table('play_keys')
|
||||
op.drop_table('pet_names')
|
||||
op.drop_table('object_id_tracker')
|
||||
op.drop_table('charxml')
|
||||
# ### end Alembic commands ###
|
@@ -0,0 +1,28 @@
|
||||
"""add column to track times key uses
|
||||
|
||||
Revision ID: 8a2966b9f7ee
|
||||
Revises: 712d42956a47
|
||||
Create Date: 2021-12-10 14:59:21.787133
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import mysql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '8a2966b9f7ee'
|
||||
down_revision = '712d42956a47'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('play_keys', sa.Column('times_used', mysql.INTEGER(), server_default='0', nullable=False))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('play_keys', 'times_used')
|
||||
# ### end Alembic commands ###
|
33
migrations/versions/b89c21b5112f_itemreport_table.py
Normal file
33
migrations/versions/b89c21b5112f_itemreport_table.py
Normal file
@@ -0,0 +1,33 @@
|
||||
"""itemreport table
|
||||
|
||||
Revision ID: b89c21b5112f
|
||||
Revises: 8a2966b9f7ee
|
||||
Create Date: 2022-01-15 19:21:44.544653
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import mysql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'b89c21b5112f'
|
||||
down_revision = '8a2966b9f7ee'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('item_reports',
|
||||
sa.Column('item', sa.Integer(), nullable=False),
|
||||
sa.Column('count', sa.Integer(), nullable=False),
|
||||
sa.Column('date', sa.Date(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('item', 'date')
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('item_reports')
|
||||
# ### end Alembic commands ###
|
Reference in New Issue
Block a user