-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.sql
59 lines (53 loc) · 1.85 KB
/
init.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
USE metro;
CREATE TABLE
wallets (
address CHAR(10) NOT NULL,
pkeyhash CHAR(128) NOT NULL,
balance BIGINT UNSIGNED NOT NULL DEFAULT 0,
firstSeen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP(),
totalin BIGINT UNSIGNED NOT NULL DEFAULT 0,
totalout BIGINT UNSIGNED NOT NULL DEFAULT 0,
locked BOOLEAN NOT NULL DEFAULT FALSE,
flare VARCHAR(24) DEFAULT NULL,
PRIMARY KEY (address)
);
CREATE TABLE
transactions (
uuid CHAR(36) NOT NULL,
amount BIGINT UNSIGNED NOT NULL,
wallet_to CHAR(10) NOT NULL,
wallet_from CHAR(10) NOT NULL,
timestamp DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP(),
metaname VARCHAR(24) DEFAULT NULL,
name VARCHAR (24) DEFAULT NULL,
type ENUM('transfer', 'tax') NOT NULL,
metadata VARCHAR(512) DEFAULT NULL,
PRIMARY KEY (uuid),
state ENUM('completed', 'pending', 'reverted', 'held') NOT NULL DEFAULT 'pending',
);
CREATE TABLE
authlogs (
address CHAR(10) NOT NULL,
ip VARCHAR(16) NOT NULL,
timestamp DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP(),
useragent TEXT NOT NULL
);
CREATE TABLE
names (
address VARCHAR(24) NOT NULL,
owner CHAR(10) NOT NULL,
original_owner CHAR(10) NOT NULL,
registered DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP(),
transferred DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP(),
PRIMARY KEY (address)
);
CREATE TABLE
namehistory (
uuid CHAR(36) NOT NULL,
address VARCHAR(24) NOT NULL,
wallet_to CHAR(10) NOT NULL,
wallet_from char(10) DEFAULT NULL,
timestamp DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP(),
type ENUM('transfer', 'purchase'),
PRIMARY KEY (id)
);