diff --git a/portal/migrations/versions/038a1a5f4218_.py b/portal/migrations/versions/038a1a5f4218_.py index 3398d2a32..7602e52cb 100644 --- a/portal/migrations/versions/038a1a5f4218_.py +++ b/portal/migrations/versions/038a1a5f4218_.py @@ -21,7 +21,7 @@ def upgrade(): sa.Column('first_name', sa.String(length=64), nullable=True), sa.Column('last_name', sa.String(length=64), nullable=True), sa.Column('birthdate', sa.Date(), nullable=True), - sa.Column('email', sa.String(length=120), nullable=False), + sa.Column('email', sa.String(length=120), nullable=True), sa.Column('questionnaire_status', sa.Text(), nullable=True), sa.Column('visit', sa.Text(), nullable=True), sa.Column('study_id', sa.Text(), nullable=True), @@ -35,7 +35,7 @@ def upgrade(): ) op.create_index(op.f('ix_patient_list_birthdate'), 'patient_list', ['birthdate'], unique=False) op.create_index(op.f('ix_patient_list_consent_date'), 'patient_list', ['consent_date'], unique=False) - op.create_index(op.f('ix_patient_list_email'), 'patient_list', ['email'], unique=True) + op.create_index(op.f('ix_patient_list_email'), 'patient_list', ['email'], unique=False) op.create_index(op.f('ix_patient_list_first_name'), 'patient_list', ['first_name'], unique=False) op.create_index(op.f('ix_patient_list_last_name'), 'patient_list', ['last_name'], unique=False) op.create_index(op.f('ix_patient_list_questionnaire_status'), 'patient_list', ['questionnaire_status'], unique=False) diff --git a/portal/models/patient_list.py b/portal/models/patient_list.py index 61bfcfc39..b210b20a0 100644 --- a/portal/models/patient_list.py +++ b/portal/models/patient_list.py @@ -24,14 +24,14 @@ class PatientList(db.Model): first_name = db.Column(db.String(64), index=True) last_name = db.Column(db.String(64), index=True) birthdate = db.Column(db.Date, index=True) - email = db.Column(db.String(120), unique=True, nullable=False, index=True) + email = db.Column(db.String(120), index=True) questionnaire_status = db.Column(db.Text, index=True) visit = db.Column(db.Text, index=True) study_id = db.Column(db.Text, index=True) consent_date = db.Column(db.DateTime, index=True) sites = db.Column(db.Text, index=True) deleted = db.Column(db.Boolean, default=False) - test_role = db.Column(db.Boolean, default=False) + test_role = db.Column(db.Boolean) org_id = db.Column(db.ForeignKey('organizations.id')) # used for access control @@ -50,7 +50,7 @@ def patient_list_update_patient(patient_id): patient.email = user.email patient.birthdate = user.birthdate patient.deleted = user.deleted_id is not None - patient.test_role = user.has_role(ROLE.TEST.value) + patient.test_role = True if user.has_role(ROLE.TEST.value) else False patient.org_id = user.organizations[0].id if user.organizations else None # TODO