47 lines
1.7 KiB
Python
47 lines
1.7 KiB
Python
"""Store Accounting Mirror and Tally working paths in Client/FY mirror metadata.
|
|
|
|
Revision ID: 20260920_accounting_mirror_paths
|
|
Revises: 20260918_accounting_mirror_ver
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
revision = "20260920_accounting_mirror_paths"
|
|
down_revision = "20260918_accounting_mirror_ver"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
bind = op.get_bind()
|
|
inspector = sa.inspect(bind)
|
|
columns = {c["name"] for c in inspector.get_columns("accounting_mirror_registry")}
|
|
|
|
if "mirror_local_path" not in columns:
|
|
op.add_column(
|
|
"accounting_mirror_registry",
|
|
sa.Column("mirror_local_path", sa.String(length=2000), nullable=False, server_default=""),
|
|
)
|
|
if "tally_data_relative_path" not in columns:
|
|
op.add_column(
|
|
"accounting_mirror_registry",
|
|
sa.Column("tally_data_relative_path", sa.String(length=1000), nullable=False, server_default=""),
|
|
)
|
|
if "tally_data_local_path" not in columns:
|
|
op.add_column(
|
|
"accounting_mirror_registry",
|
|
sa.Column("tally_data_local_path", sa.String(length=2000), nullable=False, server_default=""),
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
bind = op.get_bind()
|
|
inspector = sa.inspect(bind)
|
|
columns = {c["name"] for c in inspector.get_columns("accounting_mirror_registry")}
|
|
if "tally_data_local_path" in columns:
|
|
op.drop_column("accounting_mirror_registry", "tally_data_local_path")
|
|
if "tally_data_relative_path" in columns:
|
|
op.drop_column("accounting_mirror_registry", "tally_data_relative_path")
|
|
if "mirror_local_path" in columns:
|
|
op.drop_column("accounting_mirror_registry", "mirror_local_path")
|