Add database-level CHECK constraint on account balances

This commit is contained in:
catbref 2020-03-18 18:03:13 +00:00
parent c3d1ecb7e1
commit 544fdbfbe9

View File

@ -928,6 +928,11 @@ public class HSQLDBDatabaseUpdates {
stmt.execute("CREATE INDEX IF NOT EXISTS HistoricAccountBalancesHeightIndex ON HistoricAccountBalances (height)");
break;
case 66:
// Add CHECK constraint to account balances
stmt.execute("ALTER TABLE AccountBalances ADD CONSTRAINT CheckBalanceNotNegative CHECK (balance >= 0)");
break;
default:
// nothing to do
return false;