<reponame>all-of-us/raw-data-repository
"""Update Resource Indexes

Revision ID: c57da0c2679e
Revises: <KEY>
Create Date: 2020-11-17 08:55:28.485670

"""
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 = 'c57da0c2679e'
down_revision = '<KEY>'
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.create_index('ix_res_data_type_modified_hpo_id', 'resource_data', ['resource_type_id', 'modified', 'hpo_id'], unique=False)
    op.create_index('ix_res_data_type_pk_id', 'resource_data', ['resource_type_id', 'resource_pk_id'], unique=False)
    op.create_index('ix_res_data_type_pkalt_id', 'resource_data', ['resource_type_id', 'resource_pk_alt_id'], unique=False)
    # ### end Alembic commands ###


def downgrade_rdr():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index('ix_res_data_type_pkalt_id', table_name='resource_data')
    op.drop_index('ix_res_data_type_pk_id', table_name='resource_data')
    op.drop_index('ix_res_data_type_modified_hpo_id', table_name='resource_data')
    # ### 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 ###


"""Update Resource Indexes

Revision ID: c57da0c2679e
Revises: <KEY>
Create Date: 2020-11-17 08:55:28.485670

"""
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 = 'c57da0c2679e'
down_revision = '<KEY>'
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.create_index('ix_res_data_type_modified_hpo_id', 'resource_data', ['resource_type_id', 'modified', 'hpo_id'], unique=False)
    op.create_index('ix_res_data_type_pk_id', 'resource_data', ['resource_type_id', 'resource_pk_id'], unique=False)
    op.create_index('ix_res_data_type_pkalt_id', 'resource_data', ['resource_type_id', 'resource_pk_alt_id'], unique=False)
    # ### end Alembic commands ###


def downgrade_rdr():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index('ix_res_data_type_pkalt_id', table_name='resource_data')
    op.drop_index('ix_res_data_type_pk_id', table_name='resource_data')
    op.drop_index('ix_res_data_type_modified_hpo_id', table_name='resource_data')
    # ### 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 ###
Update Resource Indexes  Revision ID: c57da0c2679e Revises: <KEY> Create Date: 2020-11-17 08:55:28.485670 # revision identifiers, used by Alembic. # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ### # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ### # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ### # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ###