diff options
author | M.Gergo | 2020-10-28 11:35:04 +0100 |
---|---|---|
committer | M.Gergo | 2020-10-28 11:35:04 +0100 |
commit | c279e479aa9c943fd0fc2b396638a5208c78cfb9 (patch) | |
tree | 934606a81b5facced41a555ccfd606f2ab56c195 /mayor-orig/mayor-portal/update | |
parent | a5ac3d0ab4015ed2683706cd0677ce6ce159f0ed (diff) | |
download | mayor-rev4695.tar.gz mayor-rev4695.zip |
Rev: 4695rev4695
Diffstat (limited to 'mayor-orig/mayor-portal/update')
-rw-r--r-- | mayor-orig/mayor-portal/update/rev004693-1-mayor_portal.sql | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/mayor-orig/mayor-portal/update/rev004693-1-mayor_portal.sql b/mayor-orig/mayor-portal/update/rev004693-1-mayor_portal.sql new file mode 100644 index 00000000..5b36028d --- /dev/null +++ b/mayor-orig/mayor-portal/update/rev004693-1-mayor_portal.sql @@ -0,0 +1,32 @@ +DELIMITER $$ +DROP PROCEDURE IF EXISTS upgrade_database_4693 $$ + +CREATE PROCEDURE upgrade_database_4693() +BEGIN +SET NAMES utf8 COLLATE utf8_hungarian_ci; + +IF NOT EXISTS (SELECT * FROM information_schema.STATISTICS WHERE TABLE_SCHEMA=DATABASE() and TABLE_NAME='kategoriak' AND COLUMN_NAME='id') THEN + ALTER TABLE `kategoriak` ADD UNIQUE INDEX (id); +END IF; + +ALTER TABLE `hirek` ENGINE = InnoDB; +ALTER TABLE `kategoriak` ENGINE = InnoDB; + +IF NOT EXISTS (SELECT * FROM information_schema.TABLES WHERE TABLE_SCHEMA=DATABASE() and TABLE_NAME='hirKategoria') THEN +CREATE TABLE `hirKategoria` ( + `hirId` int(10) unsigned NOT NULL, + `kategoriaId` mediumint(8) unsigned NOT NULL, + PRIMARY KEY (`hirId`,`kategoriaId`), + KEY `hirKategoria_FKIndex1` (`hirId`), + KEY `hirKategoria_FKIndex2` (`kategoriaId`), + CONSTRAINT `hirKategoria_ibfk_1` FOREIGN KEY (`hirId`) REFERENCES `hirek` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `hirKategoria_ibfk_2` FOREIGN KEY (`kategoriaId`) REFERENCES `kategoriak` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_hungarian_ci ; +END IF; + +-- hirek.cid --> hirKategoria kapcsolo +INSERT IGNORE INTO hirKategoria SELECT hirek.id as hirId,hirek.cid AS kategoriaId from hirek where hirek.cid!=0; + +END $$ +DELIMITER ; +CALL upgrade_database_4693(); |