fix migration after test on real data

This commit is contained in:
Julien Fastré 2023-04-28 15:55:41 +02:00
parent ab5ad7ae14
commit 3e3f20993d
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB

View File

@ -144,8 +144,9 @@ final class Version20230427102309 extends AbstractMigration
$this->addSql(<<<'SQL'
INSERT INTO chill_person_accompanying_period_step_history (id, period_id, enddate, startdate, step, createdat, updatedat)
SELECT nextval('chill_person_accompanying_period_step_history_id_seq'), accompanyingperiod_id, NULL, last_date + '2 years'::interval, 'CONFIRMED_INACTIVE_LONG', NOW(), NOW()
FROM inactive_long;
SELECT nextval('chill_person_accompanying_period_step_history_id_seq'), period_id, NULL, sq.g, 'CONFIRMED_INACTIVE_LONG', NOW(), NOW()
FROM (SELECT GREATEST(MAX(startdate), MAX(enddate)) AS g, period_id FROM chill_person_accompanying_period_step_history GROUP BY period_id) AS sq
JOIN inactive_long ON sq.period_id = inactive_long.accompanyingperiod_id
SQL);
$this->addSql(<<<'SQL'
@ -173,8 +174,9 @@ final class Version20230427102309 extends AbstractMigration
$this->addSql(<<<'SQL'
INSERT INTO chill_person_accompanying_period_step_history (id, period_id, enddate, startdate, step, createdat, updatedat)
SELECT nextval('chill_person_accompanying_period_step_history_id_seq'), accompanyingperiod_id, NULL, last_date + '6 months'::interval, 'CONFIRMED_INACTIVE_SHORT', NOW(), NOW()
FROM inactive_long;
SELECT nextval('chill_person_accompanying_period_step_history_id_seq'), period_id, NULL, sq.g, 'CONFIRMED_INACTIVE_SHORT', NOW(), NOW()
FROM (SELECT GREATEST(MAX(startdate), MAX(enddate)) AS g, period_id FROM chill_person_accompanying_period_step_history GROUP BY period_id) AS sq
JOIN inactive_long ON sq.period_id = inactive_long.accompanyingperiod_id
SQL);
$this->addSql(<<<'SQL'