Add vat_move transformer (#47)

* Add vat_move transformer base

* Add vat_move migrations

* Add test data for vat_move

* Add vat_move transformer to initialisers

* Add numeric cast to psql insert of Rad

* Add new db schema

* Dependency update

* Expand abbreviation in repository

* Add test suite for vat_move

* Add header checking to transformer and mock repository

* Remove trailing zero in test data

* Fix minor mishaps

* Go fmt nitpicking

* Refactoring in tests

* Add tests covering checked headers stuff (and fix revealed bugs)

* go fmt fixes

* Implement batching behaviour of transformer

* Small fixes after review

* Go fmt
This commit is contained in:
Edvard Hübinette
2018-10-12 16:13:13 +02:00
committed by GitHub
parent 8fe92edd26
commit be58dd4ac8
23 changed files with 1163 additions and 19 deletions
@@ -0,0 +1,3 @@
DROP TABLE maker.vat_move;
ALTER TABLE public.checked_headers
DROP COLUMN vat_move_checked;
@@ -0,0 +1,13 @@
CREATE TABLE maker.vat_move (
id SERIAL PRIMARY KEY,
header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE,
src TEXT NOT NULL,
dst TEXT NOT NULL,
rad NUMERIC NOT NULL,
tx_idx INTEGER NOT NULL,
raw_log JSONB,
UNIQUE (header_id, tx_idx)
);
ALTER TABLE public.checked_headers
ADD COLUMN vat_move_checked BOOLEAN NOT NULL DEFAULT FALSE;
+67
View File
@@ -838,6 +838,41 @@ CREATE SEQUENCE maker.vat_init_id_seq
ALTER SEQUENCE maker.vat_init_id_seq OWNED BY maker.vat_init.id;
--
-- Name: vat_move; Type: TABLE; Schema: maker; Owner: -
--
CREATE TABLE maker.vat_move (
id integer NOT NULL,
header_id integer NOT NULL,
src text NOT NULL,
dst text NOT NULL,
rad numeric NOT NULL,
tx_idx integer NOT NULL,
raw_log jsonb
);
--
-- Name: vat_move_id_seq; Type: SEQUENCE; Schema: maker; Owner: -
--
CREATE SEQUENCE maker.vat_move_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: vat_move_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: -
--
ALTER SEQUENCE maker.vat_move_id_seq OWNED BY maker.vat_move.id;
--
-- Name: vat_toll; Type: TABLE; Schema: maker; Owner: -
--
@@ -1012,6 +1047,7 @@ CREATE TABLE public.checked_headers (
pit_file_ilk_checked boolean DEFAULT false NOT NULL,
pit_file_stability_fee_checked boolean DEFAULT false NOT NULL,
vat_init_checked boolean DEFAULT false NOT NULL,
vat_move_checked boolean DEFAULT false NOT NULL,
vat_fold_checked boolean DEFAULT false NOT NULL,
vat_heal_checked boolean DEFAULT false NOT NULL,
vat_toll_checked boolean DEFAULT false NOT NULL,
@@ -1491,6 +1527,13 @@ ALTER TABLE ONLY maker.vat_heal ALTER COLUMN id SET DEFAULT nextval('maker.vat_h
ALTER TABLE ONLY maker.vat_init ALTER COLUMN id SET DEFAULT nextval('maker.vat_init_id_seq'::regclass);
--
-- Name: vat_move id; Type: DEFAULT; Schema: maker; Owner: -
--
ALTER TABLE ONLY maker.vat_move ALTER COLUMN id SET DEFAULT nextval('maker.vat_move_id_seq'::regclass);
--
-- Name: vat_toll id; Type: DEFAULT; Schema: maker; Owner: -
--
@@ -1927,6 +1970,22 @@ ALTER TABLE ONLY maker.vat_init
ADD CONSTRAINT vat_init_pkey PRIMARY KEY (id);
--
-- Name: vat_move vat_move_header_id_tx_idx_key; Type: CONSTRAINT; Schema: maker; Owner: -
--
ALTER TABLE ONLY maker.vat_move
ADD CONSTRAINT vat_move_header_id_tx_idx_key UNIQUE (header_id, tx_idx);
--
-- Name: vat_move vat_move_pkey; Type: CONSTRAINT; Schema: maker; Owner: -
--
ALTER TABLE ONLY maker.vat_move
ADD CONSTRAINT vat_move_pkey PRIMARY KEY (id);
--
-- Name: vat_toll vat_toll_header_id_tx_idx_key; Type: CONSTRAINT; Schema: maker; Owner: -
--
@@ -2289,6 +2348,14 @@ ALTER TABLE ONLY maker.vat_init
ADD CONSTRAINT vat_init_header_id_fkey FOREIGN KEY (header_id) REFERENCES public.headers(id) ON DELETE CASCADE;
--
-- Name: vat_move vat_move_header_id_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: -
--
ALTER TABLE ONLY maker.vat_move
ADD CONSTRAINT vat_move_header_id_fkey FOREIGN KEY (header_id) REFERENCES public.headers(id) ON DELETE CASCADE;
--
-- Name: vat_toll vat_toll_header_id_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: -
--