-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4428 from magfest/fix-magdev1339
Add guidebook images to MIVS show info step
- Loading branch information
Showing
7 changed files
with
210 additions
and
41 deletions.
There are no files selected for viewing
67 changes: 67 additions & 0 deletions
67
alembic/versions/f01a2ad10d79_add_header_thumbnail_flag_to_mivs_images.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
"""Add header/thumbnail flag to MIVS images | ||
Revision ID: f01a2ad10d79 | ||
Revises: 58756e2dfe4d | ||
Create Date: 2024-11-05 15:23:12.065060 | ||
""" | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = 'f01a2ad10d79' | ||
down_revision = '58756e2dfe4d' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
|
||
try: | ||
is_sqlite = op.get_context().dialect.name == 'sqlite' | ||
except Exception: | ||
is_sqlite = False | ||
|
||
if is_sqlite: | ||
op.get_context().connection.execute('PRAGMA foreign_keys=ON;') | ||
utcnow_server_default = "(datetime('now', 'utc'))" | ||
else: | ||
utcnow_server_default = "timezone('utc', current_timestamp)" | ||
|
||
def sqlite_column_reflect_listener(inspector, table, column_info): | ||
"""Adds parenthesis around SQLite datetime defaults for utcnow.""" | ||
if column_info['default'] == "datetime('now', 'utc')": | ||
column_info['default'] = utcnow_server_default | ||
|
||
sqlite_reflect_kwargs = { | ||
'listeners': [('column_reflect', sqlite_column_reflect_listener)] | ||
} | ||
|
||
# =========================================================================== | ||
# HOWTO: Handle alter statements in SQLite | ||
# | ||
# def upgrade(): | ||
# if is_sqlite: | ||
# with op.batch_alter_table('table_name', reflect_kwargs=sqlite_reflect_kwargs) as batch_op: | ||
# batch_op.alter_column('column_name', type_=sa.Unicode(), server_default='', nullable=False) | ||
# else: | ||
# op.alter_column('table_name', 'column_name', type_=sa.Unicode(), server_default='', nullable=False) | ||
# | ||
# =========================================================================== | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.add_column('indie_game_image', sa.Column('is_header', sa.Boolean(), server_default='False', nullable=False)) | ||
op.add_column('indie_game_image', sa.Column('is_thumbnail', sa.Boolean(), server_default='False', nullable=False)) | ||
op.create_unique_constraint(op.f('uq_lottery_application_attendee_id'), 'lottery_application', ['attendee_id']) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_constraint(op.f('uq_lottery_application_attendee_id'), 'lottery_application', type_='unique') | ||
op.drop_column('indie_game_image', 'is_thumbnail') | ||
op.drop_column('indie_game_image', 'is_header') | ||
# ### end Alembic commands ### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters