80 lines
2.0 KiB
SQL
80 lines
2.0 KiB
SQL
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
|
START TRANSACTION;
|
|
SET time_zone = "+00:00";
|
|
|
|
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
|
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
|
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
|
/*!40101 SET NAMES utf8mb4 */;
|
|
|
|
|
|
CREATE TABLE `Hosts` (
|
|
`IPAddress` bit(32) NOT NULL,
|
|
`NetworkId` int(11) NOT NULL,
|
|
`Hostname` varchar(255) NOT NULL DEFAULT '',
|
|
`FQDN` varchar(255) NOT NULL DEFAULT '',
|
|
`MacAddress` varchar(17) NOT NULL DEFAULT '',
|
|
`Comments` varchar(255) NOT NULL DEFAULT ''
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
|
|
CREATE TABLE `Networks` (
|
|
`id` int(11) NOT NULL,
|
|
`Name` varchar(255) NOT NULL,
|
|
`Address` bit(32) NOT NULL,
|
|
`Mask` bit(32) NOT NULL,
|
|
`SiteId` int(11) NOT NULL
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
|
|
CREATE TABLE `Sites` (
|
|
`id` int(11) NOT NULL,
|
|
`Name` varchar(255) NOT NULL
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
|
|
CREATE TABLE `Users` (
|
|
`id` int(11) NOT NULL,
|
|
`login` varchar(255) NOT NULL
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
|
|
CREATE TABLE `UserSites` (
|
|
`id` int(11) NOT NULL,
|
|
`UserId` int(11) NOT NULL,
|
|
`SiteId` int(11) NOT NULL
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
|
|
|
|
ALTER TABLE `Hosts`
|
|
ADD PRIMARY KEY (`IPAddress`),
|
|
ADD UNIQUE KEY `IPAddress` (`IPAddress`);
|
|
|
|
ALTER TABLE `Networks`
|
|
ADD PRIMARY KEY (`id`);
|
|
|
|
ALTER TABLE `Sites`
|
|
ADD PRIMARY KEY (`id`),
|
|
ADD UNIQUE KEY `Name` (`Name`),
|
|
ADD UNIQUE KEY `Name_2` (`Name`);
|
|
|
|
ALTER TABLE `Users`
|
|
ADD PRIMARY KEY (`id`);
|
|
|
|
ALTER TABLE `UserSites`
|
|
ADD PRIMARY KEY (`id`);
|
|
|
|
|
|
ALTER TABLE `Networks`
|
|
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
|
|
|
ALTER TABLE `Sites`
|
|
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
|
|
|
ALTER TABLE `Users`
|
|
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
|
|
|
ALTER TABLE `UserSites`
|
|
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
|
COMMIT;
|
|
|
|
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
|
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
|
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|