This repository has been archived by the owner on May 8, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
INSTALL.sql
124 lines (103 loc) · 3.51 KB
/
INSTALL.sql
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
-- phpMyAdmin SQL Dump
-- version 4.0.4.1
-- http://www.phpmyadmin.net
--
-- Počítač: localhost
-- Vygenerováno: Čtv 17. říj 2013, 23:45
-- Verze serveru: 5.6.12
-- Verze PHP: 5.5.3
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
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 utf8 */;
--
-- Databáze: `runtime`
--
CREATE DATABASE IF NOT EXISTS `runtime` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `runtime`;
-- --------------------------------------------------------
--
-- Struktura tabulky `history`
--
CREATE TABLE IF NOT EXISTS `history` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`service_id` int(11) NOT NULL,
`time` datetime NOT NULL,
`response_ms` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `service_id` (`service_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Struktura tabulky `outages`
--
CREATE TABLE IF NOT EXISTS `outages` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`service_id` int(11) NOT NULL,
`name` varchar(64) NOT NULL,
`outage_start` datetime NOT NULL,
`outage_end` datetime NOT NULL,
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`),
KEY `service_id` (`service_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Struktura tabulky `services`
--
CREATE TABLE IF NOT EXISTS `services` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`hostname` varchar(64) NOT NULL,
`info` varchar(64) NOT NULL,
`type` varchar(30) NOT NULL,
`port` smallint(5) unsigned NOT NULL,
`text_match` varchar(64) NOT NULL,
`alert_threshold` int(11) NOT NULL DEFAULT '1000',
`public` bit(1) NOT NULL,
`response_ms` int(11) NOT NULL,
`availability` float NOT NULL,
`last_checked` datetime NOT NULL,
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Struktura tabulky `users`
--
CREATE TABLE IF NOT EXISTS `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`email` varchar(64) NOT NULL,
`password` varchar(255) NOT NULL,
`registered` datetime NOT NULL,
`last_login` datetime NOT NULL,
`validation` varchar(16) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `validation` (`validation`),
UNIQUE KEY `email` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
--
-- Omezení pro exportované tabulky
--
--
-- Omezení pro tabulku `history`
--
ALTER TABLE `history`
ADD CONSTRAINT `history_ibfk_1` FOREIGN KEY (`service_id`) REFERENCES `services` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Omezení pro tabulku `outages`
--
ALTER TABLE `outages`
ADD CONSTRAINT `outages_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `outages_ibfk_2` FOREIGN KEY (`service_id`) REFERENCES `services` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Omezení pro tabulku `services`
--
ALTER TABLE `services`
ADD CONSTRAINT `services_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
/*!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 */;