mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
Feature: avoid duplicates for the same period in acc period user history
This commit is contained in:
28
.changes/unreleased/Feature-20230627-151615.yaml
Normal file
28
.changes/unreleased/Feature-20230627-151615.yaml
Normal file
@@ -0,0 +1,28 @@
|
||||
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;
|
||||
|
||||
```
|
||||
"
|
Reference in New Issue
Block a user