renaming alias

This commit is contained in:
Mathieu Jaumotte 2023-03-10 16:16:27 +01:00
parent cadcddddb5
commit 081ce76085

View File

@ -236,11 +236,6 @@ DO $$
--SELECT mobilenumber, mobilenumber1, phonenumber, phonenumber1 FROM import.personnes ORDER BY id; --SELECT mobilenumber, mobilenumber1, phonenumber, phonenumber1 FROM import.personnes ORDER BY id;
END $$; END $$;
-- 35. Prepare required default dates
-- address_validfrom1 | household_startdate1
-- acp_openingdate1
-- 40. Prepare id mapping before insertion -- 40. Prepare id mapping before insertion
ALTER TABLE import.personnes ADD column person_id BIGINT; ALTER TABLE import.personnes ADD column person_id BIGINT;
UPDATE import.personnes SET person_id=personid UPDATE import.personnes SET person_id=personid
@ -290,11 +285,11 @@ 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 = cmpc.id FROM chill_main_postal_code cmpc WHERE cmpc.code = postcode AND cmpc.origin = 0; UPDATE import.personnes SET postcode_id = pc.id FROM chill_main_postal_code pc WHERE pc.code = 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;
SELECT ip.person_id, ip.address_id FROM import.personnes ip ; -- SELECT ip.person_id, ip.address_id FROM import.personnes ip ;
-- SELECT ip.id, ip.person_id, ip.firstname, ip.lastname, addr.* FROM chill_main_address addr RIGHT JOIN import.personnes ip ON addr.id = ip.address_id ORDER BY ip.id; -- SELECT ip.id, ip.person_id, ip.firstname, ip.lastname, addr.* FROM chill_main_address addr RIGHT JOIN import.personnes ip ON addr.id = ip.address_id ORDER BY ip.id;
-- 44. Add houshold and household member with position -- 44. Add houshold and household member with position