31 lines
803 B
Python
31 lines
803 B
Python
"""Сидинг справочников: дополнения и фракции (идемпотентно).
|
|
|
|
Revision ID: 0002_seed_reference
|
|
Revises: 0001_initial
|
|
Create Date: 2026-06-15
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
from sqlmodel import Session
|
|
|
|
from alembic import op
|
|
from app.seed.reference_data import seed_reference_data
|
|
|
|
revision: str = "0002_seed_reference"
|
|
down_revision: Union[str, None] = "0001_initial"
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
bind = op.get_bind()
|
|
with Session(bind=bind) as session:
|
|
seed_reference_data(session)
|
|
|
|
|
|
def downgrade() -> None:
|
|
bind = op.get_bind()
|
|
op.execute("DELETE FROM factions")
|
|
op.execute("DELETE FROM expansions")
|
|
_ = bind
|