Files
notifications-api/migrations/versions/0202_new_letter_pricing.py
Katie Smith 8f211e00f5 Migration for new letter pricing
We now support letters of up to 5 sheets long, so we need to store the
rates for 4 and 5 sheet letters (both crown and non-crown) in the
`letter_rates` table.
2018-07-10 09:34:42 +01:00

38 lines
941 B
Python

"""empty message
Revision ID: 0202_new_letter_pricing
Revises: 0201_another_letter_org
Create Date: 2017-07-09 12:44:16.815039
"""
revision = '0202_new_letter_pricing'
down_revision = '0201_another_letter_org'
import uuid
from datetime import datetime
from alembic import op
start = datetime(2018, 6, 30, 23, 0)
NEW_RATES = [
(uuid.uuid4(), start, 4, 0.39, True, 'second'),
(uuid.uuid4(), start, 4, 0.51, False, 'second'),
(uuid.uuid4(), start, 5, 0.42, True, 'second'),
(uuid.uuid4(), start, 5, 0.57, False, 'second'),
]
def upgrade():
conn = op.get_bind()
for id, start_date, sheet_count, rate, crown, post_class in NEW_RATES:
conn.execute("""
INSERT INTO letter_rates (id, start_date, sheet_count, rate, crown, post_class)
VALUES ('{}', '{}', '{}', '{}', '{}', '{}')
""".format(id, start_date, sheet_count, rate, crown, post_class))
def downgrade():
pass