47 lines
1.3 KiB
Python
47 lines
1.3 KiB
Python
"""Update boost description to one-time usage
|
|
|
|
Revision ID: 026_update_boost_desc
|
|
Revises: 025_simplify_boost
|
|
Create Date: 2026-01-08
|
|
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = '026_update_boost_desc'
|
|
down_revision: Union[str, None] = '025_simplify_boost'
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
# Update boost description in shop_items table
|
|
op.execute("""
|
|
UPDATE shop_items
|
|
SET description = 'Множитель очков x1.5 на текущее задание',
|
|
asset_data = jsonb_set(
|
|
asset_data::jsonb - 'duration_hours',
|
|
'{one_time}',
|
|
'true'
|
|
)
|
|
WHERE code = 'boost' AND item_type = 'consumable'
|
|
""")
|
|
|
|
|
|
def downgrade() -> None:
|
|
# Revert boost description
|
|
op.execute("""
|
|
UPDATE shop_items
|
|
SET description = 'Множитель очков x1.5 на следующие 2 часа',
|
|
asset_data = jsonb_set(
|
|
asset_data::jsonb - 'one_time',
|
|
'{duration_hours}',
|
|
'2'
|
|
)
|
|
WHERE code = 'boost' AND item_type = 'consumable'
|
|
""")
|