41 lines
1.7 KiB
Python
41 lines
1.7 KiB
Python
"""empty message
|
|
|
|
Revision ID: 0f38d7a36f21
|
|
Revises: 476f8a4933ba
|
|
Create Date: 2020-04-21 15:42:46.430272
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '0f38d7a36f21'
|
|
down_revision = '476f8a4933ba'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
def upgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.add_column('study', sa.Column('on_hold', sa.Boolean(), nullable=True))
|
|
op.drop_column('study', 'inactive')
|
|
# ### end Alembic commands ###
|
|
|
|
op.execute('update study set protocol_builder_status = NULL;')
|
|
op.execute('ALTER TYPE protocolbuilderstatus RENAME TO pbs_old;')
|
|
op.execute("CREATE TYPE protocolbuilderstatus AS ENUM('INCOMPLETE', 'ACTIVE', 'HOLD', 'OPEN', 'ABANDONED')")
|
|
op.execute("ALTER TABLE study ALTER COLUMN protocol_builder_status TYPE protocolbuilderstatus USING protocol_builder_status::text::protocolbuilderstatus;")
|
|
op.execute('DROP TYPE pbs_old;')
|
|
|
|
def downgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.add_column('study', sa.Column('inactive', sa.BOOLEAN(), autoincrement=False, nullable=True))
|
|
op.drop_column('study', 'on_hold')
|
|
# ### end Alembic commands ###
|
|
|
|
op.execute('update study set protocol_builder_status = NULL;')
|
|
op.execute('ALTER TYPE protocolbuilderstatus RENAME TO pbs_old;')
|
|
op.execute("CREATE TYPE protocolbuilderstatus AS ENUM('DRAFT', 'IN_PROCESS', 'IN_REVIEW', 'REVIEW_COMPLETE', 'INACTIVE')")
|
|
op.execute("ALTER TABLE study ALTER COLUMN protocol_builder_status TYPE protocolbuilderstatus USING protocol_builder_status::text::protocolbuilderstatus;")
|
|
op.execute('DROP TYPE pbs_old;')
|