mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-28 21:41:45 -05:00
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.
This commit is contained in:
37
migrations/versions/0202_new_letter_pricing.py
Normal file
37
migrations/versions/0202_new_letter_pricing.py
Normal file
@@ -0,0 +1,37 @@
|
||||
"""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
|
||||
Reference in New Issue
Block a user