Skip to content

Commit

Permalink
Merge pull request #9506 from transcom/MB-14374
Browse files Browse the repository at this point in the history
MB-14374 Remove value from ppm_shipment_status enum (NEEDS_CLOSE_OUT)
  • Loading branch information
Ryan-Koch authored Nov 3, 2022
2 parents fa126fe + 6ff68c9 commit bf3f576
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
1 change: 1 addition & 0 deletions migrations/app/migrations_manifest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -766,3 +766,4 @@
20221020202612_create-and-modify-move-history-triggers-for-multiple-tables.up.sql
20221021145115_ppm_closeout_status.up.sql
20221028220508_remove_deleted_at_column_from_evaluation_reports.up.sql
20221031150502_ppm_closeout_status_remove_needs_close_out.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
--- rename existing enum
ALTER TYPE ppm_shipment_status RENAME TO ppm_shipment_status_temp;

-- create a new enum without the value we're looking to remove (NEEDS_CLOSE_OUT)
CREATE TYPE ppm_shipment_status AS ENUM('DRAFT', 'SUBMITTED', 'WAITING_ON_CUSTOMER', 'NEEDS_ADVANCE_APPROVAL', 'NEEDS_PAYMENT_APPROVAL', 'PAYMENT_APPROVED');

-- Remove references to the old value from the ppm_shipments table (there probably aren't any, but this is for safety)
UPDATE ppm_shipments set status = 'NEEDS_PAYMENT_APPROVAL' WHERE status = 'NEEDS_CLOSE_OUT';

-- alter the ppm shipments status column to use the new enum
ALTER TABLE ppm_shipments ALTER COLUMN status TYPE ppm_shipment_status USING status::text::ppm_shipment_status;

-- get rid of the temp type
DROP TYPE ppm_shipment_status_temp

2 changes: 0 additions & 2 deletions pkg/models/ppm_shipment.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ const (
PPMShipmentStatusNeedsPaymentApproval PPMShipmentStatus = "NEEDS_PAYMENT_APPROVAL"
// PPMShipmentStatusPaymentApproved captures enum value "PAYMENT_APPROVED"
PPMShipmentStatusPaymentApproved PPMShipmentStatus = "PAYMENT_APPROVED"
// PPMShipmentStatusNeedsCloseOut captures enum value "NEEDS_CLOSE_OUT"
PPMShipmentStatusNeedsCloseOut PPMShipmentStatus = "NEEDS_CLOSE_OUT"
)

// PPMAdvanceStatus represents the status of an advance that can be approved, edited or rejected by a SC
Expand Down
1 change: 0 additions & 1 deletion pkg/services/mto_shipment/validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,6 @@ func (suite *MTOShipmentServiceSuite) TestDeleteValidations() {
models.PPMShipmentStatusNeedsAdvanceApproval: true,
models.PPMShipmentStatusNeedsPaymentApproval: true,
models.PPMShipmentStatusPaymentApproved: true,
models.PPMShipmentStatusNeedsCloseOut: true,
}

for status, allowed := range testCases {
Expand Down

0 comments on commit bf3f576

Please sign in to comment.