"""mmg rates now set to 1.65 pence per sms

Revision ID: 0040_adjust_mmg_provider_rate
Revises: 0039_fix_notifications
Create Date: 2016-07-06 15:19:23.124212

"""

# revision identifiers, used by Alembic.
revision = '0040_adjust_mmg_provider_rate'
down_revision = '0039_fix_notifications'

import uuid
from datetime import datetime

from alembic import op
import sqlalchemy as sa

def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    conn = op.get_bind()
    conn.execute(
        sa.sql.text(("INSERT INTO provider_rates (id, valid_from, rate, provider_id) "
                     "VALUES (:id, :valid_from, :rate, (SELECT id FROM provider_details WHERE identifier = 'mmg'))")),
        id=uuid.uuid4(),
        valid_from=datetime.utcnow(),
        rate=1.65
    )
    ### end Alembic commands ###


def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    conn = op.get_bind()
    conn.execute(("DELETE FROM provider_rates "
                  "WHERE provider_id = (SELECT id FROM provider_details WHERE identifier = 'mmg') "
                  "AND rate = 1.65"))
    ### end Alembic commands ###

"""mmg rates now set to 1.65 pence per sms

Revision ID: 0040_adjust_mmg_provider_rate
Revises: 0039_fix_notifications
Create Date: 2016-07-06 15:19:23.124212

"""

# revision identifiers, used by Alembic.
revision = '0040_adjust_mmg_provider_rate'
down_revision = '0039_fix_notifications'

import uuid
from datetime import datetime

from alembic import op
import sqlalchemy as sa

def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    conn = op.get_bind()
    conn.execute(
        sa.sql.text(("INSERT INTO provider_rates (id, valid_from, rate, provider_id) "
                     "VALUES (:id, :valid_from, :rate, (SELECT id FROM provider_details WHERE identifier = 'mmg'))")),
        id=uuid.uuid4(),
        valid_from=datetime(2016, 7, 1),
        rate=1.65
    )
    ### end Alembic commands ###


def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    conn = op.get_bind()
    conn.execute(("DELETE FROM provider_rates "
                  "WHERE provider_id = (SELECT id FROM provider_details WHERE identifier = 'mmg') "
                  "AND rate = 1.65"))
    ### end Alembic commands ###

Set the start date for the new rate as July 1
Set the start date for the new rate as July 1
