forked from Adamant-im/ETH-transactions-storage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate_table.sql
50 lines (41 loc) · 1.09 KB
/
create_table.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
CREATE EXTENSION citext;
CREATE TABLE public.ethtxs
(
"time" integer,
txfrom citext COLLATE pg_catalog."default",
txto citext COLLATE pg_catalog."default",
gas bigint,
gasprice bigint,
block integer,
txhash citext COLLATE pg_catalog."default",
value numeric,
contract_to citext COLLATE pg_catalog."default",
contract_value citext COLLATE pg_catalog."default",
status boolean
);
CREATE TABLE public.aval
(
"status" INTEGER
)
TABLESPACE pg_default;
CREATE INDEX block_index
ON public.ethtxs USING btree
(block)
TABLESPACE pg_default;
CREATE INDEX contract_to_index
ON public.ethtxs USING btree
(contract_to COLLATE pg_catalog."default")
TABLESPACE pg_default;
CREATE INDEX txfrom_index
ON public.ethtxs USING btree
(txfrom COLLATE pg_catalog."default")
TABLESPACE pg_default;
CREATE INDEX txto_index
ON public.ethtxs USING btree
(txto COLLATE pg_catalog."default")
TABLESPACE pg_default;
CREATE VIEW max_block as
SELECT
MAX(block)
FROM public.ethtxs;
INSERT INTO public.aval(status) VALUES (1);