fix init db, force play_key_id to be nullable

This commit is contained in:
aronwk-aaron 2022-11-29 19:23:50 -06:00
parent 19f38b379e
commit 5e59d3b43c
2 changed files with 34 additions and 2 deletions

View File

@ -103,14 +103,13 @@ def upgrade():
sa.Column('other_player_id', mysql.TEXT(), nullable=False), sa.Column('other_player_id', mysql.TEXT(), nullable=False),
sa.Column('selection', mysql.TEXT(), nullable=False), sa.Column('selection', mysql.TEXT(), nullable=False),
sa.Column('submitted', mysql.TIMESTAMP(), server_default=sa.text('now()'), 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') sa.PrimaryKeyConstraint('id')
) )
op.add_column('bug_reports', sa.Column('resolved_time', mysql.TIMESTAMP(), nullable=True)) 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('resoleved_by_id', sa.Integer(), nullable=True))
op.add_column('bug_reports', sa.Column('resolution', mysql.TEXT(), 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']) op.create_foreign_key(None, 'bug_reports', 'accounts', ['resoleved_by_id'], ['id'], ondelete='CASCADE')
if 'charinfo' not in tables: if 'charinfo' not in tables:
op.create_table('charinfo', op.create_table('charinfo',

View File

@ -0,0 +1,33 @@
"""force play_key_id to be nullable
Revision ID: a6e42ef03da7
Revises: 8e52b5c7568a
Create Date: 2022-11-29 19:14:22.645911
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
# revision identifiers, used by Alembic.
revision = 'a6e42ef03da7'
down_revision = '8e52b5c7568a'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column('accounts', 'play_key_id',
existing_type=mysql.INTEGER(display_width=11),
nullable=True)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column('accounts', 'play_key_id',
existing_type=mysql.INTEGER(display_width=11),
nullable=False)
# ### end Alembic commands ###