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 */;
9 CREATE SCHEMA IF NOT EXISTS `precog`;
10 DROP DATABASE `precog`;
11 CREATE SCHEMA `precog`;
16 # ------------------------------------------------------------
18 CREATE TABLE `nodes` (
19 `id` int(11) NOT NULL AUTO_INCREMENT,
20 `alias` varchar(128) NOT NULL DEFAULT '',
21 `xpub` char(128) NOT NULL DEFAULT '',
22 `public_key` char(64) NOT NULL DEFAULT '',
23 `ip` varchar(128) NOT NULL DEFAULT '',
24 `port` smallint unsigned NOT NULL DEFAULT '0',
25 `best_height` int(11) DEFAULT '0',
26 `latest_daily_uptime_minutes` int(11) DEFAULT '0',
27 `status` tinyint(1) NOT NULL DEFAULT '0',
28 `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
29 `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
31 UNIQUE KEY `public_key` (`public_key`)
32 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
34 LOCK TABLES `nodes` WRITE;
38 # Dump of table node_livenesses
39 # ------------------------------------------------------------
41 CREATE TABLE `node_livenesses` (
42 `id` int(11) NOT NULL AUTO_INCREMENT,
43 `node_id` int(11) NOT NULL,
44 `ping_times` int(11) DEFAULT '0',
45 `pong_times` int(11) DEFAULT '0',
46 `avg_lantency_ms` int(11) DEFAULT NULL,
47 `best_height` int(11) DEFAULT '0',
48 `status` tinyint(1) NOT NULL DEFAULT '0',
49 `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
50 `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
52 CONSTRAINT `node_livenesses_ibfk_1` FOREIGN KEY (`node_id`) REFERENCES `nodes` (`id`)
53 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
55 LOCK TABLES `node_livenesses` WRITE;