diff --git a/migrations/versions/6c34576847ab_.py b/migrations/versions/6c34576847ab_.py new file mode 100644 index 0000000..ebd1baf --- /dev/null +++ b/migrations/versions/6c34576847ab_.py @@ -0,0 +1,28 @@ +"""empty message + +Revision ID: 6c34576847ab +Revises: c14ddab2e6ca +Create Date: 2021-05-11 11:10:14.725089 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '6c34576847ab' +down_revision = 'c14ddab2e6ca' +branch_labels = None +depends_on = None + + +def upgrade(): + op.create_table('selected_user', + sa.Column('user_id', sa.String(), nullable=False), + sa.Column('selected_user', sa.String(), nullable=True), + sa.PrimaryKeyConstraint('user_id') + ) + + +def downgrade(): + op.drop_table('selected_user') diff --git a/pb/models.py b/pb/models.py index 5347bb1..b6fffb8 100644 --- a/pb/models.py +++ b/pb/models.py @@ -281,9 +281,19 @@ class StudyDetails(db.Model): REVIEWTYPENAME = db.Column(db.String, nullable=True) - class StudyDetailsSchema(ma.SQLAlchemyAutoSchema): class Meta: model = StudyDetails load_instance = True include_relationships = False + + +class SelectedUser(db.Model): + user_id = db.Column(db.String(), primary_key=True) + selected_user = db.Column(db.String(), nullable=True) + + +class SelectedUserSchema(ma.Schema): + class Meta: + fields = ("user_id", "selected_user") +