cid database table migrations
This commit is contained in:
parent
1921c06b02
commit
e033eabc28
11
db/migrations/00028_create_header_cids_table.sql
Normal file
11
db/migrations/00028_create_header_cids_table.sql
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
-- +goose Up
|
||||||
|
CREATE TABLE public.header_cids (
|
||||||
|
id SERIAL PRIMARY KEY,
|
||||||
|
block_number BIGINT NOT NULL,
|
||||||
|
block_hash VARCHAR(66) NOT NULL,
|
||||||
|
cid TEXT NOT NULL,
|
||||||
|
UNIQUE (block_number, block_hash)
|
||||||
|
);
|
||||||
|
|
||||||
|
-- +goose Down
|
||||||
|
DROP TABLE public.header_cids;
|
11
db/migrations/00029_create_transaction_cids_table.sql
Normal file
11
db/migrations/00029_create_transaction_cids_table.sql
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
-- +goose Up
|
||||||
|
CREATE TABLE public.transaction_cids (
|
||||||
|
id SERIAL PRIMARY KEY,
|
||||||
|
header_id INTEGER NOT NULL REFERENCES header_cids (id) ON DELETE CASCADE,
|
||||||
|
tx_hash VARCHAR(66) NOT NULL,
|
||||||
|
cid TEXT NOT NULL,
|
||||||
|
UNIQUE (header_id, tx_hash)
|
||||||
|
);
|
||||||
|
|
||||||
|
-- +goose Down
|
||||||
|
DROP TABLE public.transaction_cids;
|
9
db/migrations/00030_create_receipt_cids_table.sql
Normal file
9
db/migrations/00030_create_receipt_cids_table.sql
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
-- +goose Up
|
||||||
|
CREATE TABLE public.receipt_cids (
|
||||||
|
id SERIAL PRIMARY KEY,
|
||||||
|
tx_id INTEGER NOT NULL REFERENCES transaction_cids (id) ON DELETE CASCADE,
|
||||||
|
cid TEXT NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
-- +goose Down
|
||||||
|
DROP TABLE public.receipt_cids;
|
11
db/migrations/00031_create_state_cids_table.sql
Normal file
11
db/migrations/00031_create_state_cids_table.sql
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
-- +goose Up
|
||||||
|
CREATE TABLE public.state_cids (
|
||||||
|
id SERIAL PRIMARY KEY,
|
||||||
|
header_id INTEGER NOT NULL REFERENCES header_cids (id) ON DELETE CASCADE,
|
||||||
|
account_key VARCHAR(66) NOT NULL,
|
||||||
|
cid TEXT NOT NULL,
|
||||||
|
UNIQUE (header_id, account_key)
|
||||||
|
);
|
||||||
|
|
||||||
|
-- +goose Down
|
||||||
|
DROP TABLE public.state_cids;
|
11
db/migrations/00032_create_storage_cids_table.sql
Normal file
11
db/migrations/00032_create_storage_cids_table.sql
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
-- +goose Up
|
||||||
|
CREATE TABLE public.storage_cids (
|
||||||
|
id SERIAL PRIMARY KEY,
|
||||||
|
state_id INTEGER NOT NULL REFERENCES state_cids (id) ON DELETE CASCADE,
|
||||||
|
storage_key VARCHAR(66) NOT NULL,
|
||||||
|
cid TEXT NOT NULL,
|
||||||
|
UNIQUE (state_id, storage_key)
|
||||||
|
);
|
||||||
|
|
||||||
|
-- +goose Down
|
||||||
|
DROP TABLE public.storage_cids;
|
Loading…
Reference in New Issue
Block a user