aboutsummaryrefslogtreecommitdiffstats
path: root/mayor-orig/mayor-portal/update
diff options
context:
space:
mode:
authorM.Gergo2020-10-28 11:35:04 +0100
committerM.Gergo2020-10-28 11:35:04 +0100
commitc279e479aa9c943fd0fc2b396638a5208c78cfb9 (patch)
tree934606a81b5facced41a555ccfd606f2ab56c195 /mayor-orig/mayor-portal/update
parenta5ac3d0ab4015ed2683706cd0677ce6ce159f0ed (diff)
downloadmayor-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.sql32
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();