Skip to content

Commit

Permalink
Merge pull request #645 from navikt/klage-journalpostid-index
Browse files Browse the repository at this point in the history
Fjern unique constraint på journalpost i Klage-tabellen
  • Loading branch information
Aryan Iranzamini authored Jan 18, 2022
2 parents bc5f97b + a238704 commit dcd7e1f
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
alter table klage drop constraint unique_journalpostid;
drop index if exists unique_journalpostid;
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package no.nav.su.se.bakover.database.klage

import arrow.core.right
import io.kotest.assertions.throwables.shouldThrow
import io.kotest.matchers.collections.shouldBeEmpty
import io.kotest.matchers.shouldBe
import io.kotest.matchers.types.shouldBeTypeOf
Expand All @@ -17,26 +16,10 @@ import no.nav.su.se.bakover.domain.oppgave.OppgaveId
import no.nav.su.se.bakover.test.fixedTidspunkt
import no.nav.su.se.bakover.test.getOrFail
import org.junit.jupiter.api.Test
import org.postgresql.util.PSQLException
import java.util.UUID

internal class KlagePostgresRepoTest {

@Test
fun `kan ikke opprette klage på journalpost som allerede har en klage`() {
withMigratedDb { dataSource ->
val testDataHelper = TestDataHelper(dataSource)
val klageRepo = testDataHelper.klagePostgresRepo

val klage = testDataHelper.nyKlage()
val klageMedEksisterendeJournalpostId = klage.copy(id = UUID.randomUUID())

shouldThrow<PSQLException> {
klageRepo.lagre(klageMedEksisterendeJournalpostId)
}
}
}

@Test
fun `kan opprette og hente klager`() {
withMigratedDb { dataSource ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,3 @@ interface KlageRepo {
fun defaultSessionContext(): SessionContext
fun defaultTransactionContext(): TransactionContext
}

object KlageHarAlleredeBehandling

0 comments on commit dcd7e1f

Please sign in to comment.