0001_initial.py declares revision='0001', not '0001_initial'. My 0002 migration had down_revision='0001_initial', so alembic couldn't splice it into the chain and silently ran 'upgrade head' as a no-op on pod startup. The rsu_vest/rsu_offset columns never got created and every INSERT from the new code failed with 'column does not exist'.
33 lines
987 B
Python
33 lines
987 B
Python
"""Add rsu_vest and rsu_offset columns.
|
|
|
|
UK payslips for Meta report RSU grants as notional pay (gross inflation)
|
|
and offset them via a same-magnitude deduction. The cash gross Viktor
|
|
cares about for dashboarding is gross_pay - rsu_vest. Track both for
|
|
reporting + exactness; cash and tax-rate charts compute from them.
|
|
"""
|
|
import sqlalchemy as sa
|
|
|
|
from alembic import op
|
|
|
|
revision = "0002"
|
|
down_revision = "0001"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.add_column(
|
|
"payslip",
|
|
sa.Column("rsu_vest", sa.Numeric(12, 2), nullable=False, server_default=sa.text("0")),
|
|
schema="payslip_ingest",
|
|
)
|
|
op.add_column(
|
|
"payslip",
|
|
sa.Column("rsu_offset", sa.Numeric(12, 2), nullable=False, server_default=sa.text("0")),
|
|
schema="payslip_ingest",
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_column("payslip", "rsu_offset", schema="payslip_ingest")
|
|
op.drop_column("payslip", "rsu_vest", schema="payslip_ingest")
|