-- Rename tables: remove bms_ prefix (run once on existing DB) SET NAMES utf8mb4; -- bms_biz_rule -> biz_rule SET @sql := ( SELECT IF( EXISTS(SELECT 1 FROM information_schema.tables WHERE table_schema = DATABASE() AND table_name = 'bms_biz_rule') AND NOT EXISTS(SELECT 1 FROM information_schema.tables WHERE table_schema = DATABASE() AND table_name = 'biz_rule'), 'RENAME TABLE bms_biz_rule TO biz_rule', 'SELECT 1' ) ); PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt; -- bms_biz_attachment -> biz_attachment SET @sql := ( SELECT IF( EXISTS(SELECT 1 FROM information_schema.tables WHERE table_schema = DATABASE() AND table_name = 'bms_biz_attachment') AND NOT EXISTS(SELECT 1 FROM information_schema.tables WHERE table_schema = DATABASE() AND table_name = 'biz_attachment'), 'RENAME TABLE bms_biz_attachment TO biz_attachment', 'SELECT 1' ) ); PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;