update script with resinam troubles
This commit is contained in:
parent
36e3bf3b4b
commit
543a4569fd
@ -10,6 +10,7 @@
|
|||||||
-- * referrer: cfr. 57
|
-- * referrer: cfr. 57
|
||||||
-- * scopes: cfr. 58
|
-- * scopes: cfr. 58
|
||||||
--
|
--
|
||||||
|
-- vérifier les étiquettes de colonnes: user-> referrer, acp_social_issues-> acp_socialissues
|
||||||
|
|
||||||
|
|
||||||
-- 1. Adjust Type cast for id columns
|
-- 1. Adjust Type cast for id columns
|
||||||
@ -125,7 +126,7 @@ 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;
|
||||||
UPDATE import.choix_periodes SET enfant1=json_build_object('fr', upper(trim(enfant))) WHERE enfant !='';
|
UPDATE import.choix_periodes SET enfant1=json_build_object('fr', upper(trim(enfant))) WHERE enfant !='';
|
||||||
WITH max_ordering AS ( SELECT MAX(ordering) as max_ordering FROM chill_person_social_issue )
|
WITH max_ordering AS ( SELECT COALESCE(MAX(ordering),1) as max_ordering FROM chill_person_social_issue )
|
||||||
INSERT INTO chill_person_social_issue (id, parent_id, title, ordering)
|
INSERT INTO chill_person_social_issue (id, parent_id, title, ordering)
|
||||||
SELECT nextval('chill_person_social_issue_id_seq'),
|
SELECT nextval('chill_person_social_issue_id_seq'),
|
||||||
null, t.parent1,
|
null, t.parent1,
|
||||||
@ -157,7 +158,7 @@ ALTER TABLE import.personnes ADD COLUMN gender1 VARCHAR;
|
|||||||
UPDATE import.personnes SET gender1 = CASE
|
UPDATE import.personnes SET gender1 = CASE
|
||||||
WHEN trim(gender) IN ('Femme', 'femme', 'Woman', 'woman', 'Female', 'female') THEN 'woman'
|
WHEN trim(gender) IN ('Femme', 'femme', 'Woman', 'woman', 'Female', 'female') THEN 'woman'
|
||||||
WHEN trim(gender) IN ('Homme', 'homme', 'Man', 'man', 'Male', 'male') THEN 'man'
|
WHEN trim(gender) IN ('Homme', 'homme', 'Man', 'man', 'Male', 'male') THEN 'man'
|
||||||
WHEN trim(gender) IN ('', 'Inconnu', 'inconnu', 'Unknown', 'unknown') THEN 'unknown'
|
WHEN trim(gender) IN ('Autre', 'Inconnu', 'inconnu', 'Unknown', 'unknown') THEN 'unknown'
|
||||||
ELSE 'both' END;
|
ELSE 'both' END;
|
||||||
|
|
||||||
-- 22. Prepare personnes nationality
|
-- 22. Prepare personnes nationality
|
||||||
@ -291,7 +292,7 @@ INSERT INTO chill_person_person_center_history (id, person_id, center_id, startd
|
|||||||
ALTER TABLE import.personnes ADD column address_id BIGINT;
|
ALTER TABLE import.personnes ADD column address_id BIGINT;
|
||||||
UPDATE import.personnes SET address_id = nextval('chill_main_address_id_seq');
|
UPDATE import.personnes SET address_id = nextval('chill_main_address_id_seq');
|
||||||
ALTER TABLE import.personnes ADD column postcode_id BIGINT;
|
ALTER TABLE import.personnes ADD column postcode_id BIGINT;
|
||||||
UPDATE import.personnes SET postcode_id = pc.id FROM chill_main_postal_code pc WHERE pc.code = postcode AND pc.origin = 0;
|
UPDATE import.personnes SET postcode_id = pc.id FROM chill_main_postal_code pc WHERE pc.code::int = postcode AND pc.origin = 0;
|
||||||
INSERT INTO chill_main_address (id, postcode_id, street, streetnumber, extra, validFrom) SELECT
|
INSERT INTO chill_main_address (id, postcode_id, street, streetnumber, extra, validFrom) SELECT
|
||||||
address_id, postcode_id, street, streetnumber, extra, COALESCE(validfrom1 , date(date_trunc('year', CURRENT_DATE)))
|
address_id, postcode_id, street, streetnumber, extra, COALESCE(validfrom1 , date(date_trunc('year', CURRENT_DATE)))
|
||||||
FROM import.personnes WHERE postcode_id IS NOT NULL;
|
FROM import.personnes WHERE postcode_id IS NOT NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user