Skip to content

Commit

Permalink
create new table to hold tx access list; they reference the transacti…
Browse files Browse the repository at this point in the history
…on_cids entry they belong to
  • Loading branch information
i-norden committed Apr 30, 2021
1 parent b5f61bd commit 3716299
Showing 3 changed files with 291 additions and 36 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@ TEST_CONNECT_STRING = postgresql://$(USER)@$(HOST_NAME):$(PORT)/$(TEST_DB)?sslmo
test: | $(GINKGO)
dropdb --if-exists $(TEST_DB)
createdb $(TEST_DB)
$(GOOSE) -dir db/migrations postgres "$(TEST_CONNECT_STRING)" up
make migrate NAME=$(TEST_DB)
$(GOOSE) -dir db/migrations postgres "$(TEST_CONNECT_STRING)" reset

## Build docker image
15 changes: 15 additions & 0 deletions db/migrations/00023_create_access_list_table.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
-- +goose Up
CREATE TABLE eth.access_list_element (
id SERIAL PRIMARY KEY,
tx_id INTEGER NOT NULL REFERENCES eth.transaction_cids (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
index INTEGER NOT NULL,
address VARCHAR(66),
storage_keys VARCHAR(66)[],
UNIQUE (tx_id, index)
);

CREATE INDEX accesss_list_element_address_index ON eth.access_list_element USING btree (address);

-- +goose Down
DROP INDEX eth.accesss_list_element_address_index;
DROP TABLE eth.access_list_element;
Loading

0 comments on commit 3716299

Please sign in to comment.