Skip to content

Commit

Permalink
server: Add the block_address_gcs table
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexITC committed Mar 19, 2019
1 parent 37cb7ce commit 18f2260
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions server/conf/evolutions/default/15.sql
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;

0 comments on commit 18f2260

Please sign in to comment.