Skip to content

Commit

Permalink
oppdateringsdato defaulter til nå
Browse files Browse the repository at this point in the history
Co-authored-by: Ingrid Fosså <ingrid.fossa@nav.no>
Co-authored-by: Christian Klem <christian.klem@nav.no>
Co-authored-by: Thomas Dufourd <thomas.dufourd@nav.no>
  • Loading branch information
4 people committed Aug 21, 2023
1 parent 71164e7 commit 34a5396
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
alter table virksomhet_naringsundergrupper
alter column oppdateringsdato set default current_timestamp;

update virksomhet_naringsundergrupper
set oppdateringsdato = opprettet where oppdateringsdato is null;
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import io.kotest.matchers.comparables.shouldBeEqualComparingTo
import io.kotest.matchers.comparables.shouldBeGreaterThan
import io.kotest.matchers.comparables.shouldBeLessThan
import io.kotest.matchers.shouldBe
import io.kotest.matchers.shouldNotBe
import io.ktor.http.HttpStatusCode
import kotlinx.datetime.Clock
import no.nav.lydia.helper.PiaBrregOppdateringTestData.Companion.endredeVirksomheter
Expand All @@ -23,6 +24,7 @@ import no.nav.lydia.integrasjoner.brreg.Beliggenhetsadresse
import no.nav.lydia.virksomhet.api.VirksomhetDto
import no.nav.lydia.virksomhet.domene.Næringsgruppe
import no.nav.lydia.virksomhet.domene.VirksomhetStatus
import java.sql.Timestamp
import kotlin.test.Test

/**
Expand Down Expand Up @@ -78,6 +80,13 @@ class VirksomhetOppdateringTest {
)

næringskode2 shouldBe "01.190"

val oppdateringsdato = TestContainerHelper.postgresContainer.hentEnkelKolonne<Timestamp>(
"""select oppdateringsdato from virksomhet_naringsundergrupper
where virksomhet = $virksomhetId
""".trimIndent()
)
oppdateringsdato shouldNotBe null
}

@Test
Expand Down

0 comments on commit 34a5396

Please sign in to comment.