· 6 years ago · Jul 09, 2019, 07:54 PM
1/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
2/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
3/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
4/*!40101 SET NAMES utf8mb4 */;
5/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
6/*!40103 SET TIME_ZONE='+00:00' */;
7/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
8/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
9/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
10/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
11
12--
13-- Table structure for table `LeafData`
14--
15
16DROP TABLE IF EXISTS `LeafData`;
17/*!40101 SET @saved_cs_client = @@character_set_client */;
18/*!40101 SET character_set_client = utf8 */;
19CREATE TABLE `LeafData` (
20 `TreeId` bigint(20) NOT NULL,
21 `LeafIdentityHash` varbinary(255) NOT NULL,
22 `LeafValue` longblob NOT NULL,
23 `ExtraData` longblob DEFAULT NULL,
24 `QueueTimestampNanos` bigint(20) NOT NULL,
25 PRIMARY KEY (`TreeId`,`LeafIdentityHash`),
26 CONSTRAINT `LeafData_ibfk_1` FOREIGN KEY (`TreeId`) REFERENCES `Trees` (`TreeId`) ON DELETE CASCADE
27) ENGINE=InnoDB DEFAULT CHARSET=latin1;
28/*!40101 SET character_set_client = @saved_cs_client */;
29
30--
31-- Dumping data for table `LeafData`
32--
33
34LOCK TABLES `LeafData` WRITE;
35/*!40000 ALTER TABLE `LeafData` DISABLE KEYS */;
36/*!40000 ALTER TABLE `LeafData` ENABLE KEYS */;
37UNLOCK TABLES;
38
39--
40-- Table structure for table `MapHead`
41--
42
43DROP TABLE IF EXISTS `MapHead`;
44/*!40101 SET @saved_cs_client = @@character_set_client */;
45/*!40101 SET character_set_client = utf8 */;
46CREATE TABLE `MapHead` (
47 `TreeId` bigint(20) NOT NULL,
48 `MapHeadTimestamp` bigint(20) NOT NULL,
49 `RootHash` varbinary(255) NOT NULL,
50 `MapRevision` bigint(20) DEFAULT NULL,
51 `RootSignature` varbinary(1024) NOT NULL,
52 `MapperData` mediumblob DEFAULT NULL,
53 PRIMARY KEY (`TreeId`,`MapHeadTimestamp`),
54 UNIQUE KEY `MapHeadRevisionIdx` (`TreeId`,`MapRevision`),
55 CONSTRAINT `MapHead_ibfk_1` FOREIGN KEY (`TreeId`) REFERENCES `Trees` (`TreeId`) ON DELETE CASCADE
56) ENGINE=InnoDB DEFAULT CHARSET=latin1;
57/*!40101 SET character_set_client = @saved_cs_client */;
58
59--
60-- Dumping data for table `MapHead`
61--
62
63LOCK TABLES `MapHead` WRITE;
64/*!40000 ALTER TABLE `MapHead` DISABLE KEYS */;
65/*!40000 ALTER TABLE `MapHead` ENABLE KEYS */;
66UNLOCK TABLES;
67
68--
69-- Table structure for table `MapLeaf`
70--
71
72DROP TABLE IF EXISTS `MapLeaf`;
73/*!40101 SET @saved_cs_client = @@character_set_client */;
74/*!40101 SET character_set_client = utf8 */;
75CREATE TABLE `MapLeaf` (
76 `TreeId` bigint(20) NOT NULL,
77 `KeyHash` varbinary(255) NOT NULL,
78 `MapRevision` bigint(20) NOT NULL,
79 `LeafValue` longblob NOT NULL,
80 PRIMARY KEY (`TreeId`,`KeyHash`,`MapRevision`),
81 CONSTRAINT `MapLeaf_ibfk_1` FOREIGN KEY (`TreeId`) REFERENCES `Trees` (`TreeId`) ON DELETE CASCADE
82) ENGINE=InnoDB DEFAULT CHARSET=latin1;
83/*!40101 SET character_set_client = @saved_cs_client */;
84
85--
86-- Dumping data for table `MapLeaf`
87--
88
89LOCK TABLES `MapLeaf` WRITE;
90/*!40000 ALTER TABLE `MapLeaf` DISABLE KEYS */;
91/*!40000 ALTER TABLE `MapLeaf` ENABLE KEYS */;
92UNLOCK TABLES;
93
94--
95-- Table structure for table `SequencedLeafData`
96--
97
98DROP TABLE IF EXISTS `SequencedLeafData`;
99/*!40101 SET @saved_cs_client = @@character_set_client */;
100/*!40101 SET character_set_client = utf8 */;
101CREATE TABLE `SequencedLeafData` (
102 `TreeId` bigint(20) NOT NULL,
103 `SequenceNumber` bigint(20) unsigned NOT NULL,
104 `LeafIdentityHash` varbinary(255) NOT NULL,
105 `MerkleLeafHash` varbinary(255) NOT NULL,
106 `IntegrateTimestampNanos` bigint(20) NOT NULL,
107 PRIMARY KEY (`TreeId`,`SequenceNumber`),
108 KEY `TreeId` (`TreeId`,`LeafIdentityHash`),
109 KEY `SequencedLeafMerkleIdx` (`TreeId`,`MerkleLeafHash`),
110 CONSTRAINT `SequencedLeafData_ibfk_1` FOREIGN KEY (`TreeId`) REFERENCES `Trees` (`TreeId`) ON DELETE CASCADE,
111 CONSTRAINT `SequencedLeafData_ibfk_2` FOREIGN KEY (`TreeId`, `LeafIdentityHash`) REFERENCES `LeafData` (`TreeId`, `LeafIdentityHash`) ON DELETE CASCADE
112) ENGINE=InnoDB DEFAULT CHARSET=latin1;
113/*!40101 SET character_set_client = @saved_cs_client */;
114
115--
116-- Dumping data for table `SequencedLeafData`
117--
118
119LOCK TABLES `SequencedLeafData` WRITE;
120/*!40000 ALTER TABLE `SequencedLeafData` DISABLE KEYS */;
121/*!40000 ALTER TABLE `SequencedLeafData` ENABLE KEYS */;
122UNLOCK TABLES;
123
124--
125-- Table structure for table `Subtree`
126--
127
128DROP TABLE IF EXISTS `Subtree`;
129/*!40101 SET @saved_cs_client = @@character_set_client */;
130/*!40101 SET character_set_client = utf8 */;
131CREATE TABLE `Subtree` (
132 `TreeId` bigint(20) NOT NULL,
133 `SubtreeId` varbinary(255) NOT NULL,
134 `Nodes` mediumblob NOT NULL,
135 `SubtreeRevision` int(11) NOT NULL,
136 PRIMARY KEY (`TreeId`,`SubtreeId`,`SubtreeRevision`),
137 CONSTRAINT `Subtree_ibfk_1` FOREIGN KEY (`TreeId`) REFERENCES `Trees` (`TreeId`) ON DELETE CASCADE
138) ENGINE=InnoDB DEFAULT CHARSET=latin1;
139/*!40101 SET character_set_client = @saved_cs_client */;
140
141--
142-- Dumping data for table `Subtree`
143--
144
145LOCK TABLES `Subtree` WRITE;
146/*!40000 ALTER TABLE `Subtree` DISABLE KEYS */;
147/*!40000 ALTER TABLE `Subtree` ENABLE KEYS */;
148UNLOCK TABLES;
149
150--
151-- Table structure for table `TreeControl`
152--
153
154DROP TABLE IF EXISTS `TreeControl`;
155/*!40101 SET @saved_cs_client = @@character_set_client */;
156/*!40101 SET character_set_client = utf8 */;
157CREATE TABLE `TreeControl` (
158 `TreeId` bigint(20) NOT NULL,
159 `SigningEnabled` tinyint(1) NOT NULL,
160 `SequencingEnabled` tinyint(1) NOT NULL,
161 `SequenceIntervalSeconds` int(11) NOT NULL,
162 PRIMARY KEY (`TreeId`),
163 CONSTRAINT `TreeControl_ibfk_1` FOREIGN KEY (`TreeId`) REFERENCES `Trees` (`TreeId`) ON DELETE CASCADE
164) ENGINE=InnoDB DEFAULT CHARSET=latin1;
165/*!40101 SET character_set_client = @saved_cs_client */;
166
167--
168-- Dumping data for table `TreeControl`
169--
170
171LOCK TABLES `TreeControl` WRITE;
172/*!40000 ALTER TABLE `TreeControl` DISABLE KEYS */;
173/*!40000 ALTER TABLE `TreeControl` ENABLE KEYS */;
174UNLOCK TABLES;
175
176--
177-- Table structure for table `TreeHead`
178--
179
180DROP TABLE IF EXISTS `TreeHead`;
181/*!40101 SET @saved_cs_client = @@character_set_client */;
182/*!40101 SET character_set_client = utf8 */;
183CREATE TABLE `TreeHead` (
184 `TreeId` bigint(20) NOT NULL,
185 `TreeHeadTimestamp` bigint(20) NOT NULL,
186 `TreeSize` bigint(20) DEFAULT NULL,
187 `RootHash` varbinary(255) NOT NULL,
188 `RootSignature` varbinary(1024) NOT NULL,
189 `TreeRevision` bigint(20) DEFAULT NULL,
190 PRIMARY KEY (`TreeId`,`TreeHeadTimestamp`),
191 UNIQUE KEY `TreeHeadRevisionIdx` (`TreeId`,`TreeRevision`),
192 CONSTRAINT `TreeHead_ibfk_1` FOREIGN KEY (`TreeId`) REFERENCES `Trees` (`TreeId`) ON DELETE CASCADE
193) ENGINE=InnoDB DEFAULT CHARSET=latin1;
194/*!40101 SET character_set_client = @saved_cs_client */;
195
196--
197-- Dumping data for table `TreeHead`
198--
199
200LOCK TABLES `TreeHead` WRITE;
201/*!40000 ALTER TABLE `TreeHead` DISABLE KEYS */;
202/*!40000 ALTER TABLE `TreeHead` ENABLE KEYS */;
203UNLOCK TABLES;
204
205--
206-- Table structure for table `Trees`
207--
208
209DROP TABLE IF EXISTS `Trees`;
210/*!40101 SET @saved_cs_client = @@character_set_client */;
211/*!40101 SET character_set_client = utf8 */;
212CREATE TABLE `Trees` (
213 `TreeId` bigint(20) NOT NULL,
214 `TreeState` enum('ACTIVE','FROZEN','DRAINING') NOT NULL,
215 `TreeType` enum('LOG','MAP','PREORDERED_LOG') NOT NULL,
216 `HashStrategy` enum('RFC6962_SHA256','TEST_MAP_HASHER','OBJECT_RFC6962_SHA256','CONIKS_SHA512_256','CONIKS_SHA256') NOT NULL,
217 `HashAlgorithm` enum('SHA256') NOT NULL,
218 `SignatureAlgorithm` enum('ECDSA','RSA') NOT NULL,
219 `DisplayName` varchar(20) DEFAULT NULL,
220 `Description` varchar(200) DEFAULT NULL,
221 `CreateTimeMillis` bigint(20) NOT NULL,
222 `UpdateTimeMillis` bigint(20) NOT NULL,
223 `MaxRootDurationMillis` bigint(20) NOT NULL,
224 `PrivateKey` mediumblob NOT NULL,
225 `PublicKey` mediumblob NOT NULL,
226 `Deleted` tinyint(1) DEFAULT NULL,
227 `DeleteTimeMillis` bigint(20) DEFAULT NULL,
228 PRIMARY KEY (`TreeId`)
229) ENGINE=InnoDB DEFAULT CHARSET=latin1;
230/*!40101 SET character_set_client = @saved_cs_client */;
231
232--
233-- Dumping data for table `Trees`
234--
235
236LOCK TABLES `Trees` WRITE;
237/*!40000 ALTER TABLE `Trees` DISABLE KEYS */;
238/*!40000 ALTER TABLE `Trees` ENABLE KEYS */;
239UNLOCK TABLES;
240
241--
242-- Table structure for table `Unsequenced`
243--
244
245DROP TABLE IF EXISTS `Unsequenced`;
246/*!40101 SET @saved_cs_client = @@character_set_client */;
247/*!40101 SET character_set_client = utf8 */;
248CREATE TABLE `Unsequenced` (
249 `TreeId` bigint(20) NOT NULL,
250 `Bucket` int(11) NOT NULL,
251 `LeafIdentityHash` varbinary(255) NOT NULL,
252 `MerkleLeafHash` varbinary(255) NOT NULL,
253 `QueueTimestampNanos` bigint(20) NOT NULL,
254 `QueueID` varbinary(32) DEFAULT NULL,
255 PRIMARY KEY (`TreeId`,`Bucket`,`QueueTimestampNanos`,`LeafIdentityHash`),
256 UNIQUE KEY `QueueID` (`QueueID`)
257) ENGINE=InnoDB DEFAULT CHARSET=latin1;
258/*!40101 SET character_set_client = @saved_cs_client */;
259
260--
261-- Dumping data for table `Unsequenced`
262--
263
264LOCK TABLES `Unsequenced` WRITE;
265/*!40000 ALTER TABLE `Unsequenced` DISABLE KEYS */;
266/*!40000 ALTER TABLE `Unsequenced` ENABLE KEYS */;
267UNLOCK TABLES;
268/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
269
270/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
271/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
272/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
273/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
274/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
275/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
276/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;