Browse Source

server: Add the AMOUNT_TYPE domain to the evolution schema (#35)

prometheus-integration
Alexis Hernandez 7 years ago
parent
commit
6fd6db473b
  1. 3
      server/conf/evolutions/default/1.sql
  2. 4
      server/conf/evolutions/default/3.sql
  3. 4
      server/conf/evolutions/default/4.sql

3
server/conf/evolutions/default/1.sql

@ -23,8 +23,11 @@ CHECK (
VALUE >= 0
);
CREATE DOMAIN AMOUNT_TYPE AS DECIMAL(30, 15);
# --- !Downs
DROP DOMAIN AMOUNT_TYPE;
DROP DOMAIN NON_NEGATIVE_INT_TYPE;
DROP DOMAIN ADDRESS_TYPE;
DROP DOMAIN TXID_TYPE;

4
server/conf/evolutions/default/3.sql

@ -5,8 +5,8 @@
-- simpler queries while requiring addresses and the available amounts.
CREATE TABLE balances(
address ADDRESS_TYPE NOT NULL,
received DECIMAL(30, 15) NOT NULL,
spent DECIMAL(30, 15) NOT NULL,
received AMOUNT_TYPE NOT NULL,
spent AMOUNT_TYPE NOT NULL,
-- constraints
CONSTRAINT balances_address_pk PRIMARY KEY (address)
);

4
server/conf/evolutions/default/4.sql

@ -18,7 +18,7 @@ CREATE INDEX transactions_time_index ON transactions USING BTREE (time);
CREATE TABLE transaction_outputs(
txid TXID_TYPE NOT NULL,
index NON_NEGATIVE_INT_TYPE NOT NULL,
value DECIMAL(30, 15) NOT NULL,
value AMOUNT_TYPE NOT NULL,
address ADDRESS_TYPE NOT NULL,
hex_script TEXT NOT NULL,
spent_on TXID_TYPE NULL,
@ -39,7 +39,7 @@ CREATE TABLE transaction_inputs(
index NON_NEGATIVE_INT_TYPE NOT NULL,
from_txid TXID_TYPE NOT NULL,
from_output_index NON_NEGATIVE_INT_TYPE NOT NULL,
value DECIMAL(30, 15) NULL,
value AMOUNT_TYPE NULL,
address ADDRESS_TYPE NULL,
-- constraints
CONSTRAINT transaction_inputs_txid_index_pk PRIMARY KEY (txid, index),

Loading…
Cancel
Save