From 45e714e69495f7bc3d93ce88e7a4e0a7bba4b39a Mon Sep 17 00:00:00 2001 From: Katie Smith Date: Thu, 27 Sep 2018 17:35:57 +0100 Subject: [PATCH] Update first class letter rate start dates We want to bring the start dates for first class letter rates forward by a month so that we don't see billing errors when sending first class letters now. (The feature will still go live at the planned time - this is to let us test things beforehand.) --- .../0233_updated_first_class_dates.py | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 migrations/versions/0233_updated_first_class_dates.py diff --git a/migrations/versions/0233_updated_first_class_dates.py b/migrations/versions/0233_updated_first_class_dates.py new file mode 100644 index 000000000..736435d6b --- /dev/null +++ b/migrations/versions/0233_updated_first_class_dates.py @@ -0,0 +1,30 @@ +"""empty message + +Revision ID: 0233_updated_first_class_dates +Revises: 0230_noti_postage_constraint_3 + +""" + +revision = '0233_updated_first_class_dates' +down_revision = '0230_noti_postage_constraint_3' + +from datetime import datetime +from alembic import op +from sqlalchemy.sql import text + + +START_DATE = datetime(2018, 8, 31, 23, 0) + + +def upgrade(): + conn = op.get_bind() + conn.execute(text( + """UPDATE letter_rates SET start_date = :start_date WHERE post_class = 'first'""" + ), start_date=START_DATE) + + +def downgrade(): + ''' + This data migration should not be downgraded. Downgrading may cause billing errors + and the /montly-usage endpoint to stop working. + '''