diff --git a/db/migrations/00017_state_and_storage_ids_use_big_serial.sql b/db/migrations/00017_state_and_storage_ids_use_big_serial.sql new file mode 100644 index 000000000..347484a60 --- /dev/null +++ b/db/migrations/00017_state_and_storage_ids_use_big_serial.sql @@ -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; \ No newline at end of file diff --git a/db/schema.sql b/db/schema.sql index 5a10d391a..2ca0f50d6 100644 --- a/db/schema.sql +++ b/db/schema.sql @@ -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, @@ -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, @@ -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,