Commit 777b891d authored by Georgios Tsakalos's avatar Georgios Tsakalos

update school schema

parent c37f368b
......@@ -240,18 +240,24 @@ INSERT INTO `itemcategory` VALUES (8,'ACCESS POINT'),(26,'LAPTOP'),(7,'MEDIA CON
/*!40000 ALTER TABLE `itemcategory` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `course`
--
CREATE TABLE `course` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table `lab`
--
DROP TABLE IF EXISTS `lab`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `lab` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`school_id` int(11) unsigned NOT NULL,
`teacher_id` int(11) unsigned,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`type` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`area` int(11) unsigned NOT NULL,
......@@ -260,12 +266,38 @@ CREATE TABLE `lab` (
`out_school_use` tinyint(1) unsigned DEFAULT '0',
`has_network` tinyint(1) unsigned DEFAULT '0',
`has_server` tinyint(1) unsigned DEFAULT '0',
`teacher_id` int(11) unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
FOREIGN KEY (school_id) REFERENCES school(id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
KEY `school_id` (`school_id`),
KEY `index_foreignkey_lab_teacher` (`teacher_id`),
CONSTRAINT `c_fk_lab_teacher_id` FOREIGN KEY (`teacher_id`) REFERENCES `teacher` (`id`),
CONSTRAINT `lab_ibfk_1` FOREIGN KEY (`school_id`) REFERENCES `school` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `course_lab`
--
CREATE TABLE `course_lab` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`course_id` int(11) unsigned DEFAULT NULL,
`lab_id` int(11) unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UQ_5dc8c5a0ea81087a9c594a364e698c3295024b75` (`course_id`,`lab_id`),
KEY `index_foreignkey_course_lab_course` (`course_id`),
KEY `index_foreignkey_course_lab_lab` (`lab_id`),
CONSTRAINT `c_fk_course_lab_lab_id` FOREIGN KEY (`lab_id`) REFERENCES `lab` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `c_fk_course_lab_course_id` FOREIGN KEY (`course_id`) REFERENCES `course` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table `course`
--
--
-- Table structure for table `schoolasset`
--
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment