From 89d954de96a7648563e724ebc82704ba2eaeac51 Mon Sep 17 00:00:00 2001 From: Michael Wellman Date: Wed, 29 May 2024 07:50:42 -0400 Subject: [PATCH 1/4] Added participant and duplicate mappings fields --- app/models.py | 3 +++ .../versions/0369_vaprofile_cache_fields.py | 26 +++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 migrations/versions/0369_vaprofile_cache_fields.py diff --git a/app/models.py b/app/models.py index 02eeec8137..2c1f06229a 100644 --- a/app/models.py +++ b/app/models.py @@ -2181,6 +2181,9 @@ class VAProfileLocalCache(db.Model): communication_channel_id = db.Column(db.Integer, nullable=False) source_datetime = db.Column(db.DateTime, nullable=False) + participant_id = db.Column(db.Integer, nullable=True) + has_duplicate_mappings = db.Column(db.Boolean, nullable=True, default=False) + __table_args__ = ( UniqueConstraint('va_profile_id', 'communication_item_id', 'communication_channel_id', name='uix_veteran_id'), ) diff --git a/migrations/versions/0369_vaprofile_cache_fields.py b/migrations/versions/0369_vaprofile_cache_fields.py new file mode 100644 index 0000000000..aefe3418e7 --- /dev/null +++ b/migrations/versions/0369_vaprofile_cache_fields.py @@ -0,0 +1,26 @@ +""" + +Revision ID: 22f76fe95798 +Revises: 0368_servicesmssender_columns +Create Date: 2024-05-29 10:55:37.065247 + +""" +from alembic import op +import sqlalchemy as sa + +revision = '0369_va_profile_local_cache_columns' +down_revision = '0368_servicesmssender_columns' + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.add_column('va_profile_local_cache', sa.Column('participant_id', sa.Integer(), nullable=True)) + op.add_column('va_profile_local_cache', sa.Column('has_duplicate_mappings', sa.Boolean(), nullable=False)) + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.drop_column('va_profile_local_cache', 'has_duplicate_mappings') + op.drop_column('va_profile_local_cache', 'participant_id') + # ### end Alembic commands ### From cf440046681d83b91be579b9d8221076a96a32bb Mon Sep 17 00:00:00 2001 From: Michael Wellman Date: Wed, 29 May 2024 07:51:44 -0400 Subject: [PATCH 2/4] Added migration --- migrations/versions/0369_vaprofile_cache_fields.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/migrations/versions/0369_vaprofile_cache_fields.py b/migrations/versions/0369_vaprofile_cache_fields.py index aefe3418e7..f6f14271fa 100644 --- a/migrations/versions/0369_vaprofile_cache_fields.py +++ b/migrations/versions/0369_vaprofile_cache_fields.py @@ -1,21 +1,21 @@ """ -Revision ID: 22f76fe95798 +Revision ID:0369_vaprofile_cache_fields Revises: 0368_servicesmssender_columns -Create Date: 2024-05-29 10:55:37.065247 +Create Date: 2024-05-29 10:55:37 """ from alembic import op import sqlalchemy as sa -revision = '0369_va_profile_local_cache_columns' +revision = '0369_va_profile_cache_fields' down_revision = '0368_servicesmssender_columns' def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('va_profile_local_cache', sa.Column('participant_id', sa.Integer(), nullable=True)) - op.add_column('va_profile_local_cache', sa.Column('has_duplicate_mappings', sa.Boolean(), nullable=False)) + op.add_column('va_profile_local_cache', sa.Column('has_duplicate_mappings', sa.Boolean(), nullable=False, server_default=sa.text('false'))) # ### end Alembic commands ### From 9acdcee09de21c464c0be4b893bd922af97d0760 Mon Sep 17 00:00:00 2001 From: Michael Wellman Date: Wed, 29 May 2024 08:02:39 -0400 Subject: [PATCH 3/4] Fixed default value --- migrations/versions/0369_vaprofile_cache_fields.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migrations/versions/0369_vaprofile_cache_fields.py b/migrations/versions/0369_vaprofile_cache_fields.py index f6f14271fa..44a0c8ae63 100644 --- a/migrations/versions/0369_vaprofile_cache_fields.py +++ b/migrations/versions/0369_vaprofile_cache_fields.py @@ -15,7 +15,7 @@ def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('va_profile_local_cache', sa.Column('participant_id', sa.Integer(), nullable=True)) - op.add_column('va_profile_local_cache', sa.Column('has_duplicate_mappings', sa.Boolean(), nullable=False, server_default=sa.text('false'))) + op.add_column('va_profile_local_cache', sa.Column('has_duplicate_mappings', sa.Boolean(), nullable=False, server_default=sa.false())) # ### end Alembic commands ### From 34356beeeec450448459aefd0c21a09241d6b921 Mon Sep 17 00:00:00 2001 From: Michael Wellman Date: Wed, 29 May 2024 09:18:45 -0400 Subject: [PATCH 4/4] has_duplicate_mappings is now not nullable and defaults to false --- app/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models.py b/app/models.py index 2c1f06229a..e5696b6fbd 100644 --- a/app/models.py +++ b/app/models.py @@ -2182,7 +2182,7 @@ class VAProfileLocalCache(db.Model): source_datetime = db.Column(db.DateTime, nullable=False) participant_id = db.Column(db.Integer, nullable=True) - has_duplicate_mappings = db.Column(db.Boolean, nullable=True, default=False) + has_duplicate_mappings = db.Column(db.Boolean, nullable=False, default=False) __table_args__ = ( UniqueConstraint('va_profile_id', 'communication_item_id', 'communication_channel_id', name='uix_veteran_id'),