Skip to content

Commit

Permalink
update schema.
Browse files Browse the repository at this point in the history
  • Loading branch information
EthanYuan committed Nov 16, 2023
1 parent a1a2fe6 commit c9597a2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
12 changes: 4 additions & 8 deletions util/indexer-r/resources/create_postgres_table.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
CREATE TABLE block(
id SERIAL PRIMARY KEY,
block_hash BYTEA UNIQUE NOT NULL,
block_hash BYTEA PRIMARY KEY,
block_number BIGINT NOT NULL,
compact_target INTEGER NOT NULL,
parent_hash BYTEA NOT NULL,
Expand Down Expand Up @@ -29,8 +28,7 @@ CREATE TABLE block_association_uncle(
);

CREATE TABLE ckb_transaction(
id SERIAL PRIMARY KEY,
tx_hash BYTEA UNIQUE NOT NULL,
tx_hash BYTEA PRIMARY KEY,
version INTEGER NOT NULL,
input_count SMALLINT NOT NULL,
output_count SMALLINT NOT NULL,
Expand All @@ -53,8 +51,7 @@ CREATE TABLE tx_association_cell_dep(
);

CREATE TABLE output(
id SERIAL PRIMARY KEY,
out_point BYTEA UNIQUE NOT NULL,
out_point BYTEA PRIMARY KEY,
capacity BIGINT NOT NULL,
data BYTEA,
tx_hash BYTEA NOT NULL,
Expand All @@ -69,8 +66,7 @@ CREATE TABLE input(
);

CREATE TABLE script(
id SERIAL PRIMARY KEY,
script_hash BYTEA UNIQUE NOT NULL,
script_hash BYTEA PRIMARY KEY,
script_code_hash BYTEA,
script_args BYTEA,
script_type SMALLINT
Expand Down
12 changes: 4 additions & 8 deletions util/indexer-r/resources/create_sqlite_table.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
CREATE TABLE block(
id INTEGER PRIMARY KEY,
block_hash BLOB UNIQUE NOT NULL,
block_hash BLOB PRIMARY KEY,
block_number BIGINT NOT NULL,
compact_target INT NOT NULL,
parent_hash BLOB NOT NULL,
Expand Down Expand Up @@ -29,8 +28,7 @@ CREATE TABLE block_association_uncle(
);

CREATE TABLE ckb_transaction(
id INTEGER PRIMARY KEY,
tx_hash BLOB UNIQUE NOT NULL,
tx_hash BLOB PRIMARY KEY,
version INT NOT NULL,
input_count SMALLINT NOT NULL,
output_count SMALLINT NOT NULL,
Expand All @@ -53,8 +51,7 @@ CREATE TABLE tx_association_cell_dep(
);

CREATE TABLE output(
id INTEGER PRIMARY KEY,
out_point BLOB UNIQUE NOT NULL,
out_point BLOB PRIMARY KEY,
capacity BIGINT NOT NULL,
data BLOB,
tx_hash BLOB NOT NULL,
Expand All @@ -69,8 +66,7 @@ CREATE TABLE input(
);

CREATE TABLE script(
id INTEGER PRIMARY KEY,
script_hash BLOB UNIQUE NOT NULL,
script_hash BLOB PRIMARY KEY,
script_code_hash BLOB,
script_args BLOB,
script_type SMALLINT
Expand Down

0 comments on commit c9597a2

Please sign in to comment.