cr-connect-workflow/migrations/versions/69081f1ff387_.py

42 lines
1.3 KiB
Python

"""empty message
Revision ID: 69081f1ff387
Revises: 1c3f88dbccc3
Create Date: 2020-08-12 09:58:36.886096
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '69081f1ff387'
down_revision = '1c3f88dbccc3'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('study_event',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('study_id', sa.Integer(), nullable=False),
sa.Column('create_date', sa.DateTime(timezone=True), nullable=True),
sa.Column('status', sa.Enum('in_progress', 'hold', 'open_for_enrollment', 'abandoned', name='studystatusenum'), nullable=True),
sa.Column('comment', sa.String(), nullable=True),
sa.Column('event_type', sa.Enum('user', 'automatic', name='studyeventtype'), nullable=True),
sa.Column('user_uid', sa.String(), nullable=True),
sa.ForeignKeyConstraint(['study_id'], ['study.id'], ),
sa.ForeignKeyConstraint(['user_uid'], ['user.uid'], ),
sa.PrimaryKeyConstraint('id')
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('study_event')
op.execute('drop type studystatusenum')
op.execute('drop type studyeventtype')
# ### end Alembic commands ###