OSDN Git Service

add
[bytom/vapor.git] / docs / precog / sql_dump / precog_shema.sql
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 utf8 */;
5 /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
6 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
7 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
8
9 CREATE SCHEMA IF NOT EXISTS `precog`;
10 DROP DATABASE `precog`;
11 CREATE SCHEMA `precog`;
12
13 USE `precog`;
14
15 # Dump of table chains
16 # ------------------------------------------------------------
17
18 CREATE TABLE `chains` (
19   `id` tinyint(1) NOT NULL AUTO_INCREMENT,
20   `best_height` int(11) DEFAULT '0',
21   `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
22   `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
23   PRIMARY KEY (`id`)
24 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
25
26 LOCK TABLES `chains` WRITE;
27 UNLOCK TABLES;
28
29
30 # Dump of table nodes
31 # ------------------------------------------------------------
32
33 CREATE TABLE `nodes` (
34   `id` int(11) NOT NULL AUTO_INCREMENT,
35   `alias` varchar(128) NOT NULL DEFAULT '',
36   `pub_key` char(128) NOT NULL DEFAULT '',
37   `host` varchar(128) NOT NULL DEFAULT '',
38   `port` smallint unsigned NOT NULL DEFAULT '0',
39   `best_height` int(11) DEFAULT '0',
40   `lantency_ms` int(11) DEFAULT NULL,
41   `status` tinyint(1) NOT NULL DEFAULT '0',
42   `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
43   `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
44   PRIMARY KEY (`id`),
45   UNIQUE KEY `pub_key` (`pub_key`),
46   UNIQUE KEY `host_port` (`host`,`port`)
47 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
48
49 LOCK TABLES `nodes` WRITE;
50 UNLOCK TABLES;
51