From 6e0f033078b3ed6687981ff8340e33ac5721b9db Mon Sep 17 00:00:00 2001 From: Edvard Date: Mon, 18 Feb 2019 15:16:59 +0100 Subject: [PATCH] Add migrations for cat storage tables --- ...190215160236_create_cat_storage_tables.sql | 106 ++++ db/schema.sql | 571 ++++++++++++++++++ 2 files changed, 677 insertions(+) create mode 100644 db/migrations/20190215160236_create_cat_storage_tables.sql diff --git a/db/migrations/20190215160236_create_cat_storage_tables.sql b/db/migrations/20190215160236_create_cat_storage_tables.sql new file mode 100644 index 00000000..ea0224e9 --- /dev/null +++ b/db/migrations/20190215160236_create_cat_storage_tables.sql @@ -0,0 +1,106 @@ +-- +goose Up +CREATE TABLE maker.cat_nflip ( + id SERIAL PRIMARY KEY, + block_number BIGINT, + block_hash TEXT, + nflip NUMERIC NOT NULL +); + +CREATE TABLE maker.cat_live ( + id SERIAL PRIMARY KEY, + block_number BIGINT, + block_hash TEXT, + live NUMERIC NOT NULL +); + +CREATE TABLE maker.cat_vat ( + id SERIAL PRIMARY KEY, + block_number BIGINT, + block_hash TEXT, + vat TEXT +); + +CREATE TABLE maker.cat_pit ( + id SERIAL PRIMARY KEY, + block_number BIGINT, + block_hash TEXT, + pit TEXT +); + +CREATE TABLE maker.cat_vow ( + id SERIAL PRIMARY KEY, + block_number BIGINT, + block_hash TEXT, + vow TEXT +); + +CREATE TABLE maker.cat_ilk_flip ( + id SERIAL PRIMARY KEY, + block_number BIGINT, + block_hash TEXT, + ilk TEXT, + flip TEXT +); + +CREATE TABLE maker.cat_ilk_chop ( + id SERIAL PRIMARY KEY, + block_number BIGINT, + block_hash TEXT, + ilk TEXT, + chop NUMERIC NOT NULL +); + +CREATE TABLE maker.cat_ilk_lump ( + id SERIAL PRIMARY KEY, + block_number BIGINT, + block_hash TEXT, + ilk TEXT, + lump NUMERIC NOT NULL +); + +CREATE TABLE maker.cat_flip_ilk ( + id SERIAL PRIMARY KEY, + block_number BIGINT, + block_hash TEXT, + nflip NUMERIC NOT NULL, + ilk TEXT +); + +CREATE TABLE maker.cat_flip_urn ( + id SERIAL PRIMARY KEY, + block_number BIGINT, + block_hash TEXT, + nflip NUMERIC NOT NULL, + urn TEXT +); + +CREATE TABLE maker.cat_flip_ink ( + id SERIAL PRIMARY KEY, + block_number BIGINT, + block_hash TEXT, + nflip NUMERIC NOT NULL, + ink NUMERIC NOT NULL +); + +CREATE TABLE maker.cat_flip_tab ( + id SERIAL PRIMARY KEY, + block_number BIGINT, + block_hash TEXT, + nflip NUMERIC NOT NULL, + tab NUMERIC NOT NULL +); + + +-- +goose Down +DROP TABLE maker.cat_nflip; +DROP TABLE maker.cat_live; +DROP TABLE maker.cat_vat; +DROP TABLE maker.cat_pit; +DROP TABLE maker.cat_vow; +DROP TABLE maker.cat_ilk_flip; +DROP TABLE maker.cat_ilk_chop; +DROP TABLE maker.cat_ilk_lump; +DROP TABLE maker.cat_flip_ilk; +DROP TABLE maker.cat_flip_urn; +DROP TABLE maker.cat_flip_ink; +DROP TABLE maker.cat_flip_tab; \ No newline at end of file diff --git a/db/schema.sql b/db/schema.sql index 46f37118..a3c74de9 100644 --- a/db/schema.sql +++ b/db/schema.sql @@ -204,6 +204,397 @@ CREATE SEQUENCE maker.cat_file_pit_vow_id_seq ALTER SEQUENCE maker.cat_file_pit_vow_id_seq OWNED BY maker.cat_file_pit_vow.id; +-- +-- Name: cat_flip_ilk; Type: TABLE; Schema: maker; Owner: - +-- + +CREATE TABLE maker.cat_flip_ilk ( + id integer NOT NULL, + block_number bigint, + block_hash text, + nflip numeric NOT NULL, + ilk text +); + + +-- +-- Name: cat_flip_ilk_id_seq; Type: SEQUENCE; Schema: maker; Owner: - +-- + +CREATE SEQUENCE maker.cat_flip_ilk_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: cat_flip_ilk_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - +-- + +ALTER SEQUENCE maker.cat_flip_ilk_id_seq OWNED BY maker.cat_flip_ilk.id; + + +-- +-- Name: cat_flip_ink; Type: TABLE; Schema: maker; Owner: - +-- + +CREATE TABLE maker.cat_flip_ink ( + id integer NOT NULL, + block_number bigint, + block_hash text, + nflip numeric NOT NULL, + ink numeric NOT NULL +); + + +-- +-- Name: cat_flip_ink_id_seq; Type: SEQUENCE; Schema: maker; Owner: - +-- + +CREATE SEQUENCE maker.cat_flip_ink_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: cat_flip_ink_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - +-- + +ALTER SEQUENCE maker.cat_flip_ink_id_seq OWNED BY maker.cat_flip_ink.id; + + +-- +-- Name: cat_flip_tab; Type: TABLE; Schema: maker; Owner: - +-- + +CREATE TABLE maker.cat_flip_tab ( + id integer NOT NULL, + block_number bigint, + block_hash text, + nflip numeric NOT NULL, + tab numeric NOT NULL +); + + +-- +-- Name: cat_flip_tab_id_seq; Type: SEQUENCE; Schema: maker; Owner: - +-- + +CREATE SEQUENCE maker.cat_flip_tab_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: cat_flip_tab_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - +-- + +ALTER SEQUENCE maker.cat_flip_tab_id_seq OWNED BY maker.cat_flip_tab.id; + + +-- +-- Name: cat_flip_urn; Type: TABLE; Schema: maker; Owner: - +-- + +CREATE TABLE maker.cat_flip_urn ( + id integer NOT NULL, + block_number bigint, + block_hash text, + nflip numeric NOT NULL, + urn text +); + + +-- +-- Name: cat_flip_urn_id_seq; Type: SEQUENCE; Schema: maker; Owner: - +-- + +CREATE SEQUENCE maker.cat_flip_urn_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: cat_flip_urn_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - +-- + +ALTER SEQUENCE maker.cat_flip_urn_id_seq OWNED BY maker.cat_flip_urn.id; + + +-- +-- Name: cat_ilk_chop; Type: TABLE; Schema: maker; Owner: - +-- + +CREATE TABLE maker.cat_ilk_chop ( + id integer NOT NULL, + block_number bigint, + block_hash text, + ilk text, + chop numeric NOT NULL +); + + +-- +-- Name: cat_ilk_chop_id_seq; Type: SEQUENCE; Schema: maker; Owner: - +-- + +CREATE SEQUENCE maker.cat_ilk_chop_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: cat_ilk_chop_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - +-- + +ALTER SEQUENCE maker.cat_ilk_chop_id_seq OWNED BY maker.cat_ilk_chop.id; + + +-- +-- Name: cat_ilk_flip; Type: TABLE; Schema: maker; Owner: - +-- + +CREATE TABLE maker.cat_ilk_flip ( + id integer NOT NULL, + block_number bigint, + block_hash text, + ilk text, + flip text +); + + +-- +-- Name: cat_ilk_flip_id_seq; Type: SEQUENCE; Schema: maker; Owner: - +-- + +CREATE SEQUENCE maker.cat_ilk_flip_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: cat_ilk_flip_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - +-- + +ALTER SEQUENCE maker.cat_ilk_flip_id_seq OWNED BY maker.cat_ilk_flip.id; + + +-- +-- Name: cat_ilk_lump; Type: TABLE; Schema: maker; Owner: - +-- + +CREATE TABLE maker.cat_ilk_lump ( + id integer NOT NULL, + block_number bigint, + block_hash text, + ilk text, + lump numeric NOT NULL +); + + +-- +-- Name: cat_ilk_lump_id_seq; Type: SEQUENCE; Schema: maker; Owner: - +-- + +CREATE SEQUENCE maker.cat_ilk_lump_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: cat_ilk_lump_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - +-- + +ALTER SEQUENCE maker.cat_ilk_lump_id_seq OWNED BY maker.cat_ilk_lump.id; + + +-- +-- Name: cat_live; Type: TABLE; Schema: maker; Owner: - +-- + +CREATE TABLE maker.cat_live ( + id integer NOT NULL, + block_number bigint, + block_hash text, + live numeric NOT NULL +); + + +-- +-- Name: cat_live_id_seq; Type: SEQUENCE; Schema: maker; Owner: - +-- + +CREATE SEQUENCE maker.cat_live_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: cat_live_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - +-- + +ALTER SEQUENCE maker.cat_live_id_seq OWNED BY maker.cat_live.id; + + +-- +-- Name: cat_nflip; Type: TABLE; Schema: maker; Owner: - +-- + +CREATE TABLE maker.cat_nflip ( + id integer NOT NULL, + block_number bigint, + block_hash text, + nflip numeric NOT NULL +); + + +-- +-- Name: cat_nflip_id_seq; Type: SEQUENCE; Schema: maker; Owner: - +-- + +CREATE SEQUENCE maker.cat_nflip_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: cat_nflip_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - +-- + +ALTER SEQUENCE maker.cat_nflip_id_seq OWNED BY maker.cat_nflip.id; + + +-- +-- Name: cat_pit; Type: TABLE; Schema: maker; Owner: - +-- + +CREATE TABLE maker.cat_pit ( + id integer NOT NULL, + block_number bigint, + block_hash text, + pit text +); + + +-- +-- Name: cat_pit_id_seq; Type: SEQUENCE; Schema: maker; Owner: - +-- + +CREATE SEQUENCE maker.cat_pit_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: cat_pit_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - +-- + +ALTER SEQUENCE maker.cat_pit_id_seq OWNED BY maker.cat_pit.id; + + +-- +-- Name: cat_vat; Type: TABLE; Schema: maker; Owner: - +-- + +CREATE TABLE maker.cat_vat ( + id integer NOT NULL, + block_number bigint, + block_hash text, + vat text +); + + +-- +-- Name: cat_vat_id_seq; Type: SEQUENCE; Schema: maker; Owner: - +-- + +CREATE SEQUENCE maker.cat_vat_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: cat_vat_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - +-- + +ALTER SEQUENCE maker.cat_vat_id_seq OWNED BY maker.cat_vat.id; + + +-- +-- Name: cat_vow; Type: TABLE; Schema: maker; Owner: - +-- + +CREATE TABLE maker.cat_vow ( + id integer NOT NULL, + block_number bigint, + block_hash text, + vow text +); + + +-- +-- Name: cat_vow_id_seq; Type: SEQUENCE; Schema: maker; Owner: - +-- + +CREATE SEQUENCE maker.cat_vow_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: cat_vow_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - +-- + +ALTER SEQUENCE maker.cat_vow_id_seq OWNED BY maker.cat_vow.id; + + -- -- Name: deal; Type: TABLE; Schema: maker; Owner: - -- @@ -2440,6 +2831,90 @@ ALTER TABLE ONLY maker.cat_file_flip ALTER COLUMN id SET DEFAULT nextval('maker. ALTER TABLE ONLY maker.cat_file_pit_vow ALTER COLUMN id SET DEFAULT nextval('maker.cat_file_pit_vow_id_seq'::regclass); +-- +-- Name: cat_flip_ilk id; Type: DEFAULT; Schema: maker; Owner: - +-- + +ALTER TABLE ONLY maker.cat_flip_ilk ALTER COLUMN id SET DEFAULT nextval('maker.cat_flip_ilk_id_seq'::regclass); + + +-- +-- Name: cat_flip_ink id; Type: DEFAULT; Schema: maker; Owner: - +-- + +ALTER TABLE ONLY maker.cat_flip_ink ALTER COLUMN id SET DEFAULT nextval('maker.cat_flip_ink_id_seq'::regclass); + + +-- +-- Name: cat_flip_tab id; Type: DEFAULT; Schema: maker; Owner: - +-- + +ALTER TABLE ONLY maker.cat_flip_tab ALTER COLUMN id SET DEFAULT nextval('maker.cat_flip_tab_id_seq'::regclass); + + +-- +-- Name: cat_flip_urn id; Type: DEFAULT; Schema: maker; Owner: - +-- + +ALTER TABLE ONLY maker.cat_flip_urn ALTER COLUMN id SET DEFAULT nextval('maker.cat_flip_urn_id_seq'::regclass); + + +-- +-- Name: cat_ilk_chop id; Type: DEFAULT; Schema: maker; Owner: - +-- + +ALTER TABLE ONLY maker.cat_ilk_chop ALTER COLUMN id SET DEFAULT nextval('maker.cat_ilk_chop_id_seq'::regclass); + + +-- +-- Name: cat_ilk_flip id; Type: DEFAULT; Schema: maker; Owner: - +-- + +ALTER TABLE ONLY maker.cat_ilk_flip ALTER COLUMN id SET DEFAULT nextval('maker.cat_ilk_flip_id_seq'::regclass); + + +-- +-- Name: cat_ilk_lump id; Type: DEFAULT; Schema: maker; Owner: - +-- + +ALTER TABLE ONLY maker.cat_ilk_lump ALTER COLUMN id SET DEFAULT nextval('maker.cat_ilk_lump_id_seq'::regclass); + + +-- +-- Name: cat_live id; Type: DEFAULT; Schema: maker; Owner: - +-- + +ALTER TABLE ONLY maker.cat_live ALTER COLUMN id SET DEFAULT nextval('maker.cat_live_id_seq'::regclass); + + +-- +-- Name: cat_nflip id; Type: DEFAULT; Schema: maker; Owner: - +-- + +ALTER TABLE ONLY maker.cat_nflip ALTER COLUMN id SET DEFAULT nextval('maker.cat_nflip_id_seq'::regclass); + + +-- +-- Name: cat_pit id; Type: DEFAULT; Schema: maker; Owner: - +-- + +ALTER TABLE ONLY maker.cat_pit ALTER COLUMN id SET DEFAULT nextval('maker.cat_pit_id_seq'::regclass); + + +-- +-- Name: cat_vat id; Type: DEFAULT; Schema: maker; Owner: - +-- + +ALTER TABLE ONLY maker.cat_vat ALTER COLUMN id SET DEFAULT nextval('maker.cat_vat_id_seq'::regclass); + + +-- +-- Name: cat_vow id; Type: DEFAULT; Schema: maker; Owner: - +-- + +ALTER TABLE ONLY maker.cat_vow ALTER COLUMN id SET DEFAULT nextval('maker.cat_vow_id_seq'::regclass); + + -- -- Name: deal id; Type: DEFAULT; Schema: maker; Owner: - -- @@ -2938,6 +3413,102 @@ ALTER TABLE ONLY maker.cat_file_pit_vow ADD CONSTRAINT cat_file_pit_vow_pkey PRIMARY KEY (id); +-- +-- Name: cat_flip_ilk cat_flip_ilk_pkey; Type: CONSTRAINT; Schema: maker; Owner: - +-- + +ALTER TABLE ONLY maker.cat_flip_ilk + ADD CONSTRAINT cat_flip_ilk_pkey PRIMARY KEY (id); + + +-- +-- Name: cat_flip_ink cat_flip_ink_pkey; Type: CONSTRAINT; Schema: maker; Owner: - +-- + +ALTER TABLE ONLY maker.cat_flip_ink + ADD CONSTRAINT cat_flip_ink_pkey PRIMARY KEY (id); + + +-- +-- Name: cat_flip_tab cat_flip_tab_pkey; Type: CONSTRAINT; Schema: maker; Owner: - +-- + +ALTER TABLE ONLY maker.cat_flip_tab + ADD CONSTRAINT cat_flip_tab_pkey PRIMARY KEY (id); + + +-- +-- Name: cat_flip_urn cat_flip_urn_pkey; Type: CONSTRAINT; Schema: maker; Owner: - +-- + +ALTER TABLE ONLY maker.cat_flip_urn + ADD CONSTRAINT cat_flip_urn_pkey PRIMARY KEY (id); + + +-- +-- Name: cat_ilk_chop cat_ilk_chop_pkey; Type: CONSTRAINT; Schema: maker; Owner: - +-- + +ALTER TABLE ONLY maker.cat_ilk_chop + ADD CONSTRAINT cat_ilk_chop_pkey PRIMARY KEY (id); + + +-- +-- Name: cat_ilk_flip cat_ilk_flip_pkey; Type: CONSTRAINT; Schema: maker; Owner: - +-- + +ALTER TABLE ONLY maker.cat_ilk_flip + ADD CONSTRAINT cat_ilk_flip_pkey PRIMARY KEY (id); + + +-- +-- Name: cat_ilk_lump cat_ilk_lump_pkey; Type: CONSTRAINT; Schema: maker; Owner: - +-- + +ALTER TABLE ONLY maker.cat_ilk_lump + ADD CONSTRAINT cat_ilk_lump_pkey PRIMARY KEY (id); + + +-- +-- Name: cat_live cat_live_pkey; Type: CONSTRAINT; Schema: maker; Owner: - +-- + +ALTER TABLE ONLY maker.cat_live + ADD CONSTRAINT cat_live_pkey PRIMARY KEY (id); + + +-- +-- Name: cat_nflip cat_nflip_pkey; Type: CONSTRAINT; Schema: maker; Owner: - +-- + +ALTER TABLE ONLY maker.cat_nflip + ADD CONSTRAINT cat_nflip_pkey PRIMARY KEY (id); + + +-- +-- Name: cat_pit cat_pit_pkey; Type: CONSTRAINT; Schema: maker; Owner: - +-- + +ALTER TABLE ONLY maker.cat_pit + ADD CONSTRAINT cat_pit_pkey PRIMARY KEY (id); + + +-- +-- Name: cat_vat cat_vat_pkey; Type: CONSTRAINT; Schema: maker; Owner: - +-- + +ALTER TABLE ONLY maker.cat_vat + ADD CONSTRAINT cat_vat_pkey PRIMARY KEY (id); + + +-- +-- Name: cat_vow cat_vow_pkey; Type: CONSTRAINT; Schema: maker; Owner: - +-- + +ALTER TABLE ONLY maker.cat_vow + ADD CONSTRAINT cat_vow_pkey PRIMARY KEY (id); + + -- -- Name: deal deal_header_id_tx_idx_log_idx_key; Type: CONSTRAINT; Schema: maker; Owner: - --