Files
notifications-api/migrations/versions/0179_billing_primary_const.py

49 lines
1.4 KiB
Python
Raw Normal View History

"""
2018-03-16 10:55:36 +00:00
Revision ID: 0179_billing_primary_const
Revises: 0178_add_filename
Create Date: 2018-03-13 14:52:40.413474
"""
2024-04-01 15:12:33 -07:00
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
2023-08-29 14:54:30 -07:00
revision = "0179_billing_primary_const"
down_revision = "0178_add_filename"
def upgrade():
2023-08-29 14:54:30 -07:00
op.drop_column("ft_billing", "crown")
op.drop_column("ft_billing", "annual_billing_id")
op.drop_column("ft_billing", "organisation_id")
op.drop_constraint("ft_billing_pkey", "ft_billing", type_="primary")
# These are the orthogonal dimensions that define a row (except international).
# These entries define a unique record.
2023-08-29 14:54:30 -07:00
op.create_primary_key(
"ft_billing_pkey",
"ft_billing",
["bst_date", "template_id", "rate_multiplier", "provider", "international"],
)
def downgrade():
2023-08-29 14:54:30 -07:00
op.add_column(
"ft_billing",
sa.Column(
"organisation_id", postgresql.UUID(), autoincrement=False, nullable=True
),
)
op.add_column(
"ft_billing",
sa.Column(
"annual_billing_id", postgresql.UUID(), autoincrement=False, nullable=True
),
)
op.add_column(
"ft_billing", sa.Column("crown", sa.TEXT(), autoincrement=False, nullable=True)
)
op.drop_constraint("ft_billing_pkey", "ft_billing", type_="primary")
op.create_primary_key("ft_billing_pkey", "ft_billing", ["bst_date", "template_id"])