Skip to content

Commit

Permalink
Update MySQL DB migration scripts for "3.4 to 3.5"
Browse files Browse the repository at this point in the history
  • Loading branch information
liviuchircu committed May 9, 2024
1 parent 5f3baea commit 816b58e
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 74 deletions.
140 changes: 70 additions & 70 deletions scripts/mysql/db-migrate.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 2020-2023 OpenSIPS Solutions
# Copyright (C) 2020-2024 OpenSIPS Solutions
#
# This file is part of opensips, a free SIP server.
#
Expand All @@ -17,82 +17,82 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

DROP PROCEDURE IF EXISTS `OSIPS_DB_MIGRATE_3_3_TO_3_4`;
DROP PROCEDURE IF EXISTS `OSIPS_DB_MIGRATE_3_4_TO_3_5`;
DELIMITER $$
CREATE PROCEDURE `OSIPS_DB_MIGRATE_3_3_TO_3_4`(
CREATE PROCEDURE `OSIPS_DB_MIGRATE_3_4_TO_3_5`(
IN old_db CHAR(64), IN new_db CHAR(64))
BEGIN


# provisioning-data tables which can be copied 1:1
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'acc');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'address');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'cachedb');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'carrierfailureroute');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'carrierroute');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'cc_agents');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'cc_calls');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'cc_cdrs');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'cc_flows');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'closeddial');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'clusterer');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'cpl');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'dbaliases');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'dialplan');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'dispatcher');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'domain');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'domainpolicy');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'dr_carriers');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'dr_gateways');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'dr_groups');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'dr_partitions');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'dr_rules');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'emergency_report');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'emergency_routing');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'emergency_service_provider');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'fraud_detection');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'freeswitch');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'globalblacklist');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'grp');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'imc_members');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'imc_rooms');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'jwt_profiles');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'jwt_secrets');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'load_balancer');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'missed_calls');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'presentity');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'pua');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'qr_profiles');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 're_grp');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'registrant');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'rc_clients');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'rc_vendors');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'rc_ratesheets');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'rc_demo_ratesheet');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'rls_presentity');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'rls_watchers');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'route_tree');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'rtpengine');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'rtpproxy_sockets');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'silo');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'sip_trace');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'smpp');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'speed_dial');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'subscriber');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'tls_mgm');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'tcp_mgm');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'uri');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'userblacklist');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'usr_preferences');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'xcap');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'acc');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'address');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'cachedb');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'carrierfailureroute');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'carrierroute');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'cc_agents');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'cc_calls');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'cc_cdrs');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'cc_flows');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'closeddial');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'clusterer');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'cpl');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'dbaliases');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'dialplan');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'dispatcher');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'domain');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'domainpolicy');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'dr_carriers');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'dr_gateways');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'dr_groups');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'dr_partitions');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'dr_rules');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'emergency_report');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'emergency_routing');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'emergency_service_provider');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'fraud_detection');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'freeswitch');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'globalblacklist');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'grp');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'imc_members');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'imc_rooms');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'jwt_profiles');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'jwt_secrets');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'load_balancer');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'missed_calls');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'presentity');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'pua');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'qr_profiles');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 're_grp');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'registrant');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'rc_clients');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'rc_vendors');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'rc_ratesheets');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'rc_demo_ratesheet');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'rls_presentity');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'rls_watchers');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'route_tree');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'rtpengine');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'rtpproxy_sockets');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'silo');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'sip_trace');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'smpp');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'speed_dial');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'subscriber');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'tls_mgm');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'tcp_mgm');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'uri');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'userblacklist');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'usr_preferences');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'xcap');

# temp-data tables which can be copied 1:1
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'active_watchers');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'b2b_entities');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'b2b_logic');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'b2b_sca');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'dialog');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'location');
CALL OSIPS_TB_COPY_3_3_TO_3_4(old_db, new_db, 'watchers');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'active_watchers');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'b2b_entities');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'b2b_logic');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'b2b_sca');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'dialog');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'location');
CALL OSIPS_TB_COPY_3_4_TO_3_5(old_db, new_db, 'watchers');
END$$
DELIMITER ;
8 changes: 4 additions & 4 deletions scripts/mysql/table-migrate.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 2020-2023 OpenSIPS Solutions
# Copyright (C) 2020-2024 OpenSIPS Solutions
#
# This file is part of opensips, a free SIP server.
#
Expand All @@ -17,9 +17,9 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

DROP PROCEDURE IF EXISTS `OSIPS_TB_COPY_3_3_TO_3_4`;
DROP PROCEDURE IF EXISTS `OSIPS_TB_COPY_3_4_TO_3_5`;
DELIMITER $$
CREATE PROCEDURE `OSIPS_TB_COPY_3_3_TO_3_4`(
CREATE PROCEDURE `OSIPS_TB_COPY_3_4_TO_3_5`(
IN old_db CHAR(64), IN new_db CHAR(64), IN tb_name CHAR(64))
BEGIN
SET @c1 = (SELECT EXISTS(
Expand All @@ -33,7 +33,7 @@ SET @c2 = (SELECT EXISTS(
AND table_name = tb_name
));
IF @c1 = 1 AND @c2 = 1 THEN
IF tb_name = 'dispatcher' THEN
IF tb_name = 'example_exception_dispatcher' THEN
SET @Q = CONCAT('INSERT INTO ', new_db, '.', tb_name, '
(id, setid, destination, socket, state, probe_mode,
weight, priority, attrs, description)
Expand Down

0 comments on commit 816b58e

Please sign in to comment.