From 66b28ec8ed970976f2e4e82899549d0d7ab9e08a Mon Sep 17 00:00:00 2001 From: Daniel Jordan Date: Tue, 27 Feb 2024 18:18:13 +0000 Subject: [PATCH 1/3] initial commit, migration file added --- migrations/app/migrations_manifest.txt | 5 +++-- ...nd_rej_reason_to_office_users_table.up.sql | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 migrations/app/schema/20240227180121_add_status_edipi_other_unique_id_and_rej_reason_to_office_users_table.up.sql diff --git a/migrations/app/migrations_manifest.txt b/migrations/app/migrations_manifest.txt index 5b1b0ca7fd9..388efb6d75a 100644 --- a/migrations/app/migrations_manifest.txt +++ b/migrations/app/migrations_manifest.txt @@ -898,7 +898,8 @@ 20240206173201_update_shipment_address_update_table_sit_and_distance_columns.up.sql 20240207173709_updateTransportationOffices.up.sql 20240212150834_20240212_disable_homesafe_stg_cert.up.sql -20240220145356_remove_rank_and_duty_location_columns_from_service_members_table.up.sql -20240215151854_20240215_remove_expired_homesafe_prd_cert.up.sql 20240214213247_updateTransportationOfficesGbloc.up.sql +20240215151854_20240215_remove_expired_homesafe_prd_cert.up.sql +20240220145356_remove_rank_and_duty_location_columns_from_service_members_table.up.sql 20240223200739_updateDutyLocationsZip.up.sql +20240227180121_add_status_edipi_other_unique_id_and_rej_reason_to_office_users_table.up.sql diff --git a/migrations/app/schema/20240227180121_add_status_edipi_other_unique_id_and_rej_reason_to_office_users_table.up.sql b/migrations/app/schema/20240227180121_add_status_edipi_other_unique_id_and_rej_reason_to_office_users_table.up.sql new file mode 100644 index 00000000000..02950df415f --- /dev/null +++ b/migrations/app/schema/20240227180121_add_status_edipi_other_unique_id_and_rej_reason_to_office_users_table.up.sql @@ -0,0 +1,19 @@ +CREATE TYPE office_user_status AS enum ( + 'APPROVED', + 'REQUESTED', + 'REJECTED' +); + +-- Adds new columns to office_users table +-- making status default of APPROVED to ensure past users using MM are already approved +ALTER TABLE office_users +ADD COLUMN status office_user_status DEFAULT 'APPROVED' NULL, +ADD COLUMN edipi TEXT DEFAULT NULL, +ADD COLUMN other_unique_id TEXT DEFAULT NULL, +ADD COLUMN rejection_reason TEXT DEFAULT NULL; + +-- Comments on new columns +COMMENT on COLUMN office_users.status IS 'Status of an office user account'; +COMMENT on COLUMN office_users.edipi IS 'DoD ID or EDIPI of office user'; +COMMENT on COLUMN office_users.other_unique_id IS 'Other unique id for PIV or ECA cert users'; +COMMENT on COLUMN office_users.rejection_reason IS 'Rejection reason when account request is rejected by an admin'; From 374eb79f27dbb49a0faff59f6fbb35ffb0c56b9d Mon Sep 17 00:00:00 2001 From: Daniel Jordan Date: Tue, 27 Feb 2024 20:07:56 +0000 Subject: [PATCH 2/3] updated edipi and unique id columns to be unique --- ...ther_unique_id_and_rej_reason_to_office_users_table.up.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/migrations/app/schema/20240227180121_add_status_edipi_other_unique_id_and_rej_reason_to_office_users_table.up.sql b/migrations/app/schema/20240227180121_add_status_edipi_other_unique_id_and_rej_reason_to_office_users_table.up.sql index 02950df415f..af232339b2f 100644 --- a/migrations/app/schema/20240227180121_add_status_edipi_other_unique_id_and_rej_reason_to_office_users_table.up.sql +++ b/migrations/app/schema/20240227180121_add_status_edipi_other_unique_id_and_rej_reason_to_office_users_table.up.sql @@ -8,8 +8,8 @@ CREATE TYPE office_user_status AS enum ( -- making status default of APPROVED to ensure past users using MM are already approved ALTER TABLE office_users ADD COLUMN status office_user_status DEFAULT 'APPROVED' NULL, -ADD COLUMN edipi TEXT DEFAULT NULL, -ADD COLUMN other_unique_id TEXT DEFAULT NULL, +ADD COLUMN edipi TEXT UNIQUE DEFAULT NULL, +ADD COLUMN other_unique_id TEXT UNIQUE DEFAULT NULL, ADD COLUMN rejection_reason TEXT DEFAULT NULL; -- Comments on new columns From 6a82ed2d38e973ad8bfaa812f54b798fa7c793a9 Mon Sep 17 00:00:00 2001 From: Daniel Jordan Date: Tue, 27 Feb 2024 20:07:56 +0000 Subject: [PATCH 3/3] added IF NOT EXISTS to migration file --- ..._unique_id_and_rej_reason_to_office_users_table.up.sql | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/migrations/app/schema/20240227180121_add_status_edipi_other_unique_id_and_rej_reason_to_office_users_table.up.sql b/migrations/app/schema/20240227180121_add_status_edipi_other_unique_id_and_rej_reason_to_office_users_table.up.sql index af232339b2f..628f26333d1 100644 --- a/migrations/app/schema/20240227180121_add_status_edipi_other_unique_id_and_rej_reason_to_office_users_table.up.sql +++ b/migrations/app/schema/20240227180121_add_status_edipi_other_unique_id_and_rej_reason_to_office_users_table.up.sql @@ -7,10 +7,10 @@ CREATE TYPE office_user_status AS enum ( -- Adds new columns to office_users table -- making status default of APPROVED to ensure past users using MM are already approved ALTER TABLE office_users -ADD COLUMN status office_user_status DEFAULT 'APPROVED' NULL, -ADD COLUMN edipi TEXT UNIQUE DEFAULT NULL, -ADD COLUMN other_unique_id TEXT UNIQUE DEFAULT NULL, -ADD COLUMN rejection_reason TEXT DEFAULT NULL; +ADD COLUMN IF NOT EXISTS status office_user_status DEFAULT 'APPROVED' NULL, +ADD COLUMN IF NOT EXISTS edipi TEXT UNIQUE DEFAULT NULL, +ADD COLUMN IF NOT EXISTS other_unique_id TEXT UNIQUE DEFAULT NULL, +ADD COLUMN IF NOT EXISTS rejection_reason TEXT DEFAULT NULL; -- Comments on new columns COMMENT on COLUMN office_users.status IS 'Status of an office user account';