
# 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 ###


# 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

  
  # 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(),
+         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
## Code Before:

# 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 ###

## Instruction:
Set the start date for the new rate as July 1
## Code After:

# 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 ###
