2018-12-05 09:35:50 +00:00
|
|
|
-- AUTOGENERATED BY gopkg.in/spacemonkeygo/dbx.v1
|
|
|
|
-- DO NOT EDIT
|
2018-12-18 17:18:42 +00:00
|
|
|
CREATE TABLE accounting_raws (
|
|
|
|
id bigserial NOT NULL,
|
2019-01-16 19:30:33 +00:00
|
|
|
node_id bytea NOT NULL,
|
2018-12-18 17:18:42 +00:00
|
|
|
interval_end_time timestamp with time zone NOT NULL,
|
2019-01-16 19:30:33 +00:00
|
|
|
data_total double precision NOT NULL,
|
2018-12-18 17:18:42 +00:00
|
|
|
data_type integer NOT NULL,
|
|
|
|
created_at timestamp with time zone NOT NULL,
|
|
|
|
PRIMARY KEY ( id )
|
|
|
|
);
|
|
|
|
CREATE TABLE accounting_rollups (
|
|
|
|
id bigserial NOT NULL,
|
2019-01-16 19:30:33 +00:00
|
|
|
node_id bytea NOT NULL,
|
2018-12-18 17:18:42 +00:00
|
|
|
start_time timestamp with time zone NOT NULL,
|
2019-01-16 19:30:33 +00:00
|
|
|
put_total bigint NOT NULL,
|
|
|
|
get_total bigint NOT NULL,
|
|
|
|
get_audit_total bigint NOT NULL,
|
|
|
|
get_repair_total bigint NOT NULL,
|
|
|
|
put_repair_total bigint NOT NULL,
|
|
|
|
at_rest_total double precision NOT NULL,
|
2018-12-18 17:18:42 +00:00
|
|
|
PRIMARY KEY ( id )
|
|
|
|
);
|
|
|
|
CREATE TABLE accounting_timestamps (
|
|
|
|
name text NOT NULL,
|
|
|
|
value timestamp with time zone NOT NULL,
|
|
|
|
PRIMARY KEY ( name )
|
|
|
|
);
|
2018-12-07 09:59:31 +00:00
|
|
|
CREATE TABLE bwagreements (
|
2019-01-09 15:02:03 +00:00
|
|
|
serialnum text NOT NULL,
|
2019-02-01 18:50:12 +00:00
|
|
|
storage_node_id bytea NOT NULL,
|
|
|
|
uplink_id bytea NOT NULL,
|
2019-01-28 21:16:21 +00:00
|
|
|
action bigint NOT NULL,
|
|
|
|
total bigint NOT NULL,
|
2018-12-07 09:59:31 +00:00
|
|
|
created_at timestamp with time zone NOT NULL,
|
2019-01-10 18:30:55 +00:00
|
|
|
expires_at timestamp with time zone NOT NULL,
|
2019-01-28 21:16:21 +00:00
|
|
|
PRIMARY KEY ( serialnum )
|
2018-12-05 09:35:50 +00:00
|
|
|
);
|
2018-12-21 15:11:19 +00:00
|
|
|
CREATE TABLE injuredsegments (
|
2018-12-27 09:56:25 +00:00
|
|
|
id bigserial NOT NULL,
|
2018-12-21 15:11:19 +00:00
|
|
|
info bytea NOT NULL,
|
2018-12-27 09:56:25 +00:00
|
|
|
PRIMARY KEY ( id )
|
2018-12-21 15:11:19 +00:00
|
|
|
);
|
2018-12-10 19:08:45 +00:00
|
|
|
CREATE TABLE irreparabledbs (
|
|
|
|
segmentpath bytea NOT NULL,
|
|
|
|
segmentdetail bytea NOT NULL,
|
|
|
|
pieces_lost_count bigint NOT NULL,
|
|
|
|
seg_damaged_unix_sec bigint NOT NULL,
|
|
|
|
repair_attempt_count bigint NOT NULL,
|
|
|
|
PRIMARY KEY ( segmentpath )
|
|
|
|
);
|
2018-12-14 20:17:30 +00:00
|
|
|
CREATE TABLE nodes (
|
|
|
|
id bytea NOT NULL,
|
|
|
|
audit_success_count bigint NOT NULL,
|
|
|
|
total_audit_count bigint NOT NULL,
|
|
|
|
audit_success_ratio double precision NOT NULL,
|
|
|
|
uptime_success_count bigint NOT NULL,
|
|
|
|
total_uptime_count bigint NOT NULL,
|
|
|
|
uptime_ratio double precision NOT NULL,
|
|
|
|
created_at timestamp with time zone NOT NULL,
|
|
|
|
updated_at timestamp with time zone NOT NULL,
|
|
|
|
PRIMARY KEY ( id )
|
|
|
|
);
|
2018-12-17 20:14:16 +00:00
|
|
|
CREATE TABLE overlay_cache_nodes (
|
2019-01-15 16:08:45 +00:00
|
|
|
node_id bytea NOT NULL,
|
|
|
|
node_type integer NOT NULL,
|
|
|
|
address text NOT NULL,
|
|
|
|
protocol integer NOT NULL,
|
|
|
|
operator_email text NOT NULL,
|
|
|
|
operator_wallet text NOT NULL,
|
|
|
|
free_bandwidth bigint NOT NULL,
|
|
|
|
free_disk bigint NOT NULL,
|
|
|
|
latency_90 bigint NOT NULL,
|
|
|
|
audit_success_ratio double precision NOT NULL,
|
|
|
|
audit_uptime_ratio double precision NOT NULL,
|
|
|
|
audit_count bigint NOT NULL,
|
|
|
|
audit_success_count bigint NOT NULL,
|
|
|
|
uptime_count bigint NOT NULL,
|
|
|
|
uptime_success_count bigint NOT NULL,
|
|
|
|
PRIMARY KEY ( node_id ),
|
|
|
|
UNIQUE ( node_id )
|
2018-12-17 20:14:16 +00:00
|
|
|
);
|
2019-01-16 20:23:28 +00:00
|
|
|
CREATE TABLE projects (
|
|
|
|
id bytea NOT NULL,
|
|
|
|
name text NOT NULL,
|
|
|
|
description text NOT NULL,
|
|
|
|
created_at timestamp with time zone NOT NULL,
|
|
|
|
PRIMARY KEY ( id )
|
|
|
|
);
|
|
|
|
CREATE TABLE users (
|
|
|
|
id bytea NOT NULL,
|
|
|
|
first_name text NOT NULL,
|
|
|
|
last_name text NOT NULL,
|
2019-01-30 15:04:40 +00:00
|
|
|
email text,
|
2019-01-16 20:23:28 +00:00
|
|
|
password_hash bytea NOT NULL,
|
|
|
|
created_at timestamp with time zone NOT NULL,
|
|
|
|
PRIMARY KEY ( id ),
|
|
|
|
UNIQUE ( email )
|
|
|
|
);
|
|
|
|
CREATE TABLE api_keys (
|
|
|
|
id bytea NOT NULL,
|
|
|
|
project_id bytea NOT NULL REFERENCES projects( id ) ON DELETE CASCADE,
|
|
|
|
key bytea NOT NULL,
|
|
|
|
name text NOT NULL,
|
|
|
|
created_at timestamp with time zone NOT NULL,
|
|
|
|
PRIMARY KEY ( id ),
|
|
|
|
UNIQUE ( key ),
|
|
|
|
UNIQUE ( name, project_id )
|
|
|
|
);
|
|
|
|
CREATE TABLE project_members (
|
|
|
|
member_id bytea NOT NULL REFERENCES users( id ) ON DELETE CASCADE,
|
|
|
|
project_id bytea NOT NULL REFERENCES projects( id ) ON DELETE CASCADE,
|
|
|
|
created_at timestamp with time zone NOT NULL,
|
|
|
|
PRIMARY KEY ( member_id, project_id )
|
|
|
|
);
|