generated from recmo/rust-service-template
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
1,385 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
-- Create ENUM for prover type | ||
CREATE TABLE batches | ||
( | ||
id BIGSERIAL UNIQUE PRIMARY KEY, | ||
next_root BYTEA NOT NULL UNIQUE, | ||
prev_root BYTEA UNIQUE, | ||
created_at TIMESTAMPTZ NOT NULL, | ||
batch_type VARCHAR(50) NOT NULL, | ||
data JSON NOT NULL, | ||
|
||
FOREIGN KEY (prev_root) REFERENCES batches (next_root) ON DELETE CASCADE | ||
); | ||
|
||
CREATE INDEX idx_batches_prev_root ON batches (prev_root); | ||
CREATE UNIQUE INDEX i_single_null_prev_root ON batches ((batches.prev_root IS NULL)) WHERE batches.prev_root IS NULL; | ||
|
||
CREATE TABLE transactions | ||
( | ||
transaction_id VARCHAR(256) NOT NULL UNIQUE PRIMARY KEY, | ||
batch_next_root BYTEA NOT NULL UNIQUE, | ||
created_at TIMESTAMPTZ NOT NULL, | ||
|
||
FOREIGN KEY (batch_next_root) REFERENCES batches (next_root) ON DELETE CASCADE | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.