Skip to content
This repository has been archived by the owner on Sep 28, 2021. It is now read-only.

Commit

Permalink
Merge pull request #65 from vulcanize/bigserial
Browse files Browse the repository at this point in the history
use bigints for state and storage cid ids
  • Loading branch information
i-norden authored Oct 19, 2020
2 parents 9b59c8f + 370bdf5 commit 4d0edc4
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
25 changes: 25 additions & 0 deletions db/migrations/00017_state_and_storage_ids_use_big_serial.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
-- +goose Up
ALTER TABLE eth.storage_cids
ALTER COLUMN state_id TYPE BIGINT;

ALTER TABLE eth.state_accounts
ALTER COLUMN state_id TYPE BIGINT;

ALTER TABLE eth.state_cids
ALTER COLUMN id TYPE BIGINT;

ALTER TABLE eth.storage_cids
ALTER COLUMN id TYPE BIGINT;

-- +goose Down
ALTER TABLE eth.storage_cids
ALTER COLUMN id TYPE INTEGER;

ALTER TABLE eth.state_cids
ALTER COLUMN id TYPE INTEGER;

ALTER TABLE eth.state_accounts
ALTER COLUMN state_id TYPE INTEGER;

ALTER TABLE eth.storage_cids
ALTER COLUMN state_id TYPE INTEGER;
8 changes: 4 additions & 4 deletions db/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ ALTER SEQUENCE eth.receipt_cids_id_seq OWNED BY eth.receipt_cids.id;

CREATE TABLE eth.state_accounts (
id integer NOT NULL,
state_id integer NOT NULL,
state_id bigint NOT NULL,
balance numeric NOT NULL,
nonce integer NOT NULL,
code_hash bytea NOT NULL,
Expand Down Expand Up @@ -240,7 +240,7 @@ ALTER SEQUENCE eth.state_accounts_id_seq OWNED BY eth.state_accounts.id;
--

CREATE TABLE eth.state_cids (
id integer NOT NULL,
id bigint NOT NULL,
header_id integer NOT NULL,
state_leaf_key character varying(66),
cid text NOT NULL,
Expand Down Expand Up @@ -276,8 +276,8 @@ ALTER SEQUENCE eth.state_cids_id_seq OWNED BY eth.state_cids.id;
--

CREATE TABLE eth.storage_cids (
id integer NOT NULL,
state_id integer NOT NULL,
id bigint NOT NULL,
state_id bigint NOT NULL,
storage_leaf_key character varying(66),
cid text NOT NULL,
mh_key text NOT NULL,
Expand Down

0 comments on commit 4d0edc4

Please sign in to comment.