mirror of
https://github.com/scroll-tech/scroll.git
synced 2026-01-14 08:28:02 -05:00
Co-authored-by: colinlyguo <651734127@qq.com> Co-authored-by: zimpha <zimpha@gmail.com> Co-authored-by: HAOYUatHZ <37070449+HAOYUatHZ@users.noreply.github.com> Co-authored-by: HAOYUatHZ <haoyu@protonmail.com>
39 lines
1.1 KiB
SQL
39 lines
1.1 KiB
SQL
-- +goose Up
|
|
-- +goose StatementBegin
|
|
|
|
-- TODO: use foreign key for batch_id?
|
|
-- TODO: why tx_num is bigint?
|
|
create table block_trace
|
|
(
|
|
number BIGINT NOT NULL,
|
|
hash VARCHAR NOT NULL,
|
|
parent_hash VARCHAR NOT NULL,
|
|
trace JSON NOT NULL,
|
|
batch_hash VARCHAR DEFAULT NULL,
|
|
tx_num INTEGER NOT NULL,
|
|
gas_used BIGINT NOT NULL,
|
|
block_timestamp NUMERIC NOT NULL
|
|
);
|
|
|
|
create unique index block_trace_hash_uindex
|
|
on block_trace (hash);
|
|
|
|
create unique index block_trace_number_uindex
|
|
on block_trace (number);
|
|
|
|
create unique index block_trace_parent_uindex
|
|
on block_trace (number, parent_hash);
|
|
|
|
create unique index block_trace_parent_hash_uindex
|
|
on block_trace (hash, parent_hash);
|
|
|
|
create index block_trace_batch_hash_index
|
|
on block_trace (batch_hash);
|
|
|
|
-- +goose StatementEnd
|
|
|
|
-- +goose Down
|
|
-- +goose StatementBegin
|
|
drop table if exists block_trace;
|
|
-- +goose StatementEnd
|