Files
notifications-api/migrations/versions/0074_update_sms_rate.py
Rebecca Law 43226dc932 Added a new rates table.
We only need one rate per channel. This reflects that. The provider_rates has been left for now, it is still not being used.
New dao has been added to select the right rate for the given notification_type and date of notificaiton.
2017-04-24 16:20:03 +01:00

28 lines
743 B
Python

"""empty message
Revision ID: 0074_update_sms_rate
Revises: 0072_add_dvla_orgs
Create Date: 2017-04-24 12:10:02.116278
"""
import uuid
revision = '0074_update_sms_rate'
down_revision = '0072_add_dvla_orgs'
from alembic import op
def upgrade():
op.get_bind()
op.execute("INSERT INTO provider_rates (id, valid_from, rate, provider_id) "
"VALUES ('{}', '2017-04-01 00:00:00', 1.58, "
"(SELECT id FROM provider_details WHERE identifier = 'mmg'))".format(uuid.uuid4())
)
def downgrade():
op.get_bind()
op.execute("DELETE FROM provider_rates where valid_from = '2017-04-01 00:00:00' "
"and provider_id = (SELECT id FROM provider_details WHERE identifier = 'mmg')")