From 18f2260e80a3a6e45c2061e3c1f8387d1dff2923 Mon Sep 17 00:00:00 2001 From: Alexis Hernandez Date: Mon, 18 Mar 2019 23:20:49 -0700 Subject: [PATCH] server: Add the block_address_gcs table --- server/conf/evolutions/default/15.sql | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 server/conf/evolutions/default/15.sql diff --git a/server/conf/evolutions/default/15.sql b/server/conf/evolutions/default/15.sql new file mode 100644 index 00000000..1996bc8e --- /dev/null +++ b/server/conf/evolutions/default/15.sql @@ -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;