diff options
author | M.Gergo | 2019-10-27 02:17:37 +0100 |
---|---|---|
committer | M.Gergo | 2019-10-27 02:17:37 +0100 |
commit | abd8cfdf391410090842081422f711779978f473 (patch) | |
tree | 134baa4655481da13d00e2315860c16e877851d7 /mayor-orig/mayor-naplo/update | |
parent | 6d684ff9fb3caf8de057829bda27995d5d9de361 (diff) | |
download | mayor-abd8cfdf391410090842081422f711779978f473.tar.gz mayor-abd8cfdf391410090842081422f711779978f473.zip |
Rev: 4554rev4554
Diffstat (limited to 'mayor-orig/mayor-naplo/update')
-rw-r--r-- | mayor-orig/mayor-naplo/update/pre004540-1-intezmeny.sql | 16 | ||||
-rw-r--r-- | mayor-orig/mayor-naplo/update/pre004548-1-naplo.sql | 21 |
2 files changed, 37 insertions, 0 deletions
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(); |