46 lines
1.1 KiB
Python
46 lines
1.1 KiB
Python
"""set modified/updated as nullable
|
|
|
|
Revision ID: 970563653ece
|
|
Revises:
|
|
Create Date: 2020-07-22 23:40:07.674252
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = "970563653ece"
|
|
down_revision = None
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
tables = {
|
|
"cities": "updated",
|
|
"games": "updated",
|
|
"games": "cancel_date",
|
|
"payments": "updated",
|
|
"player_availabilities": "updated",
|
|
"player_cancel_games": "updated",
|
|
"purchase_games": "updated",
|
|
"sports": "updated",
|
|
"teams": "updated",
|
|
"user_ratings": "updated",
|
|
"venues": "updated",
|
|
"venue_images": "updated",
|
|
"web_bookings": "updated",
|
|
}
|
|
for table, field in tables.items():
|
|
with op.batch_alter_table(table) as batch_op:
|
|
batch_op.alter_column(column_name=field, nullable=True, server_default=None)
|
|
query = "UPDATE {0} SET {1} = NULL WHERE {1} = '0000-00-00 00:00:00'".format(
|
|
table, field
|
|
)
|
|
op.execute(query)
|
|
|
|
|
|
def downgrade():
|
|
pass
|