Fix migration
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
"""Add marathon cover_url field
|
"""Add marathon cover fields (cover_path and cover_url)
|
||||||
|
|
||||||
Revision ID: 019_add_marathon_cover
|
Revision ID: 019_add_marathon_cover
|
||||||
Revises: 018_seed_static_content
|
Revises: 018_seed_static_content
|
||||||
@@ -27,10 +27,17 @@ def column_exists(table_name: str, column_name: str) -> bool:
|
|||||||
|
|
||||||
|
|
||||||
def upgrade() -> None:
|
def upgrade() -> None:
|
||||||
|
# cover_path - путь к файлу в S3 хранилище
|
||||||
if not column_exists('marathons', 'cover_path'):
|
if not column_exists('marathons', 'cover_path'):
|
||||||
op.add_column('marathons', sa.Column('cover_path', sa.String(500), nullable=True))
|
op.add_column('marathons', sa.Column('cover_path', sa.String(500), nullable=True))
|
||||||
|
|
||||||
|
# cover_url - API URL для доступа к обложке
|
||||||
|
if not column_exists('marathons', 'cover_url'):
|
||||||
|
op.add_column('marathons', sa.Column('cover_url', sa.String(500), nullable=True))
|
||||||
|
|
||||||
|
|
||||||
def downgrade() -> None:
|
def downgrade() -> None:
|
||||||
|
if column_exists('marathons', 'cover_url'):
|
||||||
|
op.drop_column('marathons', 'cover_url')
|
||||||
if column_exists('marathons', 'cover_path'):
|
if column_exists('marathons', 'cover_path'):
|
||||||
op.drop_column('marathons', 'cover_path')
|
op.drop_column('marathons', 'cover_path')
|
||||||
|
|||||||
Reference in New Issue
Block a user