From 1d6cd4cf5aafdc6520c855b53171d66e10cbec9a Mon Sep 17 00:00:00 2001 From: Paul Bugni Date: Wed, 12 Jun 2024 17:10:47 -0700 Subject: [PATCH] added missing `unique=True` detail to `research_data.questionnaire_reponse_id` --- portal/migrations/versions/daee63f50d35_.py | 2 +- portal/models/research_data.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/portal/migrations/versions/daee63f50d35_.py b/portal/migrations/versions/daee63f50d35_.py index e9f1a50d1..9476fab13 100644 --- a/portal/migrations/versions/daee63f50d35_.py +++ b/portal/migrations/versions/daee63f50d35_.py @@ -41,7 +41,7 @@ def upgrade(): op.f('ix_research_data_patient_id'), 'research_data', ['patient_id'], unique=False) op.create_index( op.f('ix_research_data_questionnaire_response_id'), - 'research_data', ['questionnaire_response_id'], unique=False) + 'research_data', ['questionnaire_response_id'], unique=True) op.create_index( op.f('ix_research_data_research_study_id'), 'research_data', ['research_study_id'], unique=False) diff --git a/portal/models/research_data.py b/portal/models/research_data.py index 600c4b67b..439166dc3 100644 --- a/portal/models/research_data.py +++ b/portal/models/research_data.py @@ -30,7 +30,7 @@ class ResearchData(db.Model): id = db.Column(db.Integer, primary_key=True) patient_id = db.Column(db.ForeignKey('users.id'), index=True, nullable=False) questionnaire_response_id = db.Column( - db.ForeignKey('questionnaire_responses.id'), index=True, nullable=False, + db.ForeignKey('questionnaire_responses.id'), index=True, unique=True, nullable=False, doc="source questionnaire response") instrument = db.Column(db.Text, index=True, nullable=False) research_study_id = db.Column(db.Integer, index=True, nullable=False)