File: fktbls002.sql

package info (click to toggle)
percona-toolkit 3.7.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 106,712 kB
  • sloc: perl: 257,236; sql: 23,577; sh: 21,388; javascript: 6,322; makefile: 397; python: 62; awk: 38; sed: 1
file content (40 lines) | stat: -rw-r--r-- 1,105 bytes parent folder | download | duplicates (3)
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
--
-- Database: test
--

--        
-- data
-- |
-- +--> data_report
-- |
-- +--> entity
--

CREATE TABLE `data_report` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `date` date DEFAULT NULL,
  `posted` datetime DEFAULT NULL,
  `acquired` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `date` (`date`,`posted`,`acquired`)
) ENGINE=InnoDB;

CREATE TABLE `entity` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `entity_property_1` varchar(16) DEFAULT NULL,
  `entity_property_2` varchar(16) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `entity_property_1` (`entity_property_1`,`entity_property_2`)
) ENGINE=InnoDB;

CREATE TABLE `data` (
  `data_report` int(11) NOT NULL DEFAULT '0',
  `hour` tinyint(4) NOT NULL DEFAULT '0',
  `entity` int(11) NOT NULL DEFAULT '0',
  `data_1` varchar(16) DEFAULT NULL,
  `data_2` varchar(16) DEFAULT NULL,
  PRIMARY KEY (`data_report`,`hour`,`entity`),
  KEY `entity` (`entity`),
  CONSTRAINT `data_ibfk_1` FOREIGN KEY (`data_report`) REFERENCES `data_report` (`id`),
  CONSTRAINT `data_ibfk_2` FOREIGN KEY (`entity`) REFERENCES `entity` (`id`)
) ENGINE=InnoDB;