This ticket captures the work required to implement findings of T316127
Acceptance criteria:
Create the new tables below to store addresses, and change the code as needed to save and read from the new columns.
https://dbdesigner.page.link/r5x5E6zP14iXMGN6A
ALTERs to run on beta
Before merging the patch:
CREATE TABLE ce_address ( cea_id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL, cea_full_address BLOB NOT NULL, cea_country VARBINARY(255) DEFAULT NULL, PRIMARY KEY(cea_id) ); CREATE TABLE ce_event_address ( ceea_id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL, ceea_event BIGINT UNSIGNED NOT NULL, ceea_address BIGINT UNSIGNED NOT NULL, UNIQUE INDEX ceea_event_address (ceea_event, ceea_address), PRIMARY KEY(ceea_id) ); ALTER TABLE campaign_events ALTER COLUMN event_meeting_country SET DEFAULT 'xxx-new-row'; ALTER TABLE campaign_events ALTER COLUMN event_meeting_address SET DEFAULT 'xxx-new-row';
After merging the patch:
INSERT INTO ce_address (cea_country, cea_full_address) SELECT event_meeting_country, CONCAT(event_meeting_address, " \n ", event_meeting_country) FROM campaign_events WHERE ( event_meeting_country != '' OR event_meeting_address != '' ) and event_meeting_country != 'xxx-new-row' and event_meeting_address != 'xxx-new-row'; INSERT INTO ce_event_address (ceea_event, ceea_address) SELECT event_id, cea_id FROM campaign_events JOIN ce_address ON CONCAT(event_meeting_address, " \n ", event_meeting_country) = cea_full_address; ALTER TABLE campaign_events DROP COLUMN event_meeting_country; ALTER TABLE campaign_events DROP COLUMN event_meeting_address;