improve title comment block
This commit is contained in:
parent
4dc09c559a
commit
dd89aa6ff1
@ -42,7 +42,7 @@ INSERT INTO country (id, name, countrycode)
|
|||||||
FROM ( SELECT DISTINCT ON (country) country1 FROM import.choix_personnes WHERE country1 IS NOT NULL ) t
|
FROM ( SELECT DISTINCT ON (country) country1 FROM import.choix_personnes WHERE country1 IS NOT NULL ) t
|
||||||
WHERE NOT EXISTS ( SELECT 1 FROM country WHERE name::jsonb = t.country1 );
|
WHERE NOT EXISTS ( SELECT 1 FROM country WHERE name::jsonb = t.country1 );
|
||||||
|
|
||||||
-- 5. Complete table maritalstatus
|
-- 5. Complete table marital_status
|
||||||
ALTER TABLE import.choix_personnes ADD COLUMN maritalstatus1 JSONB;
|
ALTER TABLE import.choix_personnes ADD COLUMN maritalstatus1 JSONB;
|
||||||
UPDATE import.choix_personnes SET maritalstatus1=json_build_object('fr', trim(maritalstatus)) WHERE maritalstatus!='';
|
UPDATE import.choix_personnes SET maritalstatus1=json_build_object('fr', trim(maritalstatus)) WHERE maritalstatus!='';
|
||||||
INSERT INTO chill_person_marital_status (id, name)
|
INSERT INTO chill_person_marital_status (id, name)
|
||||||
@ -70,7 +70,7 @@ INSERT INTO chill_person_household_position (id, label, sharehousehold, allowhol
|
|||||||
CROSS JOIN max_ordering
|
CROSS JOIN max_ordering
|
||||||
WHERE NOT EXISTS ( SELECT 1 FROM chill_person_household_position WHERE label::jsonb = t.household_position1 );
|
WHERE NOT EXISTS ( SELECT 1 FROM chill_person_household_position WHERE label::jsonb = t.household_position1 );
|
||||||
|
|
||||||
-- 8. Complete closingmotive
|
-- 8. Complete table accompanying_period_closingmotive
|
||||||
ALTER TABLE import.choix_periodes ADD COLUMN closingmotive1 JSONB;
|
ALTER TABLE import.choix_periodes ADD COLUMN closingmotive1 JSONB;
|
||||||
UPDATE import.choix_periodes SET closingmotive1=json_build_object('fr', trim(closingmotive)) WHERE closingmotive!='';
|
UPDATE import.choix_periodes SET closingmotive1=json_build_object('fr', trim(closingmotive)) WHERE closingmotive!='';
|
||||||
WITH max_ordering AS ( SELECT MAX(ordering) as max_ordering FROM chill_person_accompanying_period_closingmotive )
|
WITH max_ordering AS ( SELECT MAX(ordering) as max_ordering FROM chill_person_accompanying_period_closingmotive )
|
||||||
@ -82,7 +82,7 @@ INSERT INTO chill_person_accompanying_period_closingmotive (id, name, active, pa
|
|||||||
CROSS JOIN max_ordering
|
CROSS JOIN max_ordering
|
||||||
WHERE NOT EXISTS ( SELECT 1 FROM chill_person_accompanying_period_closingmotive WHERE name::jsonb = t.closingmotive1 );
|
WHERE NOT EXISTS ( SELECT 1 FROM chill_person_accompanying_period_closingmotive WHERE name::jsonb = t.closingmotive1 );
|
||||||
|
|
||||||
-- 9. Complete origin
|
-- 9. Complete table accompanying_period_origin
|
||||||
ALTER TABLE import.choix_periodes ADD COLUMN origin1 JSONB;
|
ALTER TABLE import.choix_periodes ADD COLUMN origin1 JSONB;
|
||||||
UPDATE import.choix_periodes SET origin1=json_build_object('fr', trim(origin)) WHERE origin!='';
|
UPDATE import.choix_periodes SET origin1=json_build_object('fr', trim(origin)) WHERE origin!='';
|
||||||
INSERT INTO chill_person_accompanying_period_origin (id, label, noactiveafter)
|
INSERT INTO chill_person_accompanying_period_origin (id, label, noactiveafter)
|
||||||
@ -90,7 +90,7 @@ INSERT INTO chill_person_accompanying_period_origin (id, label, noactiveafter)
|
|||||||
FROM ( SELECT DISTINCT ON (origin) origin1 FROM import.choix_periodes WHERE origin1 IS NOT NULL ) t
|
FROM ( SELECT DISTINCT ON (origin) origin1 FROM import.choix_periodes WHERE origin1 IS NOT NULL ) t
|
||||||
WHERE NOT EXISTS ( SELECT 1 FROM chill_person_accompanying_period_origin WHERE label::jsonb = t.origin1 );
|
WHERE NOT EXISTS ( SELECT 1 FROM chill_person_accompanying_period_origin WHERE label::jsonb = t.origin1 );
|
||||||
|
|
||||||
-- 10. Complete user_job
|
-- 10. Complete table user_job
|
||||||
ALTER TABLE import.choix_periodes ADD COLUMN job1 JSONB;
|
ALTER TABLE import.choix_periodes ADD COLUMN job1 JSONB;
|
||||||
UPDATE import.choix_periodes SET job1=json_build_object('fr', trim(job)) WHERE job!='';
|
UPDATE import.choix_periodes SET job1=json_build_object('fr', trim(job)) WHERE job!='';
|
||||||
INSERT INTO chill_main_user_job (id, label, active)
|
INSERT INTO chill_main_user_job (id, label, active)
|
||||||
@ -98,7 +98,7 @@ INSERT INTO chill_main_user_job (id, label, active)
|
|||||||
FROM ( SELECT DISTINCT ON (job) job1 FROM import.choix_periodes WHERE job1 IS NOT NULL ) t
|
FROM ( SELECT DISTINCT ON (job) job1 FROM import.choix_periodes WHERE job1 IS NOT NULL ) t
|
||||||
WHERE NOT EXISTS( SELECT 1 FROM chill_main_user_job WHERE label::jsonb = t.job1 );
|
WHERE NOT EXISTS( SELECT 1 FROM chill_main_user_job WHERE label::jsonb = t.job1 );
|
||||||
|
|
||||||
-- 11. Complete acp_scopes
|
-- 11. Complete table Scopes
|
||||||
ALTER TABLE import.choix_periodes ADD COLUMN acp_scopes1 JSONB;
|
ALTER TABLE import.choix_periodes ADD COLUMN acp_scopes1 JSONB;
|
||||||
UPDATE import.choix_periodes SET acp_scopes1=json_build_object('fr', trim(acp_scopes)) WHERE acp_scopes!='';
|
UPDATE import.choix_periodes SET acp_scopes1=json_build_object('fr', trim(acp_scopes)) WHERE acp_scopes!='';
|
||||||
INSERT INTO scopes (id, name, active)
|
INSERT INTO scopes (id, name, active)
|
||||||
@ -106,13 +106,13 @@ INSERT INTO scopes (id, name, active)
|
|||||||
FROM ( SELECT DISTINCT ON (acp_scopes) acp_scopes1 FROM import.choix_periodes WHERE acp_scopes1 IS NOT NULL ) t
|
FROM ( SELECT DISTINCT ON (acp_scopes) acp_scopes1 FROM import.choix_periodes WHERE acp_scopes1 IS NOT NULL ) t
|
||||||
WHERE NOT EXISTS ( SELECT 1 FROM scopes WHERE name::jsonb = t.acp_scopes1 );
|
WHERE NOT EXISTS ( SELECT 1 FROM scopes WHERE name::jsonb = t.acp_scopes1 );
|
||||||
|
|
||||||
-- 12. Complete referrers
|
-- 12. Complete table Users (acp referrer)
|
||||||
INSERT INTO users (id, username, password, enabled, locked, attributes, label)
|
INSERT INTO users (id, username, password, enabled, locked, attributes, label)
|
||||||
SELECT nextval('users_id_seq'), t.referrer, '', false, false, '[]', t.referrer
|
SELECT nextval('users_id_seq'), t.referrer, '', false, false, '[]', t.referrer
|
||||||
FROM ( SELECT DISTINCT ON (referrer) referrer FROM import.choix_periodes WHERE referrer <> '') t
|
FROM ( SELECT DISTINCT ON (referrer) referrer FROM import.choix_periodes WHERE referrer <> '') t
|
||||||
WHERE NOT EXISTS ( SELECT 1 FROM users WHERE username::text = t.referrer );
|
WHERE NOT EXISTS ( SELECT 1 FROM users WHERE username::text = t.referrer );
|
||||||
|
|
||||||
-- 13. Complete Social Issues
|
-- 13. Complete table SocialIssues
|
||||||
ALTER TABLE import.choix_periodes ADD COLUMN parent1 jsonb;
|
ALTER TABLE import.choix_periodes ADD COLUMN parent1 jsonb;
|
||||||
UPDATE import.choix_periodes SET parent1=json_build_object('fr', upper(trim(parent))) WHERE parent !='';
|
UPDATE import.choix_periodes SET parent1=json_build_object('fr', upper(trim(parent))) WHERE parent !='';
|
||||||
ALTER TABLE import.choix_periodes ADD COLUMN enfant1 jsonb;
|
ALTER TABLE import.choix_periodes ADD COLUMN enfant1 jsonb;
|
||||||
@ -136,11 +136,15 @@ INSERT INTO chill_person_social_issue (id, parent_id, title, ordering)
|
|||||||
WHERE title::jsonb = t.enfant1
|
WHERE title::jsonb = t.enfant1
|
||||||
AND parent_id = (SELECT id FROM chill_person_social_issue WHERE title::jsonb = t.parent1));
|
AND parent_id = (SELECT id FROM chill_person_social_issue WHERE title::jsonb = t.parent1));
|
||||||
|
|
||||||
|
-- 14. Complete table WorkSocialActions
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- DOWN
|
-- DOWN
|
||||||
--
|
--
|
||||||
|
|
||||||
|
-- Undo 14.
|
||||||
|
|
||||||
-- Undo 13.
|
-- Undo 13.
|
||||||
DELETE FROM chill_person_social_issue USING import.choix_periodes i
|
DELETE FROM chill_person_social_issue USING import.choix_periodes i
|
||||||
WHERE parent_id IN ( SELECT id FROM chill_person_social_issue cpsi WHERE cpsi.title::jsonb = i.parent1::jsonb AND cpsi.parent_id IS NULL );
|
WHERE parent_id IN ( SELECT id FROM chill_person_social_issue cpsi WHERE cpsi.title::jsonb = i.parent1::jsonb AND cpsi.parent_id IS NULL );
|
||||||
@ -209,7 +213,7 @@ ALTER TABLE import.periodes DROP COLUMN closingdate1;
|
|||||||
-- -------------
|
-- -------------
|
||||||
|
|
||||||
-- personnes choices_list: gender
|
-- personnes choices_list: gender
|
||||||
-- periodes choices_list: intensity referrer job acp_scopes acp_socialissues work_socialaction
|
-- periodes choices_list: intensity
|
||||||
-- tiers choices_list: civility kind profession category
|
-- tiers choices_list: civility kind profession category
|
||||||
|
|
||||||
--
|
--
|
||||||
|
Loading…
Reference in New Issue
Block a user