-
Notifications
You must be signed in to change notification settings - Fork 0
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 #79 from navikt/feature/sivilstandType-enum
Edit sivilstandtype enum
- Loading branch information
Showing
3 changed files
with
19 additions
and
10 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
17 changes: 17 additions & 0 deletions
17
src/main/resources/db/migration/V1.0.30__edit_sivilstandType_enum.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,17 @@ | ||
alter type SIVILSTAND_TYPE rename to SIVILSTAND_TYPE_OLD; | ||
|
||
CREATE TYPE SIVILSTAND_TYPE AS ENUM | ||
( | ||
'BOR_ALENE_MED_BARN', | ||
'GIFT' | ||
); | ||
|
||
CREATE CAST (VARCHAR AS SIVILSTAND_TYPE) WITH INOUT AS IMPLICIT; | ||
alter table SIVILSTAND rename column SIVILSTAND_TYPE to SIVILSTAND_TYPE_OLD; | ||
|
||
ALTER TABLE SIVILSTAND | ||
ADD COLUMN SIVILSTAND_TYPE SIVILSTAND_TYPE DEFAULT 'BOR_ALENE_MED_BARN' not null ; | ||
update SIVILSTAND set SIVILSTAND_TYPE = 'BOR_ALENE_MED_BARN' where SIVILSTAND_TYPE_OLD != 'GIFT'; | ||
|
||
ALTER TABLE SIVILSTAND DROP COLUMN IF EXISTS SIVILSTAND_TYPE_OLD cascade; | ||
drop type SIVILSTAND_TYPE_OLD cascade; |
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