-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9506 from transcom/MB-14374
MB-14374 Remove value from ppm_shipment_status enum (NEEDS_CLOSE_OUT)
- Loading branch information
Showing
4 changed files
with
16 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
migrations/app/schema/20221031150502_ppm_closeout_status_remove_needs_close_out.up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters