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 `precognitive`;
10 DROP DATABASE `precognitive`;
11 CREATE SCHEMA `precognitive`;
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 `avg_rtt_ms` int(11) DEFAULT NULL,
27 `latest_daily_uptime_minutes` int(11) DEFAULT '0',
28 `status` tinyint(1) NOT NULL DEFAULT '0',
29 `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
30 `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
32 UNIQUE KEY `address` (`ip`,`port`)
33 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
35 LOCK TABLES `nodes` WRITE;
39 # Dump of table node_livenesses
40 # ------------------------------------------------------------
42 CREATE TABLE `node_livenesses` (
43 `id` int(11) NOT NULL AUTO_INCREMENT,
44 `node_id` int(11) NOT NULL,
45 `ping_times` int(11) DEFAULT '0',
46 `pong_times` int(11) DEFAULT '0',
47 `best_height` int(11) DEFAULT '0',
48 `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
49 `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
51 CONSTRAINT `node_livenesses_ibfk_1` FOREIGN KEY (`node_id`) REFERENCES `nodes` (`id`)
52 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
54 LOCK TABLES `node_livenesses` WRITE;