old_contents: """adding_origin_set_member
  
  Revision ID: 8ce9eccbe313
  Revises: 978d12edb6c5, afb0333cb471
  Create Date: 2022-01-19 09:49:43.148943
  
  """
  from alembic import op
  import sqlalchemy as sa
  import rdr_service.model.utils
  
  
  from rdr_service.participant_enums import PhysicalMeasurementsStatus, QuestionnaireStatus, OrderStatus
  from rdr_service.participant_enums import WithdrawalStatus, WithdrawalReason, SuspensionStatus, QuestionnaireDefinitionStatus
  from rdr_service.participant_enums import EnrollmentStatus, Race, SampleStatus, OrganizationType, BiobankOrderStatus
  from rdr_service.participant_enums import OrderShipmentTrackingStatus, OrderShipmentStatus
  from rdr_service.participant_enums import MetricSetType, MetricsKey, GenderIdentity
  from rdr_service.model.base import add_table_history_table, drop_table_history_table
  from rdr_service.model.code import CodeType
  from rdr_service.model.site_enums import SiteStatus, EnrollingStatus, DigitalSchedulingStatus, ObsoleteStatus
  
  # revision identifiers, used by Alembic.
  revision = '8ce9eccbe313'
  down_revision = ('978d12edb6c5', 'afb0333cb471')
  branch_labels = None
  depends_on = None
  
  
  def upgrade(engine_name):
      globals()["upgrade_%s" % engine_name]()
  
  
  def downgrade(engine_name):
      globals()["downgrade_%s" % engine_name]()
  
  
  
  def upgrade_rdr():
      # ### commands auto generated by Alembic - please adjust! ###
      op.add_column('genomic_set_member', sa.Column('participant_origin', sa.String(length=80), nullable=True))
      
      op.execute(
          "Update genomic_set_member"
          "Inner Join participant_summary"
          "On participant_summary.participant_id = genomic_set_member.participant_id"
          "Set genomic_set_member.participant_origin = participant_summary.participant_origin"
          "Where true"
          "And genomic_set_member.participant_origin is null"
          "And participant_summary.participant_origin is not null"
      )
      # ### end Alembic commands ###
  
  
  def downgrade_rdr():
      # ### commands auto generated by Alembic - please adjust! ###
      op.drop_column('genomic_set_member', 'participant_origin')
      # ### end Alembic commands ###
  
  
  def upgrade_metrics():
      # ### commands auto generated by Alembic - please adjust! ###
      pass
      # ### end Alembic commands ###
  
  
  def downgrade_metrics():
      # ### commands auto generated by Alembic - please adjust! ###
      pass
      # ### end Alembic commands ###
  
  
new_contents: """adding_origin_set_member
  
  Revision ID: 8ce9eccbe313
  Revises: 978d12edb6c5, afb0333cb471
  Create Date: 2022-01-19 09:49:43.148943
  
  """
  from alembic import op
  import sqlalchemy as sa
  import rdr_service.model.utils
  
  
  from rdr_service.participant_enums import PhysicalMeasurementsStatus, QuestionnaireStatus, OrderStatus
  from rdr_service.participant_enums import WithdrawalStatus, WithdrawalReason, SuspensionStatus, QuestionnaireDefinitionStatus
  from rdr_service.participant_enums import EnrollmentStatus, Race, SampleStatus, OrganizationType, BiobankOrderStatus
  from rdr_service.participant_enums import OrderShipmentTrackingStatus, OrderShipmentStatus
  from rdr_service.participant_enums import MetricSetType, MetricsKey, GenderIdentity
  from rdr_service.model.base import add_table_history_table, drop_table_history_table
  from rdr_service.model.code import CodeType
  from rdr_service.model.site_enums import SiteStatus, EnrollingStatus, DigitalSchedulingStatus, ObsoleteStatus
  
  # revision identifiers, used by Alembic.
  revision = '8ce9eccbe313'
  down_revision = ('978d12edb6c5', 'afb0333cb471')
  branch_labels = None
  depends_on = None
  
  
  def upgrade(engine_name):
      globals()["upgrade_%s" % engine_name]()
  
  
  def downgrade(engine_name):
      globals()["downgrade_%s" % engine_name]()
  
  
  def upgrade_rdr():
      # ### commands auto generated by Alembic - please adjust! ###
      op.add_column('genomic_set_member', sa.Column('participant_origin', sa.String(length=80), nullable=True))
  
      op.execute(
          """Update genomic_set_member
          Inner Join participant_summary
          On participant_summary.participant_id = genomic_set_member.participant_id
          Set genomic_set_member.participant_origin = participant_summary.participant_origin
          Where true
          And genomic_set_member.participant_origin is null
          And participant_summary.participant_origin is not null"""
      )
      # ### end Alembic commands ###
  
  
  def downgrade_rdr():
      # ### commands auto generated by Alembic - please adjust! ###
      op.drop_column('genomic_set_member', 'participant_origin')
      # ### end Alembic commands ###
  
  
  def upgrade_metrics():
      # ### commands auto generated by Alembic - please adjust! ###
      pass
      # ### end Alembic commands ###
  
  
  def downgrade_metrics():
      # ### commands auto generated by Alembic - please adjust! ###
      pass
      # ### end Alembic commands ###
  
  
subject: add multiline to migration (#2815)