mirror of
https://github.com/GSA/notifications-api.git
synced 2026-05-22 01:31:36 -04:00
avoid broken migrations that get dropped in later migration
This commit is contained in:
@@ -37,28 +37,28 @@ CHANGEOVER_DATE = datetime(2019, 9, 30, 23, 0)
|
||||
def upgrade():
|
||||
# all old rates are going in the bin
|
||||
conn = op.get_bind()
|
||||
conn.execute(text("UPDATE letter_rates SET end_date = :start WHERE end_date IS NULL"), start=CHANGEOVER_DATE)
|
||||
# conn.execute(text("UPDATE letter_rates SET end_date = :start WHERE end_date IS NULL"), start=CHANGEOVER_DATE)
|
||||
|
||||
base_prices = {
|
||||
'second': 30,
|
||||
'first': 56,
|
||||
}
|
||||
op.bulk_insert('letter_rates', [
|
||||
{
|
||||
'id': uuid.uuid4(),
|
||||
'start_date': CHANGEOVER_DATE,
|
||||
'end_date': None,
|
||||
'sheet_count': sheet_count,
|
||||
'rate': (base_prices[post_class] + (5 * sheet_count)) / 100.0,
|
||||
'crown': crown,
|
||||
'post_class': post_class,
|
||||
}
|
||||
for sheet_count, crown, post_class in itertools.product(
|
||||
range(1, 6),
|
||||
[True, False],
|
||||
['first', 'second']
|
||||
)
|
||||
])
|
||||
# base_prices = {
|
||||
# 'second': 30,
|
||||
# 'first': 56,
|
||||
# }
|
||||
# op.bulk_insert('letter_rates', [
|
||||
# {
|
||||
# 'id': uuid.uuid4(),
|
||||
# 'start_date': CHANGEOVER_DATE,
|
||||
# 'end_date': None,
|
||||
# 'sheet_count': sheet_count,
|
||||
# 'rate': (base_prices[post_class] + (5 * sheet_count)) / 100.0,
|
||||
# 'crown': crown,
|
||||
# 'post_class': post_class,
|
||||
# }
|
||||
# for sheet_count, crown, post_class in itertools.product(
|
||||
# range(1, 6),
|
||||
# [True, False],
|
||||
# ['first', 'second']
|
||||
# )
|
||||
# ])
|
||||
|
||||
|
||||
def downgrade():
|
||||
|
||||
@@ -29,22 +29,23 @@ def upgrade():
|
||||
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']
|
||||
)
|
||||
])
|
||||
# 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():
|
||||
|
||||
@@ -34,24 +34,24 @@ def get_new_rate(sheet_count, post_class):
|
||||
|
||||
def upgrade():
|
||||
conn = op.get_bind()
|
||||
conn.execute(text("UPDATE letter_rates SET end_date = :start WHERE end_date IS NULL"), start=CHANGEOVER_DATE)
|
||||
# conn.execute(text("UPDATE letter_rates SET end_date = :start WHERE end_date IS NULL"), start=CHANGEOVER_DATE)
|
||||
|
||||
op.bulk_insert('letter_rates', [
|
||||
{
|
||||
'id': uuid.uuid4(),
|
||||
'start_date': CHANGEOVER_DATE,
|
||||
'end_date': None,
|
||||
'sheet_count': sheet_count,
|
||||
'rate': get_new_rate(sheet_count, post_class),
|
||||
'crown': crown,
|
||||
'post_class': post_class,
|
||||
}
|
||||
for sheet_count, crown, post_class in itertools.product(
|
||||
range(1, 6),
|
||||
[True, False],
|
||||
['first', 'second', 'europe', 'rest-of-world']
|
||||
)
|
||||
])
|
||||
# op.bulk_insert('letter_rates', [
|
||||
# {
|
||||
# 'id': uuid.uuid4(),
|
||||
# 'start_date': CHANGEOVER_DATE,
|
||||
# 'end_date': None,
|
||||
# 'sheet_count': sheet_count,
|
||||
# 'rate': get_new_rate(sheet_count, post_class),
|
||||
# 'crown': crown,
|
||||
# 'post_class': post_class,
|
||||
# }
|
||||
# for sheet_count, crown, post_class in itertools.product(
|
||||
# range(1, 6),
|
||||
# [True, False],
|
||||
# ['first', 'second', 'europe', 'rest-of-world']
|
||||
# )
|
||||
# ])
|
||||
|
||||
def downgrade():
|
||||
# Make sure you've thought about billing implications etc before downgrading!
|
||||
|
||||
@@ -34,24 +34,24 @@ def get_new_rate(sheet_count, post_class):
|
||||
|
||||
def upgrade():
|
||||
conn = op.get_bind()
|
||||
conn.execute(text("UPDATE letter_rates SET end_date = :start WHERE end_date IS NULL"), start=CHANGEOVER_DATE)
|
||||
# conn.execute(text("UPDATE letter_rates SET end_date = :start WHERE end_date IS NULL"), start=CHANGEOVER_DATE)
|
||||
|
||||
op.bulk_insert('letter_rates', [
|
||||
{
|
||||
'id': uuid.uuid4(),
|
||||
'start_date': CHANGEOVER_DATE,
|
||||
'end_date': None,
|
||||
'sheet_count': sheet_count,
|
||||
'rate': get_new_rate(sheet_count, post_class),
|
||||
'crown': crown,
|
||||
'post_class': post_class,
|
||||
}
|
||||
for sheet_count, crown, post_class in itertools.product(
|
||||
range(1, 6),
|
||||
[True, False],
|
||||
['first', 'second', 'europe', 'rest-of-world']
|
||||
)
|
||||
])
|
||||
# op.bulk_insert('letter_rates', [
|
||||
# {
|
||||
# 'id': uuid.uuid4(),
|
||||
# 'start_date': CHANGEOVER_DATE,
|
||||
# 'end_date': None,
|
||||
# 'sheet_count': sheet_count,
|
||||
# 'rate': get_new_rate(sheet_count, post_class),
|
||||
# 'crown': crown,
|
||||
# 'post_class': post_class,
|
||||
# }
|
||||
# for sheet_count, crown, post_class in itertools.product(
|
||||
# range(1, 6),
|
||||
# [True, False],
|
||||
# ['first', 'second', 'europe', 'rest-of-world']
|
||||
# )
|
||||
# ])
|
||||
|
||||
|
||||
def downgrade():
|
||||
|
||||
Reference in New Issue
Block a user