old_contents: """added current medications table
  
  Revision ID: a5b4d47313ee
  Revises: d7a47953addd
  Create Date: 2018-04-03 10:59:32.986742
  
  """
  from alembic import op
  import sqlalchemy as sa
  from sqlalchemy.dialects import postgresql
  
  # revision identifiers, used by Alembic.
  revision = 'a5b4d47313ee'
  down_revision = 'd7a47953addd'
  branch_labels = None
  depends_on = None
  
  
  def upgrade():
      # ### commands auto generated by Alembic - please adjust! ###
      op.create_table('current_medications',
      sa.Column('id', postgresql.UUID(), server_default=sa.text('uuid_generate_v4()'), nullable=False),
      sa.Column('patient_id', sa.Integer(), nullable=False),
      sa.Column('source_group_id', sa.Integer(), nullable=False),
      sa.Column('source_type', sa.String(), nullable=False),
      sa.Column('date_recorded', sa.Date(), nullable=False),
      sa.Column('drug_id', sa.Integer(), nullable=True),
      sa.Column('dose_quantity', sa.Numeric(), nullable=True),
      sa.Column('dose_unit', sa.String(), nullable=True),
      sa.Column('frequency', sa.String(), nullable=True),
      sa.Column('route', sa.String(), nullable=True),
      sa.Column('drug_text', sa.String(), nullable=True),
      sa.Column('dose_text', sa.String(), nullable=True),
      sa.Column('created_user_id', sa.Integer(), nullable=False),
      sa.Column('created_date', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False),
      sa.Column('modified_user_id', sa.Integer(), nullable=False),
      sa.Column('modified_date', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False),
      sa.ForeignKeyConstraint(['created_user_id'], ['users.id'], ),
      sa.ForeignKeyConstraint(['drug_id'], ['drugs.id'], ),
      sa.ForeignKeyConstraint(['modified_user_id'], ['users.id'], ),
      sa.ForeignKeyConstraint(['patient_id'], ['patients.id'], onupdate='CASCADE', ondelete='CASCADE'),
      sa.ForeignKeyConstraint(['source_group_id'], ['groups.id'], ),
      sa.PrimaryKeyConstraint('id')
      )
      op.drop_column('patient_diagnoses', 'primary')
      # ### end Alembic commands ###
  
  
  def downgrade():
      # ### commands auto generated by Alembic - please adjust! ###
      op.drop_table('current_medications')
      # ### end Alembic commands ###
  
new_contents: """added current medications table
  
  Revision ID: a5b4d47313ee
  Revises: d7a47953addd
  Create Date: 2018-04-03 10:59:32.986742
  
  """
  from alembic import op
  import sqlalchemy as sa
  from sqlalchemy.dialects import postgresql
  
  # revision identifiers, used by Alembic.
  revision = 'a5b4d47313ee'
  down_revision = 'd7a47953addd'
  branch_labels = None
  depends_on = None
  
  
  def upgrade():
      # ### commands auto generated by Alembic - please adjust! ###
      op.create_table('current_medications',
      sa.Column('id', postgresql.UUID(), server_default=sa.text('uuid_generate_v4()'), nullable=False),
      sa.Column('patient_id', sa.Integer(), nullable=False),
      sa.Column('source_group_id', sa.Integer(), nullable=False),
      sa.Column('source_type', sa.String(), nullable=False),
      sa.Column('date_recorded', sa.Date(), nullable=False),
      sa.Column('drug_id', sa.Integer(), nullable=True),
      sa.Column('dose_quantity', sa.Numeric(), nullable=True),
      sa.Column('dose_unit', sa.String(), nullable=True),
      sa.Column('frequency', sa.String(), nullable=True),
      sa.Column('route', sa.String(), nullable=True),
      sa.Column('drug_text', sa.String(), nullable=True),
      sa.Column('dose_text', sa.String(), nullable=True),
      sa.Column('created_user_id', sa.Integer(), nullable=False),
      sa.Column('created_date', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False),
      sa.Column('modified_user_id', sa.Integer(), nullable=False),
      sa.Column('modified_date', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False),
      sa.ForeignKeyConstraint(['created_user_id'], ['users.id'], ),
      sa.ForeignKeyConstraint(['drug_id'], ['drugs.id'], ),
      sa.ForeignKeyConstraint(['modified_user_id'], ['users.id'], ),
      sa.ForeignKeyConstraint(['patient_id'], ['patients.id'], onupdate='CASCADE', ondelete='CASCADE'),
      sa.ForeignKeyConstraint(['source_group_id'], ['groups.id'], ),
      sa.PrimaryKeyConstraint('id')
      )
      # ### end Alembic commands ###
  
  
  def downgrade():
      # ### commands auto generated by Alembic - please adjust! ###
      op.drop_table('current_medications')
      # ### end Alembic commands ###
  
subject: remove drop for non existing column in migration