chill-bundles/.changes/unreleased/Feature-20230627-151615.yaml

29 lines
1.0 KiB
YAML

kind: Feature
body: "Force accompanying period user history to be unique for the same period and
stardate/enddate [:warning: may encounter migration issue]"
time: 2023-06-27T15:16:15.775571488+02:00
custom:
Issue: ""
Long: "If some issue is encountered during migration, use this SQL to find the line which are in conflict, examine the problem and delete some of the concerning line
```sql
-- to see the line which are in conflict with another one
SELECT o.*
FROM chill_person_accompanying_period_user_history o
JOIN chill_person_accompanying_period_user_history c ON o.id < c.id AND o.accompanyingperiod_id = c.accompanyingperiod_id
WHERE tsrange(o.startdate, o.enddate, '[)') && tsrange(c.startdate, c.enddate, '[)')
ORDER BY accompanyingperiod_id;
-- to examine line in conflict for a given accompanyingperiod_id (given by the previous query)
SELECT * FROM chill_person_accompanying_period_user_history WHERE accompanyingperiod_id = IIIIDDDD order by startdate, enddate;
```
"