-
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.
server: Add the block_address_gcs table
- Loading branch information
Showing
1 changed file
with
25 additions
and
0 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,25 @@ | ||
|
||
# --- !Ups | ||
|
||
CREATE DOMAIN HEX_STRING_TYPE AS TEXT | ||
CHECK ( | ||
VALUE ~ '^([a-f0-9][a-f0-9])+$' | ||
); | ||
|
||
-- a golomb-coded sets filter to query for the block addresses | ||
CREATE TABLE block_address_gcs( | ||
blockhash BLOCKHASH_TYPE NOT NULL, | ||
p NON_NEGATIVE_INT_TYPE NOT NULL, | ||
n NON_NEGATIVE_INT_TYPE NOT NULL, | ||
m NON_NEGATIVE_INT_TYPE NOT NULL, | ||
hex HEX_STRING_TYPE NOT NULL, | ||
-- constraints | ||
CONSTRAINT block_address_gcs_blockhash_pk PRIMARY KEY (blockhash), | ||
CONSTRAINT block_address_gcs_blockhash_fk FOREIGN KEY (blockhash) REFERENCES blocks (blockhash) | ||
); | ||
|
||
|
||
# --- !Downs | ||
|
||
DROP TABLE block_address_gcs; | ||
DROP DOMAIN HEX_STRING_TYPE; |