add Manufacturers and Models Tables

This commit is contained in:
Isaac Connor 2017-08-25 15:35:17 -04:00
parent 11b29bf1ec
commit a5079f205e
3 changed files with 68 additions and 1 deletions

View File

@ -286,6 +286,31 @@ CREATE TABLE `Logs` (
KEY `TimeKey` (`TimeKey`) KEY `TimeKey` (`TimeKey`)
) ENGINE=@ZM_MYSQL_ENGINE@; ) ENGINE=@ZM_MYSQL_ENGINE@;
--
-- Table structure for table `Manufacturers`
--
DROP TABLE IF EXISTS `Manufacturers`;
CREATE TABLE `Manufacturers` (
`Id` int(10) unsigned NOT NULL auto_increment,
`Name` varchar(64) NOT NULL,
PRIMARY KEY (`Id`),
UNIQUE KEY (`Name`)
) ENGINE=@ZM_MYSQL_ENGINE@;
--
-- Table structure for table `Models`
--
DROP TABLE IF EXISTS `Models`;
CREATE TABLE `Models` (
`Id` int(10) unsigned NOT NULL auto_increment,
`Name` varchar(64) NOT NULL,
`ManufacturerId` int(10),
PRIMARY KEY (`Id`),
UNIQUE KEY (`ManufacturerId`,`Name`)
) ENGINE=@ZM_MYSQL_ENGINE@;
-- --
-- Table structure for table `MonitorPresets` -- Table structure for table `MonitorPresets`
-- --

42
db/zm_update-1.31.4.sql Normal file
View File

@ -0,0 +1,42 @@
--
-- This adds Manufacturers and Models
--
SET @s = (SELECT IF(
(SELECT COUNT(*)
FROM INFORMATION_SCHEMA.TABLES
WHERE table_name = 'Manufacturers'
AND table_schema = DATABASE()
) > 0,
"SELECT 'Manufacturers table exists'",
"
CREATE TABLE `Manufacturers` (
`Id` int(10) unsigned NOT NULL auto_increment,
`Name` varchar(64) NOT NULL,
PRIMARY KEY (`Id`),
UNIQUE KEY (`Name`)
)"
));
PREPARE stmt FROM @s;
EXECUTE stmt;
SET @s = (SELECT IF(
(SELECT COUNT(*)
FROM INFORMATION_SCHEMA.TABLES
WHERE table_name = 'Models'
AND table_schema = DATABASE()
) > 0,
"SELECT 'Models table exists'",
"CREATE TABLE `Models` (
`Id` int(10) unsigned NOT NULL auto_increment,
`Name` varchar(64) NOT NULL,
`ManufacturerId` int(10),
PRIMARY KEY (`Id`),
UNIQUE KEY (`ManufacturerId`,`Name`)
)"
));
PREPARE stmt FROM @s;
EXECUTE stmt;

View File

@ -1 +1 @@
1.31.3 1.31.4