-fix SQL
This commit is contained in:
parent
f864d66d93
commit
5828eead70
@ -32,8 +32,8 @@ BEGIN
|
|||||||
',new_status INT4 NOT NULL DEFAULT(0)'
|
',new_status INT4 NOT NULL DEFAULT(0)'
|
||||||
',decision_time INT8 NOT NULL DEFAULT(0)'
|
',decision_time INT8 NOT NULL DEFAULT(0)'
|
||||||
',justification VARCHAR NOT NULL'
|
',justification VARCHAR NOT NULL'
|
||||||
',decider_pub BYTEA PRIMARY KEY CHECK (LENGTH(decider_pub)=32)'
|
',decider_pub BYTEA CHECK (LENGTH(decider_pub)=32)'
|
||||||
',decider_sig BYTEA PRIMARY KEY CHECK (LENGTH(decider_sig)=64)'
|
',decider_sig BYTEA CHECK (LENGTH(decider_sig)=64)'
|
||||||
') %s ;'
|
') %s ;'
|
||||||
,table_name
|
,table_name
|
||||||
,'PARTITION BY HASH (h_payto)'
|
,'PARTITION BY HASH (h_payto)'
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
CREATE TABLE aml_staff
|
CREATE TABLE aml_staff
|
||||||
(aml_staff_uuid BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE
|
(aml_staff_uuid BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE
|
||||||
,decider_pub BYTEA PRIMARY KEY CHECK (LENGTH(decider_pub)=32)
|
,decider_pub BYTEA PRIMARY KEY CHECK (LENGTH(decider_pub)=32)
|
||||||
,master_sig BYTEA PRIMARY KEY CHECK (LENGTH(master_sig)=64)
|
,master_sig BYTEA CHECK (LENGTH(master_sig)=64)
|
||||||
,decider_name VARCHAR NOT NULL
|
,decider_name VARCHAR NOT NULL
|
||||||
,is_active BOOLEAN NOT NULL
|
,is_active BOOLEAN NOT NULL
|
||||||
,last_change INT8 NOT NULL
|
,last_change INT8 NOT NULL
|
||||||
|
@ -51,7 +51,7 @@ COMMENT ON FUNCTION create_table_purse_deletion
|
|||||||
|
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION constrain_table_purse_deletion(
|
CREATE OR REPLACE FUNCTION constrain_table_purse_deletion(
|
||||||
IN partition_suffix VARCHAR
|
IN partition_suffix VARCHAR DEFAULT NULL
|
||||||
)
|
)
|
||||||
RETURNS void
|
RETURNS void
|
||||||
LANGUAGE plpgsql
|
LANGUAGE plpgsql
|
||||||
@ -68,8 +68,7 @@ BEGIN
|
|||||||
END $$;
|
END $$;
|
||||||
|
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION create_table_purse_requests_was_deleted (
|
CREATE OR REPLACE FUNCTION master_table_purse_requests_was_deleted (
|
||||||
IN partition_suffix VARCHAR
|
|
||||||
)
|
)
|
||||||
RETURNS void
|
RETURNS void
|
||||||
LANGUAGE plpgsql
|
LANGUAGE plpgsql
|
||||||
@ -77,18 +76,13 @@ AS $$
|
|||||||
DECLARE
|
DECLARE
|
||||||
table_name VARCHAR DEFAULT 'purse_requests';
|
table_name VARCHAR DEFAULT 'purse_requests';
|
||||||
BEGIN
|
BEGIN
|
||||||
table_name = concat_ws('_', table_name, partition_suffix);
|
|
||||||
EXECUTE FORMAT (
|
EXECUTE FORMAT (
|
||||||
'ALTER TABLE ' || table_name ||
|
'ALTER TABLE exchange.' || table_name ||
|
||||||
' ADD COLUMN'
|
' ADD COLUMN'
|
||||||
' was_deleted BOOLEAN NOT NULL DEFAULT(FALSE)'
|
' was_deleted BOOLEAN NOT NULL DEFAULT(FALSE)'
|
||||||
);
|
);
|
||||||
PERFORM comment_partitioned_column(
|
COMMENT ON COLUMN purse_requests.was_deleted
|
||||||
'TRUE if the purse was explicitly deleted (purse must have an entry in the purse_deletion table)'
|
IS 'TRUE if the purse was explicitly deleted (purse must have an entry in the purse_deletion table)';
|
||||||
,'was_deleted'
|
|
||||||
,table_name
|
|
||||||
,partition_suffix
|
|
||||||
);
|
|
||||||
END $$;
|
END $$;
|
||||||
|
|
||||||
|
|
||||||
@ -111,6 +105,6 @@ INSERT INTO exchange_tables
|
|||||||
,FALSE),
|
,FALSE),
|
||||||
('purse_requests_was_deleted'
|
('purse_requests_was_deleted'
|
||||||
,'exchange-0003'
|
,'exchange-0003'
|
||||||
,'create'
|
,'master'
|
||||||
,TRUE
|
,TRUE
|
||||||
,FALSE);
|
,FALSE);
|
||||||
|
@ -27,6 +27,7 @@ sql_DATA = \
|
|||||||
versioning.sql \
|
versioning.sql \
|
||||||
exchange-0001.sql \
|
exchange-0001.sql \
|
||||||
exchange-0002.sql \
|
exchange-0002.sql \
|
||||||
|
exchange-0003.sql \
|
||||||
drop.sql \
|
drop.sql \
|
||||||
procedures.sql
|
procedures.sql
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ BEGIN;
|
|||||||
|
|
||||||
SELECT _v.unregister_patch('exchange-0001');
|
SELECT _v.unregister_patch('exchange-0001');
|
||||||
SELECT _v.unregister_patch('exchange-0002');
|
SELECT _v.unregister_patch('exchange-0002');
|
||||||
|
SELECT _v.unregister_patch('exchange-0003');
|
||||||
|
|
||||||
DROP SCHEMA exchange CASCADE;
|
DROP SCHEMA exchange CASCADE;
|
||||||
|
|
||||||
|
@ -83,6 +83,19 @@ THEN
|
|||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
|
|
||||||
|
-- Check if purse was deleted, if so, abort and prevent deposit.
|
||||||
|
PERFORM
|
||||||
|
FROM exchange.purse_deletion
|
||||||
|
WHERE purse_pub = in_purse_pub;
|
||||||
|
IF FOUND
|
||||||
|
THEN
|
||||||
|
out_late=TRUE;
|
||||||
|
out_balance_ok=FALSE;
|
||||||
|
out_conflict=FALSE;
|
||||||
|
RETURN;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
|
||||||
-- Debit the coin
|
-- Debit the coin
|
||||||
-- Check and update balance of the coin.
|
-- Check and update balance of the coin.
|
||||||
UPDATE known_coins
|
UPDATE known_coins
|
||||||
|
@ -1276,7 +1276,7 @@ TALER_EXCHANGE_check_keys_current (struct TALER_EXCHANGE_Handle *exchange,
|
|||||||
{
|
{
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||||
"Forcing re-download of all exchange keys\n");
|
"Forcing re-download of all exchange keys\n");
|
||||||
GNUNET_break (GNUNET_YES == force_download);
|
GNUNET_break (force_download);
|
||||||
exchange->state = MHS_INIT;
|
exchange->state = MHS_INIT;
|
||||||
}
|
}
|
||||||
if ( (! force_download) &&
|
if ( (! force_download) &&
|
||||||
|
Loading…
Reference in New Issue
Block a user