From 615faf48de0a2d335bfc61358ac54baacd953dc1 Mon Sep 17 00:00:00 2001 From: jorgep Date: Wed, 6 Nov 2024 10:54:12 +0100 Subject: [PATCH] chore: refs #6452 drop script --- .../00-useIdAsSip.vn.sql | 40 ------------------- 1 file changed, 40 deletions(-) delete mode 100644 db/versions/11301-turquoiseOrchid/00-useIdAsSip.vn.sql diff --git a/db/versions/11301-turquoiseOrchid/00-useIdAsSip.vn.sql b/db/versions/11301-turquoiseOrchid/00-useIdAsSip.vn.sql deleted file mode 100644 index 7d84e74a9..000000000 --- a/db/versions/11301-turquoiseOrchid/00-useIdAsSip.vn.sql +++ /dev/null @@ -1,40 +0,0 @@ -ALTER TABLE pbx.followme DROP FOREIGN KEY followme_ibfk_1; -ALTER TABLE pbx.queueMember DROP FOREIGN KEY queueMember_ibfk_2; -ALTER TABLE pbx.sipReg DROP FOREIGN KEY sipReg_ibfk_1; - -CREATE OR REPLACE TEMPORARY TABLE tSipReg - SELECT * FROM pbx.sipReg; - -CREATE OR REPLACE TEMPORARY TABLE tOldSip - SELECT * FROM pbx.sip; - -TRUNCATE TABLE pbx.sipReg; - -TRUNCATE TABLE pbx.sip; - -INSERT INTO pbx.sip (user_id, extension) - SELECT w.id, w.id FROM vn.worker w; - -REPLACE INTO pbx.sipReg - SELECT tsr.* FROM tSipReg tsr - JOIN vn.worker w ON tsr.userId = w.id; - -UPDATE pbx.queueMember qm - JOIN tOldSip tos ON tos.extension = qm.extension - LEFT JOIN pbx.sip s ON s.user_id = tos.user_id - SET qm.extension = s.extension; - -ALTER TABLE pbx.followme - ADD CONSTRAINT followme_ibfk_1 - FOREIGN KEY (extension) REFERENCES pbx.sip(extension); - -ALTER TABLE pbx.queueMember - ADD CONSTRAINT queueMember_ibfk_2 - FOREIGN KEY (extension) REFERENCES pbx.sip(extension); - -ALTER TABLE pbx.sipReg - ADD CONSTRAINT sipReg_ibfk_1 - FOREIGN KEY (userId) REFERENCES pbx.sip(user_id); - -DROP TEMPORARY TABLE IF EXISTS tSipReg; -DROP TEMPORARY TABLE IF EXISTS tOldSip; \ No newline at end of file