aboutsummaryrefslogtreecommitdiffstats
path: root/mayor-orig/mayor-naplo/update/pre004627-1-naplo.sql
blob: d726406bdc6387eb755787945a25cd6cbc7e2239 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
DELIMITER $$
DROP PROCEDURE IF EXISTS upgrade_database_4627 $$

CREATE PROCEDURE upgrade_database_4627()
BEGIN
SET NAMES utf8 COLLATE utf8_hungarian_ci;

IF NOT EXISTS (
    SELECT * FROM information_schema.TABLES WHERE TABLE_SCHEMA=DATABASE() and TABLE_NAME='oraHazifeladatDiak'
) THEN

CREATE TABLE `oraHazifeladatDiak` (
  `hazifeladatId` int(10) unsigned NOT NULL,
  `diakId` int(10) unsigned NOT NULL,
  `diakLattamDt` datetime DEFAULT NULL,
  `tanarLattamDt` datetime DEFAULT NULL,
  `hazifeladatDiakStatus` ENUM('','kész') DEFAULT '',
  `hazifeladatDiakMegjegyzes` varchar(255) COLLATE utf8_hungarian_ci NOT NULL,
  PRIMARY KEY (`hazifeladatId`,`diakId`),
  UNIQUE KEY `oraHazifeladatDiak_UK` (`hazifeladatId`,`diakId`),
  CONSTRAINT `oraHazifeladatDiak_ibfk_1` FOREIGN KEY (`hazifeladatId`) REFERENCES `oraHazifeladat` (`hazifeladatId`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `oraHazifeladatDiak_ibfk_2` FOREIGN KEY (`diakId`) REFERENCES %INTEZMENYDB%.`diak` (`diakId`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_hungarian_ci;

END IF;

END $$
DELIMITER ;
CALL upgrade_database_4627();