Files
notifications-api/migrations/versions/0324_int_letter_rates.py
Steven Reilly ff4190a8eb Remove letters-related code (#175)
This deletes a big ol' chunk of code related to letters. It's not everything—there are still a few things that might be tied to sms/email—but it's the the heart of letters function. SMS and email function should be untouched by this.

Areas affected:

- Things obviously about letters
- PDF tasks, used for precompiling letters
- Virus scanning, used for those PDFs
- FTP, used to send letters to the printer
- Postage stuff
2023-03-02 20:20:31 -05:00

54 lines
1.2 KiB
Python

"""
Revision ID: 0324_int_letter_rates
Revises: 0323_broadcast_message
Create Date: 2020-07-08 12:20:20.700128
"""
import itertools
import uuid
from datetime import datetime
from alembic import op
from sqlalchemy.sql import text
revision = '0324_int_letter_rates'
down_revision = '0323_broadcast_message'
base_rate = 76
start_date = datetime(2020, 7, 1, 0, 0)
def upgrade():
"""
Insert these letter rates for a post_class of both `europe` and `rest-of-world`:
1 sheet - £0.84
2 sheets - £0.92
3 sheets - £1.00
4 sheets - £1.08
5 sheets - £1.16
"""
# op.bulk_insert('letter_rates', [
# {
# 'id': uuid.uuid4(),
# 'start_date': start_date,
# 'end_date': None,
# 'sheet_count': sheet_count,
# 'rate': (base_rate + (8 * sheet_count)) / 100.0,
# 'crown': crown,
# 'post_class': post_class,
# }
# for sheet_count, crown, post_class in itertools.product(
# range(1, 6),
# [True, False],
# ['europe', 'rest-of-world']
# )
# ])
pass
def downgrade():
conn = op.get_bind()
conn.execute(text("DELETE FROM letter_rates WHERE start_date = :start"), start=start_date)