diff --git a/spesialist-felles/src/main/resources/db/migration/V511__fjerner_pa_vent_frist.sql b/spesialist-felles/src/main/resources/db/migration/V511__fjerner_pa_vent_frist.sql new file mode 100644 index 000000000..8ce2db522 --- /dev/null +++ b/spesialist-felles/src/main/resources/db/migration/V511__fjerner_pa_vent_frist.sql @@ -0,0 +1 @@ +DROP TABLE pa_vent_frist \ No newline at end of file diff --git a/spesialist-opprydding-dev/src/main/kotlin/no/nav/helse/opprydding/PersonRepository.kt b/spesialist-opprydding-dev/src/main/kotlin/no/nav/helse/opprydding/PersonRepository.kt index 7d3371fe4..2feffb981 100644 --- a/spesialist-opprydding-dev/src/main/kotlin/no/nav/helse/opprydding/PersonRepository.kt +++ b/spesialist-opprydding-dev/src/main/kotlin/no/nav/helse/opprydding/PersonRepository.kt @@ -260,10 +260,8 @@ internal class PersonRepository(private val dataSource: DataSource) { private fun TransactionalSession.slettPÄVent(personRef: Int) { @Language("PostgreSQL") - val query = "DELETE FROM pa_vent_frist pvf USING pa_vent pv, vedtak v WHERE pvf.pa_vent_ref = pv.id AND pv.vedtaksperiode_id = v.vedtaksperiode_id AND v.person_ref = ? RETURNING pvf.pa_vent_ref" - val query2 = "DELETE FROM pa_vent pv USING vedtak v WHERE pv.vedtaksperiode_id = v.vedtaksperiode_id AND v.person_ref = ?" + val query = "DELETE FROM pa_vent pv USING vedtak v WHERE pv.vedtaksperiode_id = v.vedtaksperiode_id AND v.person_ref = ?" run(queryOf(query, personRef).asExecute) - run(queryOf(query2, personRef).asExecute) } private fun TransactionalSession.slettVedtaksperiodegenerasjoner(personRef: Int) { diff --git a/spesialist-opprydding-dev/src/test/kotlin/no/nav/helse/opprydding/PersonRepositoryTest.kt b/spesialist-opprydding-dev/src/test/kotlin/no/nav/helse/opprydding/PersonRepositoryTest.kt index 0ae0120ae..5d3e49ce2 100644 --- a/spesialist-opprydding-dev/src/test/kotlin/no/nav/helse/opprydding/PersonRepositoryTest.kt +++ b/spesialist-opprydding-dev/src/test/kotlin/no/nav/helse/opprydding/PersonRepositoryTest.kt @@ -18,6 +18,6 @@ internal class PersonRepositoryTest : AbstractDatabaseTest() { @Test fun `antall tabeller - du mÄ antakelig rette opp i sletting i dev dersom du har lagt til eller fjernet tabeller`() { - assertEquals(77, finnTabeller().size) + assertEquals(76, finnTabeller().size) } } diff --git a/spesialist-opprydding-dev/src/test/resources/db/testperson/R__testperson.sql b/spesialist-opprydding-dev/src/test/resources/db/testperson/R__testperson.sql index b803192ca..e1965b257 100644 --- a/spesialist-opprydding-dev/src/test/resources/db/testperson/R__testperson.sql +++ b/spesialist-opprydding-dev/src/test/resources/db/testperson/R__testperson.sql @@ -66,6 +66,9 @@ VALUES ('${saksbehandler_oid}', ${sequence_number}); INSERT INTO reserver_person(saksbehandler_ref, person_ref, gyldig_til) VALUES ('${saksbehandler_oid}', ${sequence_number}, now()); +INSERT INTO pa_vent(id, vedtaksperiode_id, saksbehandler_ref, frist, begrunnelse, opprettet) +VALUES (${sequence_number}, '${vedtaksperiode_id}', '${saksbehandler_oid}', now(), '', now()); + INSERT INTO opptegnelse(person_id, sekvensnummer, payload, type) VALUES (${sequence_number}, 1, '{}'::json, 'TESTTYPE'); INSERT INTO abonnement_for_opptegnelse(saksbehandler_id, person_id) @@ -80,11 +83,6 @@ VALUES (${sequence_number}, 'TEST_TEXT', now(), '${saksbehandler_oid}', '${vedta INSERT INTO kommentarer(tekst, notat_ref, feilregistrert_tidspunkt, saksbehandlerident) VALUES ('EN_KOMMENTAR', ${sequence_number}, null, '${saksbehandler_oid}'); -INSERT INTO pa_vent(id, vedtaksperiode_id, saksbehandler_ref, frist, begrunnelse, opprettet) -VALUES (${sequence_number}, '${vedtaksperiode_id}', '${saksbehandler_oid}', now(), '', now()); -INSERT INTO pa_vent_frist(id, pa_vent_ref, frist, notat_ref, opprettet) -VALUES (${sequence_number}, ${sequence_number}, now(), ${sequence_number}, now()); - INSERT INTO overstyring(id, tidspunkt, person_ref, hendelse_ref, saksbehandler_ref, vedtaksperiode_id) VALUES (${sequence_number}, now(), ${sequence_number}, '${hendelse_id}', '${saksbehandler_oid}', '${vedtaksperiode_id}');