From abd8cfdf391410090842081422f711779978f473 Mon Sep 17 00:00:00 2001 From: M.Gergo Date: Sun, 27 Oct 2019 02:17:37 +0100 Subject: Rev: 4554 --- .../mayor-naplo/update/pre004540-1-intezmeny.sql | 16 ++++++++++++++++ mayor-orig/mayor-naplo/update/pre004548-1-naplo.sql | 21 +++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 mayor-orig/mayor-naplo/update/pre004540-1-intezmeny.sql create mode 100644 mayor-orig/mayor-naplo/update/pre004548-1-naplo.sql (limited to 'mayor-orig/mayor-naplo/update') diff --git a/mayor-orig/mayor-naplo/update/pre004540-1-intezmeny.sql b/mayor-orig/mayor-naplo/update/pre004540-1-intezmeny.sql new file mode 100644 index 00000000..79a41d72 --- /dev/null +++ b/mayor-orig/mayor-naplo/update/pre004540-1-intezmeny.sql @@ -0,0 +1,16 @@ +DELIMITER $$ +DROP PROCEDURE IF EXISTS upgrade_database_4540 $$ + +CREATE PROCEDURE upgrade_database_4540() +BEGIN +SET NAMES utf8 COLLATE utf8_hungarian_ci; + +IF NOT EXISTS (SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA=DATABASE() and TABLE_NAME='targy' and COLUMN_NAME='kretaTargyNev') THEN + ALTER TABLE targy ADD `kretaTargyNev` varchar(64) COLLATE utf8_hungarian_ci DEFAULT NULL; + ALTER TABLE targy ADD UNIQUE INDEX (kretaTargyNev); +END IF; + + +END $$ +DELIMITER ; +CALL upgrade_database_4540(); diff --git a/mayor-orig/mayor-naplo/update/pre004548-1-naplo.sql b/mayor-orig/mayor-naplo/update/pre004548-1-naplo.sql new file mode 100644 index 00000000..2f26dcdd --- /dev/null +++ b/mayor-orig/mayor-naplo/update/pre004548-1-naplo.sql @@ -0,0 +1,21 @@ +DELIMITER $$ +DROP PROCEDURE IF EXISTS upgrade_database_4548 $$ + +CREATE PROCEDURE upgrade_database_4548() +BEGIN +SET NAMES utf8 COLLATE utf8_hungarian_ci; + +IF NOT EXISTS ( + SELECT * FROM information_schema.statistics WHERE TABLE_SCHEMA=DATABASE() and TABLE_NAME='csoport' and INDEX_NAME = 'IDX_U_csoport_csoportNev' +) THEN + +CREATE TEMPORARY TABLE _csoport AS SELECT csoportNev FROM csoport GROUP BY csoportNev having count(*)>1; +UPDATE csoport SET csoportNev = CONCAT(SUBSTRING(csoportNev,1,120),' ',csoportId) WHERE csoportNev IN (SELECT csoportNev FROM _csoport); +DROP TABLE _csoport; +ALTER TABLE csoport ADD UNIQUE INDEX IDX_U_csoport_csoportNev (csoportNev); + +END IF; + +END $$ +DELIMITER ; +CALL upgrade_database_4548(); -- cgit v1.2.3