OSDN Git Service

fe5c66826544ceaf960dec509cc3efce50544191
[bytom/vapor.git] / docs / federation / federation.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 DROP DATABASE `federation`;
10
11 CREATE SCHEMA IF NOT EXISTS `federation`;
12
13 USE `federation`;
14
15
16 # Dump of table chains
17 # ------------------------------------------------------------
18
19 CREATE TABLE `chains` (
20   `id` tinyint(1) NOT NULL AUTO_INCREMENT,
21   `name` varchar(64) NOT NULL,
22   `block_height` int(11) DEFAULT '0',
23   `block_hash` char(64) NOT NULL,
24   `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
25   `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
26   PRIMARY KEY (`id`),
27   UNIQUE KEY `name` (`name`),
28   UNIQUE KEY `block_hash` (`block_hash`)
29 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
30
31 LOCK TABLES `chains` WRITE;
32 /*!40000 ALTER TABLE `chains` DISABLE KEYS */;
33
34 INSERT INTO `chains`
35 (`id`, `name`, `block_height`, `block_hash`, `created_at`, `updated_at`)
36 VALUES
37 (1,'bytom',0,'a75483474799ea1aa6bb910a1a5025b4372bf20bef20f246a2c2dc5e12e8a053','2018-09-13 05:10:43','2018-11-27 09:42:06');
38
39 /*!40000 ALTER TABLE `chains` ENABLE KEYS */;
40 UNLOCK TABLES;
41
42
43 # Dump of table cross_transactions
44 # ------------------------------------------------------------
45
46 CREATE TABLE `cross_transactions` (
47   `id` int(11) NOT NULL AUTO_INCREMENT,
48   `chain_id` tinyint(1) NOT NULL,
49   `source_block_height` int(11) NOT NULL,
50   `source_block_hash` char(64) NOT NULL,
51   `source_tx_index` int(11) NOT NULL,
52   `source_mux_id` char(64) NOT NULL,
53   `source_tx_hash` char(64) NOT NULL,
54   `source_raw_transaction` mediumtext NOT NULL,
55   `dest_block_height` int(11) DEFAULT NULL,
56   `dest_block_hash` char(64) DEFAULT NULL,
57   `dest_tx_index` int(11) DEFAULT NULL,
58   `dest_tx_hash` char(64) DEFAULT NULL,
59   `status` tinyint(1) DEFAULT '0',
60   `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
61   `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
62   PRIMARY KEY (`id`),
63   UNIQUE KEY `source_mux_id` (`chain_id`,`source_mux_id`),
64   UNIQUE KEY `source_tx_hash` (`chain_id`,`source_tx_hash`),
65   UNIQUE KEY `source_blockhash_txidx` (`chain_id`,`source_block_hash`,`source_tx_index`),
66   UNIQUE KEY `source_blockheight_txidx` (`chain_id`,`source_block_height`,`source_tx_index`),
67   UNIQUE KEY `dest_tx_hash` (`chain_id`,`dest_tx_hash`),
68   UNIQUE KEY `dest_blockhash_txidx` (`chain_id`,`dest_block_hash`,`dest_tx_index`),
69   UNIQUE KEY `dest_blockheight_txidx` (`chain_id`,`dest_block_height`,`dest_tx_index`),
70   CONSTRAINT `cross_transactions_ibfk_1` FOREIGN KEY (`chain_id`) REFERENCES `chains` (`id`)
71 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
72
73 LOCK TABLES `cross_transactions` WRITE;
74 UNLOCK TABLES;
75
76
77 # Dump of table cross_transaction_reqs
78 # ------------------------------------------------------------
79 CREATE TABLE `cross_transaction_reqs` (
80   `id` int(11) NOT NULL AUTO_INCREMENT,
81   `cross_transaction_id` int(11) NOT NULL,
82   `source_pos` int(11) NOT NULL,
83   `asset_id` int(11) NOT NULL,
84   `asset_amount` bigint(20) DEFAULT '0',
85   `script` varchar(128) NOT NULL,
86   `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
87   `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
88   PRIMARY KEY (`id`),
89   UNIQUE KEY `req_id` (`cross_transaction_id`,`source_pos`),
90   CONSTRAINT `cross_transaction_reqs_ibfk_1` FOREIGN KEY (`cross_transaction_id`) REFERENCES `cross_transactions` (`id`),
91   CONSTRAINT `cross_transaction_reqs_ibfk_2` FOREIGN KEY (`asset_id`) REFERENCES `assets` (`id`)
92 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
93
94 LOCK TABLES `cross_transaction_reqs` WRITE;
95 UNLOCK TABLES;
96
97
98 # Dump of table assets
99 # ------------------------------------------------------------
100
101 CREATE TABLE `assets` (
102   `id` int(11) NOT NULL AUTO_INCREMENT,
103   `asset_id` varchar(64) NOT NULL,
104   `issuance_program` varchar(64) NOT NULL,
105   `vm_version` int(11) NOT NULL DEFAULT '1',
106   `raw_definition_byte` text,
107   `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
108   `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
109   PRIMARY KEY (`id`),
110   UNIQUE KEY `asset_id` (`asset_id`)
111 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
112
113 LOCK TABLES `assets` WRITE;
114 /*!40000 ALTER TABLE `assets` DISABLE KEYS */;
115
116 INSERT INTO `assets` (`id`, `asset_id`, `issuance_program`, `vm_version`, `raw_definition_byte`, `created_at`, `updated_at`)
117 VALUES
118   (1,'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff','',1,'7b0a202022646563696d616c73223a20382c0a2020226465736372697074696f6e223a20224279746f6d204f6666696369616c204973737565222c0a2020226e616d65223a202242544d222c0a20202273796d626f6c223a202242544d220a7d','2018-09-13 05:10:43','2018-11-27 09:43:35');
119
120 /*!40000 ALTER TABLE `assets` ENABLE KEYS */;
121 UNLOCK TABLES;