aboutsummaryrefslogtreecommitdiffstats
path: root/mayor-orig/update/pre003517-1-intezmeny.sql
diff options
context:
space:
mode:
authorM.Gergo2019-03-08 21:20:34 +0100
committerM.Gergo2019-03-08 21:20:34 +0100
commitf51c9ed2abe5c68211bb3736be5f70b1fe2c9ec0 (patch)
treee13e60e4b94a3b58f1e2bfbe271102c8f04b67bd /mayor-orig/update/pre003517-1-intezmeny.sql
parentc76a004b0135786f2742283f8d5f917106f58bd8 (diff)
downloadmayor-f51c9ed2abe5c68211bb3736be5f70b1fe2c9ec0.tar.gz
mayor-f51c9ed2abe5c68211bb3736be5f70b1fe2c9ec0.zip
további rendrakás
Diffstat (limited to 'mayor-orig/update/pre003517-1-intezmeny.sql')
-rw-r--r--mayor-orig/update/pre003517-1-intezmeny.sql43
1 files changed, 0 insertions, 43 deletions
diff --git a/mayor-orig/update/pre003517-1-intezmeny.sql b/mayor-orig/update/pre003517-1-intezmeny.sql
deleted file mode 100644
index 9e205e43..00000000
--- a/mayor-orig/update/pre003517-1-intezmeny.sql
+++ /dev/null
@@ -1,43 +0,0 @@
-DELIMITER $$
-DROP PROCEDURE IF EXISTS upgrade_database_3517 $$
-CREATE PROCEDURE upgrade_database_3517()
-BEGIN
-IF NOT EXISTS (
- SELECT * FROM information_schema.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME='diakTorzslapszam'
-) THEN
- CREATE TABLE `diakTorzslapszam` (
- `osztalyId` int(10) unsigned NOT NULL,
- `diakId` int(10) unsigned NOT NULL,
- `torzslapszam` tinyint unsigned NOT NULL,
- PRIMARY KEY (`osztalyId`,`diakId`),
- KEY `diakTorzslapszam_ibfk_2` (`diakId`),
- CONSTRAINT `diakTorzslapszam_ibfk_1` FOREIGN KEY (`osztalyId`) REFERENCES `osztaly` (`osztalyId`) ON DELETE CASCADE ON UPDATE CASCADE,
- CONSTRAINT `diakTorzslapszam_ibfk_2` FOREIGN KEY (`diakId`) REFERENCES `diak` (`diakId`) ON DELETE CASCADE ON UPDATE CASCADE
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_hungarian_ci;
- -- A névsor miatt az üres mező NULL kell legyen!
- update diak set viseltNevElotag = NULL where viseltNevElotag = '';
-
- -- A törzslapszámok feltöltése
- set @oszt=0;
- set @sz=0;
- insert ignore into diakTorzslapszam
- select osztalyId, diakId, sorsz from (
- select
- @sz:=if(@oszt=osztalyId,@sz:=@sz+1,1) as sorsz,
- @oszt:=osztalyId as o,
- osztalyId, diakId, sort, diakNev
- from (
- select
- osztalyId, diakId,
- if (month(min(beDt))>8 or month(min(beDt))<6 or (month(min(beDt))=6 and day(min(beDt))<16), min(beDt), date_format(min(beDt),'%Y-09-01')) as sort,
- concat_ws(' ',viseltNevElotag, viseltCsaladinev, viseltUtonev) as diakNev
- from osztalyDiak left join diak using (diakId) WHERE diak.diakId IS NOT NULL
- group by osztalyId, diakId
- order by osztalyId, sort, diakNev
- ) as t
- ) as k;
- -- where diakId=... and osztalyId=...;
-END IF;
-END $$
-DELIMITER ; $$
-CALL upgrade_database_3517();