forked from cerc-io/ipld-eth-server
cid database table migrations
This commit is contained in:
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
Reference in New Issue
Block a user