Skip to content

Commit

Permalink
Merge pull request #79 from navikt/feature/sivilstandType-enum
Browse files Browse the repository at this point in the history
Edit sivilstandtype enum
  • Loading branch information
Drax74 authored Nov 8, 2023
2 parents d624120 + 91719e4 commit b8addca
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,6 @@ import io.swagger.v3.oas.annotations.media.Schema
// TODO Bruk Sivilstandstype fra bidrag-domain istedenfor
@Schema(enumAsRef = true)
enum class SivilstandType {
ENKE_ELLER_ENKEMANN,
BOR_ALENE_MED_BARN,
GIFT,
GJENLEVENDE_PARTNER,
REGISTRERT_PARTNER,
SEPARERT,
SEPARERT_PARTNER,
SKILT,
SKILT_PARTNER,
UGIFT,
UOPPGITT,
}
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;
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class BehandlingServiceTest : TestContainerRunner() {
null,
Calendar.getInstance().time.toLocalDate(),
Calendar.getInstance().time.toLocalDate(),
SivilstandType.ENKE_ELLER_ENKEMANN,
SivilstandType.BOR_ALENE_MED_BARN,
),
)

Expand Down

0 comments on commit b8addca

Please sign in to comment.