From 8b410e8876835133b7f18e42754da7c793ce950f Mon Sep 17 00:00:00 2001 From: Pea Tyczynska Date: Fri, 14 Sep 2018 17:26:43 +0100 Subject: [PATCH] Add new letter rates from 1st of October 2018 --- migrations/versions/0226_new_letter_rates.py | 53 ++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 migrations/versions/0226_new_letter_rates.py diff --git a/migrations/versions/0226_new_letter_rates.py b/migrations/versions/0226_new_letter_rates.py new file mode 100644 index 000000000..7e57d388f --- /dev/null +++ b/migrations/versions/0226_new_letter_rates.py @@ -0,0 +1,53 @@ +"""empty message + +Revision ID: 0226_new_letter_rates +Revises: 0225_another_letter_org + +""" + +revision = '0226_new_letter_rates' +down_revision = '0225_another_letter_org' + +import uuid +from datetime import datetime +from alembic import op + + +start = datetime(2018, 10, 1, 0, 0, tzinfo=timezone.utc) + +NEW_RATES = [ + (uuid.uuid4(), start, 1, 0.30, True, 'second'), + (uuid.uuid4(), start, 1, 0.30, False, 'second'), + (uuid.uuid4(), start, 2, 0.35, True, 'second'), + (uuid.uuid4(), start, 2, 0.35, False, 'second'), + (uuid.uuid4(), start, 3, 0.40, True, 'second'), + (uuid.uuid4(), start, 3, 0.40, False, 'second'), + (uuid.uuid4(), start, 4, 0.45, True, 'second'), + (uuid.uuid4(), start, 4, 0.45, False, 'second'), + (uuid.uuid4(), start, 5, 0.50, True, 'second'), + (uuid.uuid4(), start, 5, 0.50, False, 'second'), + (uuid.uuid4(), start, 1, 0.56, True, 'first'), + (uuid.uuid4(), start, 1, 0.56, False, 'first'), + (uuid.uuid4(), start, 2, 0.61, True, 'first'), + (uuid.uuid4(), start, 2, 0.61, False, 'first'), + (uuid.uuid4(), start, 3, 0.66, True, 'first'), + (uuid.uuid4(), start, 3, 0.66, False, 'first'), + (uuid.uuid4(), start, 4, 0.71, True, 'first'), + (uuid.uuid4(), start, 4, 0.71, False, 'first'), + (uuid.uuid4(), start, 5, 0.76, True, 'first'), + (uuid.uuid4(), start, 5, 0.76, False, 'first'), + +] + + +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