2023-02-09 08:42:15 +01:00
|
|
|
-- Origin tx table
|
|
|
|
CREATE TABLE IF NOT EXISTS otx (
|
|
|
|
id INT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
|
|
|
|
tracking_id TEXT NOT NULL,
|
2023-02-12 10:50:43 +01:00
|
|
|
"type" TEXT NOT NULL,
|
2023-02-09 08:42:15 +01:00
|
|
|
raw_tx TEXT NOT NULL,
|
|
|
|
tx_hash TEXT NOT NULL,
|
2023-02-12 10:50:43 +01:00
|
|
|
"from" TEXT NOT NULL,
|
|
|
|
"data" TEXT NOT NULL,
|
2023-02-09 08:42:15 +01:00
|
|
|
gas_price bigint NOT NULL,
|
|
|
|
nonce int NOT NULL,
|
|
|
|
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
2023-02-12 10:50:43 +01:00
|
|
|
);
|
2023-02-09 08:42:15 +01:00
|
|
|
CREATE INDEX IF NOT EXISTS tx_hash_idx ON otx USING hash(tx_hash);
|
2023-02-12 10:50:43 +01:00
|
|
|
CREATE INDEX IF NOT EXISTS from_idx ON otx USING hash("from");
|
2023-02-09 08:42:15 +01:00
|
|
|
|
|
|
|
-- Dispatch status table
|
|
|
|
CREATE TABLE IF NOT EXISTS dispatch (
|
|
|
|
id INT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
|
|
|
|
otx_id INT REFERENCES otx(id),
|
2023-02-12 10:50:43 +01:00
|
|
|
"status" TEXT NOT NULL,
|
2023-02-09 08:42:15 +01:00
|
|
|
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
2023-02-12 10:50:43 +01:00
|
|
|
);
|