diff --git a/mojaloop-technical-overview/central-ledger/assets/database/central-ledger-ddl-MySQLWorkbench.sql b/mojaloop-technical-overview/central-ledger/assets/database/central-ledger-ddl-MySQLWorkbench.sql index 03e206089..aeedea85f 100644 --- a/mojaloop-technical-overview/central-ledger/assets/database/central-ledger-ddl-MySQLWorkbench.sql +++ b/mojaloop-technical-overview/central-ledger/assets/database/central-ledger-ddl-MySQLWorkbench.sql @@ -1,13 +1,13 @@ --- MySQL dump 10.13 Distrib 8.0.16, for macos10.14 (x86_64) +-- MySQL dump 10.13 Distrib 8.0.18, for macos10.14 (x86_64) -- --- Host: 127.0.0.1 Database: central_ledger +-- Host: localhost Database: central_ledger -- ------------------------------------------------------ -- Server version 8.0.13 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; - SET NAMES utf8 ; +/*!50503 SET NAMES utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -21,7 +21,7 @@ DROP TABLE IF EXISTS `amountType`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `amountType` ( `amountTypeId` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(256) NOT NULL, @@ -38,7 +38,7 @@ CREATE TABLE `amountType` ( DROP TABLE IF EXISTS `balanceOfPayments`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `balanceOfPayments` ( `balanceOfPaymentsId` int(10) unsigned NOT NULL, `name` varchar(256) NOT NULL, @@ -55,7 +55,7 @@ CREATE TABLE `balanceOfPayments` ( DROP TABLE IF EXISTS `bulkProcessingState`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `bulkProcessingState` ( `bulkProcessingStateId` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(50) NOT NULL, @@ -73,7 +73,7 @@ CREATE TABLE `bulkProcessingState` ( DROP TABLE IF EXISTS `bulkTransfer`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `bulkTransfer` ( `bulkTransferId` varchar(36) NOT NULL, `bulkQuoteId` varchar(36) DEFAULT NULL, @@ -96,7 +96,7 @@ CREATE TABLE `bulkTransfer` ( DROP TABLE IF EXISTS `bulkTransferAssociation`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `bulkTransferAssociation` ( `bulkTransferAssociationId` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `transferId` varchar(36) NOT NULL, @@ -121,7 +121,7 @@ CREATE TABLE `bulkTransferAssociation` ( DROP TABLE IF EXISTS `bulkTransferDuplicateCheck`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `bulkTransferDuplicateCheck` ( `bulkTransferId` varchar(36) NOT NULL, `hash` varchar(256) NOT NULL, @@ -136,7 +136,7 @@ CREATE TABLE `bulkTransferDuplicateCheck` ( DROP TABLE IF EXISTS `bulkTransferError`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `bulkTransferError` ( `bulkTransferErrorId` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `bulkTransferStateChangeId` bigint(20) unsigned NOT NULL, @@ -155,18 +155,16 @@ CREATE TABLE `bulkTransferError` ( DROP TABLE IF EXISTS `bulkTransferExtension`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `bulkTransferExtension` ( `bulkTransferExtensionId` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `bulkTransferId` varchar(36) NOT NULL, - `bulkTransferFulfilmentId` bigint(20) unsigned DEFAULT NULL, + `isFulfilment` tinyint(1) NOT NULL DEFAULT '0', `key` varchar(128) NOT NULL, `value` text NOT NULL, `createdDate` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`bulkTransferExtensionId`), KEY `bulktransferextension_bulktransferid_index` (`bulkTransferId`), - KEY `bulktransferextension_bulktransferfulfilmentid_index` (`bulkTransferFulfilmentId`), - CONSTRAINT `bulktransferextension_bulktransferfulfilmentid_foreign` FOREIGN KEY (`bulkTransferFulfilmentId`) REFERENCES `bulkTransferFulfilment` (`bulktransferfulfilmentid`), CONSTRAINT `bulktransferextension_bulktransferid_foreign` FOREIGN KEY (`bulkTransferId`) REFERENCES `bulkTransfer` (`bulktransferid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; @@ -177,16 +175,13 @@ CREATE TABLE `bulkTransferExtension` ( DROP TABLE IF EXISTS `bulkTransferFulfilment`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `bulkTransferFulfilment` ( - `bulkTransferFulfilmentId` bigint(20) unsigned NOT NULL, `bulkTransferId` varchar(36) NOT NULL, `completedDate` datetime NOT NULL, `createdDate` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (`bulkTransferFulfilmentId`), - UNIQUE KEY `bulktransferfulfilment_bulktransferid_unique` (`bulkTransferId`), - CONSTRAINT `bulktransferfulfilment_bulktransferfulfilmentid_foreign` FOREIGN KEY (`bulkTransferFulfilmentId`) REFERENCES `bulkTransferFulfilmentDuplicateCheck` (`bulktransferfulfilmentid`), - CONSTRAINT `bulktransferfulfilment_bulktransferid_foreign` FOREIGN KEY (`bulkTransferId`) REFERENCES `bulkTransfer` (`bulktransferid`) + PRIMARY KEY (`bulkTransferId`), + CONSTRAINT `bulktransferfulfilment_bulktransferid_foreign` FOREIGN KEY (`bulkTransferId`) REFERENCES `bulkTransferFulfilmentDuplicateCheck` (`bulktransferid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; @@ -196,14 +191,13 @@ CREATE TABLE `bulkTransferFulfilment` ( DROP TABLE IF EXISTS `bulkTransferFulfilmentDuplicateCheck`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `bulkTransferFulfilmentDuplicateCheck` ( - `bulkTransferFulfilmentId` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `bulkTransferId` varchar(36) NOT NULL, - `hash` varchar(256) DEFAULT NULL, + `hash` varchar(256) NOT NULL, `createdDate` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (`bulkTransferFulfilmentId`), - UNIQUE KEY `bulktransferfulfilmentduplicatecheck_bulktransferid_unique` (`bulkTransferId`) + PRIMARY KEY (`bulkTransferId`), + CONSTRAINT `bulktransferfulfilmentduplicatecheck_bulktransferid_foreign` FOREIGN KEY (`bulkTransferId`) REFERENCES `bulkTransfer` (`bulktransferid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; @@ -213,7 +207,7 @@ CREATE TABLE `bulkTransferFulfilmentDuplicateCheck` ( DROP TABLE IF EXISTS `bulkTransferState`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `bulkTransferState` ( `bulkTransferStateId` varchar(50) NOT NULL, `enumeration` varchar(50) NOT NULL COMMENT 'bulkTransferState associated to the Mojaloop API', @@ -230,7 +224,7 @@ CREATE TABLE `bulkTransferState` ( DROP TABLE IF EXISTS `bulkTransferStateChange`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `bulkTransferStateChange` ( `bulkTransferStateChangeId` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `bulkTransferId` varchar(36) NOT NULL, @@ -251,7 +245,7 @@ CREATE TABLE `bulkTransferStateChange` ( DROP TABLE IF EXISTS `contactType`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `contactType` ( `contactTypeId` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(50) NOT NULL, @@ -269,12 +263,13 @@ CREATE TABLE `contactType` ( DROP TABLE IF EXISTS `currency`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `currency` ( `currencyId` varchar(3) NOT NULL, `name` varchar(128) DEFAULT NULL, `isActive` tinyint(1) NOT NULL DEFAULT '1', `createdDate` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `scale` int(10) unsigned NOT NULL DEFAULT '4', PRIMARY KEY (`currencyId`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; @@ -285,7 +280,7 @@ CREATE TABLE `currency` ( DROP TABLE IF EXISTS `endpointType`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `endpointType` ( `endpointTypeId` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(50) NOT NULL, @@ -294,7 +289,7 @@ CREATE TABLE `endpointType` ( `createdDate` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`endpointTypeId`), UNIQUE KEY `endpointtype_name_unique` (`name`) -) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8; +) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -303,7 +298,7 @@ CREATE TABLE `endpointType` ( DROP TABLE IF EXISTS `event`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `event` ( `eventId` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(128) NOT NULL, @@ -319,7 +314,7 @@ CREATE TABLE `event` ( DROP TABLE IF EXISTS `geoCode`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `geoCode` ( `geoCodeId` int(10) unsigned NOT NULL AUTO_INCREMENT, `quotePartyId` bigint(20) unsigned NOT NULL COMMENT 'Optionally the GeoCode for the Payer/Payee may have been provided. If the Quote Response has the GeoCode for the Payee, an additional row is added', @@ -338,7 +333,7 @@ CREATE TABLE `geoCode` ( DROP TABLE IF EXISTS `ilpPacket`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `ilpPacket` ( `transferId` varchar(36) NOT NULL, `value` text NOT NULL, @@ -354,16 +349,17 @@ CREATE TABLE `ilpPacket` ( DROP TABLE IF EXISTS `ledgerAccountType`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `ledgerAccountType` ( `ledgerAccountTypeId` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(50) NOT NULL, `description` varchar(512) DEFAULT NULL, `isActive` tinyint(1) NOT NULL DEFAULT '1', `createdDate` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `isSettleable` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`ledgerAccountTypeId`), UNIQUE KEY `ledgeraccounttype_name_unique` (`name`) -) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -372,15 +368,18 @@ CREATE TABLE `ledgerAccountType` ( DROP TABLE IF EXISTS `ledgerEntryType`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `ledgerEntryType` ( `ledgerEntryTypeId` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(50) NOT NULL, `description` varchar(512) DEFAULT NULL, `isActive` tinyint(1) NOT NULL DEFAULT '1', `createdDate` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `ledgerAccountTypeId` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`ledgerEntryTypeId`), - UNIQUE KEY `ledgerentrytype_name_unique` (`name`) + UNIQUE KEY `ledgerentrytype_name_unique` (`name`), + KEY `ledgerentrytype_ledgeraccounttypeid_foreign` (`ledgerAccountTypeId`), + CONSTRAINT `ledgerentrytype_ledgeraccounttypeid_foreign` FOREIGN KEY (`ledgerAccountTypeId`) REFERENCES `ledgerAccountType` (`ledgeraccounttypeid`) ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; @@ -390,14 +389,14 @@ CREATE TABLE `ledgerEntryType` ( DROP TABLE IF EXISTS `migration`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `migration` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(255) DEFAULT NULL, `batch` int(11) DEFAULT NULL, `migration_time` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=130 DEFAULT CHARSET=utf8; +) ENGINE=InnoDB AUTO_INCREMENT=153 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -406,7 +405,7 @@ CREATE TABLE `migration` ( DROP TABLE IF EXISTS `migration_lock`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `migration_lock` ( `index` int(10) unsigned NOT NULL AUTO_INCREMENT, `is_locked` int(11) DEFAULT NULL, @@ -420,7 +419,7 @@ CREATE TABLE `migration_lock` ( DROP TABLE IF EXISTS `participant`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `participant` ( `participantId` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(256) NOT NULL, @@ -439,7 +438,7 @@ CREATE TABLE `participant` ( DROP TABLE IF EXISTS `participantContact`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `participantContact` ( `participantContactId` int(10) unsigned NOT NULL AUTO_INCREMENT, `participantId` int(10) unsigned NOT NULL, @@ -463,7 +462,7 @@ CREATE TABLE `participantContact` ( DROP TABLE IF EXISTS `participantCurrency`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `participantCurrency` ( `participantCurrencyId` int(10) unsigned NOT NULL AUTO_INCREMENT, `participantId` int(10) unsigned NOT NULL, @@ -489,7 +488,7 @@ CREATE TABLE `participantCurrency` ( DROP TABLE IF EXISTS `participantEndpoint`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `participantEndpoint` ( `participantEndpointId` int(10) unsigned NOT NULL AUTO_INCREMENT, `participantId` int(10) unsigned NOT NULL, @@ -512,12 +511,12 @@ CREATE TABLE `participantEndpoint` ( DROP TABLE IF EXISTS `participantLimit`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `participantLimit` ( `participantLimitId` int(10) unsigned NOT NULL AUTO_INCREMENT, `participantCurrencyId` int(10) unsigned NOT NULL, `participantLimitTypeId` int(10) unsigned NOT NULL, - `value` decimal(18,2) NOT NULL DEFAULT '0.00', + `value` decimal(18,4) NOT NULL DEFAULT '0.0000', `thresholdAlarmPercentage` decimal(5,2) NOT NULL DEFAULT '10.00', `startAfterParticipantPositionChangeId` bigint(20) unsigned DEFAULT NULL, `isActive` tinyint(1) NOT NULL DEFAULT '1', @@ -539,7 +538,7 @@ CREATE TABLE `participantLimit` ( DROP TABLE IF EXISTS `participantLimitType`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `participantLimitType` ( `participantLimitTypeId` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(50) NOT NULL, @@ -557,7 +556,7 @@ CREATE TABLE `participantLimitType` ( DROP TABLE IF EXISTS `participantParty`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `participantParty` ( `participantPartyId` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `participantId` int(10) unsigned NOT NULL, @@ -575,12 +574,12 @@ CREATE TABLE `participantParty` ( DROP TABLE IF EXISTS `participantPosition`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `participantPosition` ( `participantPositionId` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `participantCurrencyId` int(10) unsigned NOT NULL, - `value` decimal(18,2) NOT NULL, - `reservedValue` decimal(18,2) NOT NULL, + `value` decimal(18,4) NOT NULL, + `reservedValue` decimal(18,4) NOT NULL, `changedDate` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`participantPositionId`), KEY `participantposition_participantcurrencyid_index` (`participantCurrencyId`), @@ -594,13 +593,13 @@ CREATE TABLE `participantPosition` ( DROP TABLE IF EXISTS `participantPositionChange`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `participantPositionChange` ( `participantPositionChangeId` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `participantPositionId` bigint(20) unsigned NOT NULL, `transferStateChangeId` bigint(20) unsigned NOT NULL, - `value` decimal(18,2) NOT NULL, - `reservedValue` decimal(18,2) NOT NULL, + `value` decimal(18,4) NOT NULL, + `reservedValue` decimal(18,4) NOT NULL, `createdDate` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`participantPositionChangeId`), KEY `participantpositionchange_participantpositionid_index` (`participantPositionId`), @@ -616,7 +615,7 @@ CREATE TABLE `participantPositionChange` ( DROP TABLE IF EXISTS `party`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `party` ( `partyId` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `quotePartyId` bigint(20) unsigned NOT NULL, @@ -636,7 +635,7 @@ CREATE TABLE `party` ( DROP TABLE IF EXISTS `partyIdentifierType`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `partyIdentifierType` ( `partyIdentifierTypeId` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(50) NOT NULL, @@ -652,7 +651,7 @@ CREATE TABLE `partyIdentifierType` ( DROP TABLE IF EXISTS `partyType`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `partyType` ( `partyTypeId` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(128) NOT NULL, @@ -668,7 +667,7 @@ CREATE TABLE `partyType` ( DROP TABLE IF EXISTS `quote`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `quote` ( `quoteId` varchar(36) NOT NULL, `transactionReferenceId` varchar(36) NOT NULL COMMENT 'Common ID (decided by the Payer FSP) between the FSPs for the future transaction object', @@ -712,7 +711,7 @@ CREATE TABLE `quote` ( DROP TABLE IF EXISTS `quoteDuplicateCheck`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `quoteDuplicateCheck` ( `quoteId` varchar(36) NOT NULL COMMENT 'Common ID between the FSPs for the quote object, decided by the Payer FSP', `hash` varchar(1024) DEFAULT NULL COMMENT 'hash value received for the quote request', @@ -727,7 +726,7 @@ CREATE TABLE `quoteDuplicateCheck` ( DROP TABLE IF EXISTS `quoteError`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `quoteError` ( `quoteErrorId` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `quoteId` varchar(36) NOT NULL COMMENT 'Common ID between the FSPs for the quote object, decided by the Payer FSP', @@ -749,7 +748,7 @@ CREATE TABLE `quoteError` ( DROP TABLE IF EXISTS `quoteExtension`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `quoteExtension` ( `quoteExtensionId` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `quoteId` varchar(36) NOT NULL COMMENT 'Common ID between the FSPs for the quote object, decided by the Payer FSP', @@ -774,7 +773,7 @@ CREATE TABLE `quoteExtension` ( DROP TABLE IF EXISTS `quoteParty`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `quoteParty` ( `quotePartyId` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `quoteId` varchar(36) NOT NULL COMMENT 'Common ID between the FSPs for the quote object, decided by the Payer FSP', @@ -818,7 +817,7 @@ CREATE TABLE `quoteParty` ( DROP TABLE IF EXISTS `quotePartyView`; /*!50001 DROP VIEW IF EXISTS `quotePartyView`*/; SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8mb4; +/*!50503 SET character_set_client = utf8mb4 */; /*!50001 CREATE VIEW `quotePartyView` AS SELECT 1 AS `quoteId`, 1 AS `quotePartyId`, @@ -843,7 +842,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `quoteResponse`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `quoteResponse` ( `quoteResponseId` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `quoteId` varchar(36) NOT NULL COMMENT 'Common ID between the FSPs for the quote object, decided by the Payer FSP', @@ -877,7 +876,7 @@ CREATE TABLE `quoteResponse` ( DROP TABLE IF EXISTS `quoteResponseDuplicateCheck`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `quoteResponseDuplicateCheck` ( `quoteResponseId` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'The response to the intial quote', `quoteId` varchar(36) NOT NULL COMMENT 'Common ID between the FSPs for the quote object, decided by the Payer FSP', @@ -896,7 +895,7 @@ CREATE TABLE `quoteResponseDuplicateCheck` ( DROP TABLE IF EXISTS `quoteResponseIlpPacket`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `quoteResponseIlpPacket` ( `quoteResponseId` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `value` text NOT NULL COMMENT 'ilpPacket returned from Payee in response to a quote request', @@ -912,7 +911,7 @@ CREATE TABLE `quoteResponseIlpPacket` ( DROP TABLE IF EXISTS `quoteResponseView`; /*!50001 DROP VIEW IF EXISTS `quoteResponseView`*/; SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8mb4; +/*!50503 SET character_set_client = utf8mb4 */; /*!50001 CREATE VIEW `quoteResponseView` AS SELECT 1 AS `quoteResponseId`, 1 AS `quoteId`, @@ -940,7 +939,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `quoteView`; /*!50001 DROP VIEW IF EXISTS `quoteView`*/; SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8mb4; +/*!50503 SET character_set_client = utf8mb4 */; /*!50001 CREATE VIEW `quoteView` AS SELECT 1 AS `quoteId`, 1 AS `transactionReferenceId`, @@ -963,7 +962,7 @@ SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `segment`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `segment` ( `segmentId` int(10) unsigned NOT NULL AUTO_INCREMENT, `segmentType` varchar(50) NOT NULL, @@ -982,15 +981,136 @@ CREATE TABLE `segment` ( DROP TABLE IF EXISTS `settlement`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `settlement` ( `settlementId` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `reason` varchar(512) DEFAULT NULL, `createdDate` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `currentStateChangeId` bigint(20) unsigned DEFAULT NULL, + `settlementModelId` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`settlementId`), KEY `settlement_currentstatechangeid_foreign` (`currentStateChangeId`), - CONSTRAINT `settlement_currentstatechangeid_foreign` FOREIGN KEY (`currentStateChangeId`) REFERENCES `settlementStateChange` (`settlementstatechangeid`) + KEY `settlement_settlementmodelid_foreign` (`settlementModelId`), + CONSTRAINT `settlement_currentstatechangeid_foreign` FOREIGN KEY (`currentStateChangeId`) REFERENCES `settlementStateChange` (`settlementstatechangeid`), + CONSTRAINT `settlement_settlementmodelid_foreign` FOREIGN KEY (`settlementModelId`) REFERENCES `settlementModel` (`settlementmodelid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `settlementContentAggregation` +-- + +DROP TABLE IF EXISTS `settlementContentAggregation`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `settlementContentAggregation` ( + `settlementContentAggregationId` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `settlementWindowContentId` bigint(20) unsigned NOT NULL, + `participantCurrencyId` int(10) unsigned NOT NULL, + `transferParticipantRoleTypeId` int(10) unsigned NOT NULL, + `ledgerEntryTypeId` int(10) unsigned NOT NULL, + `amount` decimal(18,2) NOT NULL, + `createdDate` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `settlementWindowStateId` varchar(50) NOT NULL, + `settlementId` bigint(20) unsigned DEFAULT NULL, + PRIMARY KEY (`settlementContentAggregationId`), + KEY `settlementcontentaggregation_settlementwindowcontentid_index` (`settlementWindowContentId`), + KEY `settlementcontentaggregation_participantcurrencyid_index` (`participantCurrencyId`), + KEY `settlementcontentaggregation_transferparticipantroletypeid_index` (`transferParticipantRoleTypeId`), + KEY `settlementcontentaggregation_ledgerentrytypeid_index` (`ledgerEntryTypeId`), + KEY `settlementcontentaggregation_settlementwindowstateid_index` (`settlementWindowStateId`), + KEY `settlementcontentaggregation_settlementid_index` (`settlementId`), + CONSTRAINT `sca_transferparticipantroletypeid_foreign` FOREIGN KEY (`transferParticipantRoleTypeId`) REFERENCES `transferParticipantRoleType` (`transferparticipantroletypeid`), + CONSTRAINT `settlementcontentaggregation_ledgerentrytypeid_foreign` FOREIGN KEY (`ledgerEntryTypeId`) REFERENCES `ledgerEntryType` (`ledgerentrytypeid`), + CONSTRAINT `settlementcontentaggregation_participantcurrencyid_foreign` FOREIGN KEY (`participantCurrencyId`) REFERENCES `participantCurrency` (`participantcurrencyid`), + CONSTRAINT `settlementcontentaggregation_settlementid_foreign` FOREIGN KEY (`settlementId`) REFERENCES `settlement` (`settlementid`), + CONSTRAINT `settlementcontentaggregation_settlementwindowcontentid_foreign` FOREIGN KEY (`settlementWindowContentId`) REFERENCES `settlementWindowContent` (`settlementwindowcontentid`), + CONSTRAINT `settlementcontentaggregation_settlementwindowstateid_foreign` FOREIGN KEY (`settlementWindowStateId`) REFERENCES `settlementWindowState` (`settlementwindowstateid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `settlementDelay` +-- + +DROP TABLE IF EXISTS `settlementDelay`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `settlementDelay` ( + `settlementDelayId` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(50) NOT NULL, + `description` varchar(512) DEFAULT NULL, + `isActive` tinyint(1) NOT NULL DEFAULT '1', + `createdDate` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'System dateTime stamp pertaining to the inserted record', + PRIMARY KEY (`settlementDelayId`), + UNIQUE KEY `settlementdelay_name_unique` (`name`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `settlementGranularity` +-- + +DROP TABLE IF EXISTS `settlementGranularity`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `settlementGranularity` ( + `settlementGranularityId` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(50) NOT NULL, + `description` varchar(512) DEFAULT NULL, + `isActive` tinyint(1) NOT NULL DEFAULT '1', + `createdDate` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'System dateTime stamp pertaining to the inserted record', + PRIMARY KEY (`settlementGranularityId`), + UNIQUE KEY `settlementgranularity_name_unique` (`name`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `settlementInterchange` +-- + +DROP TABLE IF EXISTS `settlementInterchange`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `settlementInterchange` ( + `settlementInterchangeId` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(50) NOT NULL, + `description` varchar(512) DEFAULT NULL, + `isActive` tinyint(1) NOT NULL DEFAULT '1', + `createdDate` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'System dateTime stamp pertaining to the inserted record', + PRIMARY KEY (`settlementInterchangeId`), + UNIQUE KEY `settlementinterchange_name_unique` (`name`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `settlementModel` +-- + +DROP TABLE IF EXISTS `settlementModel`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `settlementModel` ( + `settlementModelId` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(50) NOT NULL, + `isActive` tinyint(1) NOT NULL DEFAULT '1', + `settlementGranularityId` int(10) unsigned NOT NULL, + `settlementInterchangeId` int(10) unsigned NOT NULL, + `settlementDelayId` int(10) unsigned NOT NULL, + `currencyId` varchar(3) DEFAULT NULL, + `requireLiquidityCheck` tinyint(1) NOT NULL DEFAULT '1', + `ledgerAccountTypeId` int(10) unsigned NOT NULL, + PRIMARY KEY (`settlementModelId`), + KEY `settlementmodel_settlementgranularityid_index` (`settlementGranularityId`), + KEY `settlementmodel_settlementinterchangeid_index` (`settlementInterchangeId`), + KEY `settlementmodel_settlementdelayid_index` (`settlementDelayId`), + KEY `settlementmodel_currencyid_index` (`currencyId`), + KEY `settlementmodel_ledgeraccounttypeid_index` (`ledgerAccountTypeId`), + CONSTRAINT `settlementmodel_currencyid_foreign` FOREIGN KEY (`currencyId`) REFERENCES `currency` (`currencyid`), + CONSTRAINT `settlementmodel_ledgeraccounttypeid_foreign` FOREIGN KEY (`ledgerAccountTypeId`) REFERENCES `ledgerAccountType` (`ledgeraccounttypeid`), + CONSTRAINT `settlementmodel_settlementdelayid_foreign` FOREIGN KEY (`settlementDelayId`) REFERENCES `settlementDelay` (`settlementdelayid`), + CONSTRAINT `settlementmodel_settlementgranularityid_foreign` FOREIGN KEY (`settlementGranularityId`) REFERENCES `settlementGranularity` (`settlementgranularityid`), + CONSTRAINT `settlementmodel_settlementinterchangeid_foreign` FOREIGN KEY (`settlementInterchangeId`) REFERENCES `settlementInterchange` (`settlementinterchangeid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; @@ -1000,12 +1120,12 @@ CREATE TABLE `settlement` ( DROP TABLE IF EXISTS `settlementParticipantCurrency`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `settlementParticipantCurrency` ( `settlementParticipantCurrencyId` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `settlementId` bigint(20) unsigned NOT NULL, `participantCurrencyId` int(10) unsigned NOT NULL, - `netAmount` decimal(18,2) NOT NULL, + `netAmount` decimal(18,4) NOT NULL, `createdDate` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `currentStateChangeId` bigint(20) unsigned DEFAULT NULL, `settlementTransferId` varchar(36) DEFAULT NULL, @@ -1026,7 +1146,7 @@ CREATE TABLE `settlementParticipantCurrency` ( DROP TABLE IF EXISTS `settlementParticipantCurrencyStateChange`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `settlementParticipantCurrencyStateChange` ( `settlementParticipantCurrencyStateChangeId` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `settlementParticipantCurrencyId` bigint(20) unsigned NOT NULL, @@ -1048,7 +1168,7 @@ CREATE TABLE `settlementParticipantCurrencyStateChange` ( DROP TABLE IF EXISTS `settlementSettlementWindow`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `settlementSettlementWindow` ( `settlementSettlementWindowId` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `settlementId` bigint(20) unsigned NOT NULL, @@ -1069,7 +1189,7 @@ CREATE TABLE `settlementSettlementWindow` ( DROP TABLE IF EXISTS `settlementState`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `settlementState` ( `settlementStateId` varchar(50) NOT NULL, `enumeration` varchar(50) NOT NULL, @@ -1086,7 +1206,7 @@ CREATE TABLE `settlementState` ( DROP TABLE IF EXISTS `settlementStateChange`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `settlementStateChange` ( `settlementStateChangeId` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `settlementId` bigint(20) unsigned NOT NULL, @@ -1107,7 +1227,7 @@ CREATE TABLE `settlementStateChange` ( DROP TABLE IF EXISTS `settlementTransferParticipant`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `settlementTransferParticipant` ( `settlementTransferParticipantId` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `settlementId` bigint(20) unsigned NOT NULL, @@ -1115,7 +1235,7 @@ CREATE TABLE `settlementTransferParticipant` ( `participantCurrencyId` int(10) unsigned NOT NULL, `transferParticipantRoleTypeId` int(10) unsigned NOT NULL, `ledgerEntryTypeId` int(10) unsigned NOT NULL, - `amount` decimal(18,2) NOT NULL, + `amount` decimal(18,4) NOT NULL, `createdDate` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`settlementTransferParticipantId`), KEY `settlementtransferparticipant_settlementid_index` (`settlementId`), @@ -1137,7 +1257,7 @@ CREATE TABLE `settlementTransferParticipant` ( DROP TABLE IF EXISTS `settlementWindow`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `settlementWindow` ( `settlementWindowId` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `reason` varchar(512) DEFAULT NULL, @@ -1149,13 +1269,63 @@ CREATE TABLE `settlementWindow` ( ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `settlementWindowContent` +-- + +DROP TABLE IF EXISTS `settlementWindowContent`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `settlementWindowContent` ( + `settlementWindowContentId` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `settlementWindowId` bigint(20) unsigned NOT NULL, + `ledgerAccountTypeId` int(10) unsigned NOT NULL, + `currencyId` varchar(3) NOT NULL, + `createdDate` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `currentStateChangeId` bigint(20) unsigned DEFAULT NULL, + `settlementId` bigint(20) unsigned DEFAULT NULL, + PRIMARY KEY (`settlementWindowContentId`), + KEY `settlementwindowcontent_settlementwindowid_index` (`settlementWindowId`), + KEY `settlementwindowcontent_ledgeraccounttypeid_index` (`ledgerAccountTypeId`), + KEY `settlementwindowcontent_currencyid_index` (`currencyId`), + KEY `settlementwindowcontent_currentstatechangeid_index` (`currentStateChangeId`), + KEY `settlementwindowcontent_settlementid_index` (`settlementId`), + CONSTRAINT `settlementwindowcontent_currencyid_foreign` FOREIGN KEY (`currencyId`) REFERENCES `currency` (`currencyid`), + CONSTRAINT `settlementwindowcontent_currentstatechangeid_foreign` FOREIGN KEY (`currentStateChangeId`) REFERENCES `settlementWindowContentStateChange` (`settlementwindowcontentstatechangeid`), + CONSTRAINT `settlementwindowcontent_ledgeraccounttypeid_foreign` FOREIGN KEY (`ledgerAccountTypeId`) REFERENCES `ledgerAccountType` (`ledgeraccounttypeid`), + CONSTRAINT `settlementwindowcontent_settlementid_foreign` FOREIGN KEY (`settlementId`) REFERENCES `settlement` (`settlementid`), + CONSTRAINT `settlementwindowcontent_settlementwindowid_foreign` FOREIGN KEY (`settlementWindowId`) REFERENCES `settlementWindow` (`settlementwindowid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `settlementWindowContentStateChange` +-- + +DROP TABLE IF EXISTS `settlementWindowContentStateChange`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `settlementWindowContentStateChange` ( + `settlementWindowContentStateChangeId` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `settlementWindowContentId` bigint(20) unsigned NOT NULL, + `settlementWindowStateId` varchar(50) NOT NULL, + `reason` varchar(512) DEFAULT NULL, + `createdDate` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`settlementWindowContentStateChangeId`), + KEY `swcsc_settlementwindowcontentid_index` (`settlementWindowContentId`), + KEY `swcsc_settlementwindowstateid_index` (`settlementWindowStateId`), + CONSTRAINT `swc_settlementwindowcontentid_foreign` FOREIGN KEY (`settlementWindowContentId`) REFERENCES `settlementWindowContent` (`settlementwindowcontentid`), + CONSTRAINT `sws1_settlementwindowstateid_foreign` FOREIGN KEY (`settlementWindowStateId`) REFERENCES `settlementWindowState` (`settlementwindowstateid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `settlementWindowState` -- DROP TABLE IF EXISTS `settlementWindowState`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `settlementWindowState` ( `settlementWindowStateId` varchar(50) NOT NULL, `enumeration` varchar(50) NOT NULL, @@ -1172,7 +1342,7 @@ CREATE TABLE `settlementWindowState` ( DROP TABLE IF EXISTS `settlementWindowStateChange`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `settlementWindowStateChange` ( `settlementWindowStateChangeId` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `settlementWindowId` bigint(20) unsigned NOT NULL, @@ -1193,7 +1363,7 @@ CREATE TABLE `settlementWindowStateChange` ( DROP TABLE IF EXISTS `token`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `token` ( `tokenId` int(10) unsigned NOT NULL AUTO_INCREMENT, `participantId` int(10) unsigned NOT NULL, @@ -1213,7 +1383,7 @@ CREATE TABLE `token` ( DROP TABLE IF EXISTS `transactionInitiator`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `transactionInitiator` ( `transactionInitiatorId` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(256) NOT NULL, @@ -1230,7 +1400,7 @@ CREATE TABLE `transactionInitiator` ( DROP TABLE IF EXISTS `transactionInitiatorType`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `transactionInitiatorType` ( `transactionInitiatorTypeId` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(256) NOT NULL, @@ -1247,7 +1417,7 @@ CREATE TABLE `transactionInitiatorType` ( DROP TABLE IF EXISTS `transactionReference`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `transactionReference` ( `transactionReferenceId` varchar(36) NOT NULL COMMENT 'Common ID (decided by the Payer FSP) between the FSPs for the future transaction object', `quoteId` varchar(36) DEFAULT NULL COMMENT 'Common ID between the FSPs for the quote object, decided by the Payer FSP', @@ -1264,7 +1434,7 @@ CREATE TABLE `transactionReference` ( DROP TABLE IF EXISTS `transactionScenario`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `transactionScenario` ( `transactionScenarioId` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(256) NOT NULL, @@ -1281,7 +1451,7 @@ CREATE TABLE `transactionScenario` ( DROP TABLE IF EXISTS `transactionSubScenario`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `transactionSubScenario` ( `transactionSubScenarioId` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(256) NOT NULL, @@ -1297,10 +1467,10 @@ CREATE TABLE `transactionSubScenario` ( DROP TABLE IF EXISTS `transfer`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `transfer` ( `transferId` varchar(36) NOT NULL, - `amount` decimal(18,2) NOT NULL, + `amount` decimal(18,4) NOT NULL, `currencyId` varchar(3) NOT NULL, `ilpCondition` varchar(256) NOT NULL, `expirationDate` datetime NOT NULL, @@ -1318,7 +1488,7 @@ CREATE TABLE `transfer` ( DROP TABLE IF EXISTS `transferDuplicateCheck`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `transferDuplicateCheck` ( `transferId` varchar(36) NOT NULL, `hash` varchar(256) NOT NULL, @@ -1333,7 +1503,7 @@ CREATE TABLE `transferDuplicateCheck` ( DROP TABLE IF EXISTS `transferError`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `transferError` ( `transferId` varchar(36) NOT NULL, `transferStateChangeId` bigint(20) unsigned NOT NULL, @@ -1342,7 +1512,6 @@ CREATE TABLE `transferError` ( `createdDate` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`transferId`), KEY `transfererror_transferstatechangeid_foreign` (`transferStateChangeId`), - CONSTRAINT `transfererror_transferid_foreign` FOREIGN KEY (`transferId`) REFERENCES `transferErrorDuplicateCheck` (`transferid`), CONSTRAINT `transfererror_transferstatechangeid_foreign` FOREIGN KEY (`transferStateChangeId`) REFERENCES `transferStateChange` (`transferstatechangeid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; @@ -1353,7 +1522,7 @@ CREATE TABLE `transferError` ( DROP TABLE IF EXISTS `transferErrorDuplicateCheck`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `transferErrorDuplicateCheck` ( `transferId` varchar(36) NOT NULL, `hash` varchar(256) DEFAULT NULL, @@ -1369,7 +1538,7 @@ CREATE TABLE `transferErrorDuplicateCheck` ( DROP TABLE IF EXISTS `transferExtension`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `transferExtension` ( `transferExtensionId` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `transferId` varchar(36) NOT NULL, @@ -1390,7 +1559,7 @@ CREATE TABLE `transferExtension` ( DROP TABLE IF EXISTS `transferFulfilment`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `transferFulfilment` ( `transferId` varchar(36) NOT NULL, `ilpFulfilment` varchar(256) DEFAULT NULL, @@ -1411,7 +1580,7 @@ CREATE TABLE `transferFulfilment` ( DROP TABLE IF EXISTS `transferFulfilmentDuplicateCheck`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `transferFulfilmentDuplicateCheck` ( `transferId` varchar(36) NOT NULL, `hash` varchar(256) DEFAULT NULL, @@ -1427,14 +1596,14 @@ CREATE TABLE `transferFulfilmentDuplicateCheck` ( DROP TABLE IF EXISTS `transferParticipant`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `transferParticipant` ( `transferParticipantId` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `transferId` varchar(36) NOT NULL, `participantCurrencyId` int(10) unsigned NOT NULL, `transferParticipantRoleTypeId` int(10) unsigned NOT NULL, `ledgerEntryTypeId` int(10) unsigned NOT NULL, - `amount` decimal(18,2) NOT NULL, + `amount` decimal(18,4) NOT NULL, `createdDate` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`transferParticipantId`), KEY `transferparticipant_transferid_index` (`transferId`), @@ -1454,7 +1623,7 @@ CREATE TABLE `transferParticipant` ( DROP TABLE IF EXISTS `transferParticipantRoleType`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `transferParticipantRoleType` ( `transferParticipantRoleTypeId` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(50) NOT NULL, @@ -1472,7 +1641,7 @@ CREATE TABLE `transferParticipantRoleType` ( DROP TABLE IF EXISTS `transferRules`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `transferRules` ( `transferRulesId` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(128) NOT NULL, @@ -1490,7 +1659,7 @@ CREATE TABLE `transferRules` ( DROP TABLE IF EXISTS `transferState`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `transferState` ( `transferStateId` varchar(50) NOT NULL, `enumeration` varchar(50) NOT NULL COMMENT 'transferState associated to the Mojaloop API', @@ -1507,7 +1676,7 @@ CREATE TABLE `transferState` ( DROP TABLE IF EXISTS `transferStateChange`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `transferStateChange` ( `transferStateChangeId` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `transferId` varchar(36) NOT NULL, @@ -1528,7 +1697,7 @@ CREATE TABLE `transferStateChange` ( DROP TABLE IF EXISTS `transferTimeout`; /*!40101 SET @saved_cs_client = @@character_set_client */; - SET character_set_client = utf8mb4 ; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `transferTimeout` ( `transferTimeoutId` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `transferId` varchar(36) NOT NULL, @@ -1603,4 +1772,4 @@ CREATE TABLE `transferTimeout` ( /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-08-23 12:41:12 +-- Dump completed on 2020-01-06 15:34:26 diff --git a/mojaloop-technical-overview/central-ledger/assets/database/central-ledger-schema-DBeaver.erd b/mojaloop-technical-overview/central-ledger/assets/database/central-ledger-schema-DBeaver.erd index b01aeee53..d110de23d 100644 --- a/mojaloop-technical-overview/central-ledger/assets/database/central-ledger-schema-DBeaver.erd +++ b/mojaloop-technical-overview/central-ledger/assets/database/central-ledger-schema-DBeaver.erd @@ -1,8 +1,8 @@ - + - + @@ -14,16 +14,16 @@ - + - + - + - + @@ -35,10 +35,10 @@ - + - + @@ -47,37 +47,37 @@ - + - + - + - + - + - + - + - + - + - + - + @@ -86,46 +86,64 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + @@ -134,6 +152,8 @@ + + @@ -142,52 +162,66 @@ - + - + - - + + + - + - + - - + + - + + + - + - - - - + + + + + + + + + + + + + - COLOR LEGEND: + COLOR LEGEND: Green - subject specific entity Gray - transfer specific entity +Brown - bulk transfer entity Red - settlement specific entity -Blue - lookup entity +Blue - enumeration entity +Purple - to be removed Cyan - impl. specific Yellow - tbd diff --git a/mojaloop-technical-overview/central-ledger/assets/database/central-ledger-schema.png b/mojaloop-technical-overview/central-ledger/assets/database/central-ledger-schema.png index 67bed1574..7bfc910fc 100644 Binary files a/mojaloop-technical-overview/central-ledger/assets/database/central-ledger-schema.png and b/mojaloop-technical-overview/central-ledger/assets/database/central-ledger-schema.png differ diff --git a/mojaloop-technical-overview/central-settlements/oss-settlement-fsd.md b/mojaloop-technical-overview/central-settlements/oss-settlement-fsd.md index 4a63247f3..cf410b4c8 100644 --- a/mojaloop-technical-overview/central-settlements/oss-settlement-fsd.md +++ b/mojaloop-technical-overview/central-settlements/oss-settlement-fsd.md @@ -925,7 +925,8 @@ currency. The full column structure of the table is as follows: | **settlementWindowId** | The settlement window that the record belongs to. | BIGINT(20). Unsigned, not null. Foreign Key to **settlementWindow** | | **ledgerAccountTypeId** | The ledger account that the record refers to. | INT(10). Unsigned, not null. Foreign key to **ledgerAccountType** | | **currencyId** | The currency that the record refers to. | VARCHAR(3). Not null. Foreign key to **currency**. | -| **settlementWindowContentCurrentState** | The current state of this entry | BIGINT(20). Unsigned, not null. Foreign key to **settlementWindowContentStateChange** | +| **createdDate** | The date and time when the record was created. | DATETIME. Not null. Defaults to CURRENT_TIMESTAMP. | +| **currentStateChangeId** | The current state of this entry. | BIGINT(20). Unsigned. Foreign key to **settlementWindowContentStateChange** |   @@ -942,7 +943,7 @@ structure of the table is as follows: | **settlementWindowContentId** | The settlement window content record whose status is being tracked. | BIGINT(20). Unsigned, not null. Foreign Key to **settlementWindowContent** | | **settlementWindowStateId** | The record’s status. | VARCHAR(50). Not null. Foreign key to **settlementWindowState** | | **reason** | An optional field giving the reason for the state being set. | VARCHAR(512). | -| **createdDate** | The date and time when the record was created | DATETIME. Defaults to CURRENT_TIMESTAMP | +| **createdDate** | The date and time when the record was created | DATETIME. Not null. Defaults to CURRENT_TIMESTAMP |   @@ -955,31 +956,18 @@ The column structure of the **settlementContentAggregation** table should be modified as follows: 1. Remove the following foreign keys from the table: - 1. settlementtransferparticipant_settlementid_foreign - 2. settlementtransferparticipant_settlementwindowid_foreign - 2. Remove the following columns from the table: - 1. settlementId - 2. settlementWindowId - 3. Add the following column to the table: - 1. Column name: **settlementWindowContentId** - 2. Attributes: BIGINT(20), unsigned, not null - 4. Add the following foreign key to the table: - 1. Name: settlementContentAggregation_settlementwindowcontent_foreign - 2. Child column **settlementWindowContentId** - 3. Refers to table: **settlementWindowContent** - 4. Refers to column: **settlementWindowContentId** All database scripts which use the **settlementTransferParticipant** table will @@ -1007,19 +995,17 @@ The **settlement** table in the central ledger database needs to be modified to add a *settlementModel* column. This column should have the following characteristics: -·       The column should be required (NOT NULL) and unsigned. - -·       The column’s data type should be smallint(6) - -·       The column should be defined as a foreign key reference to the -*idsettlementmodel* field of the **settlementModel** table. +- The column should be required (NOT NULL) and unsigned. +- The column’s data type should be integer(10) +- The column should be defined as a foreign key reference to the +*settlementModelId* field of the **settlementModel** table. When this change is applied to an existing database, a settlement model to describe the default settlement should be created. The settlementCurrencyId column in this model should be left blank (= all currencies.) The settlementModel column in all existing records in the settlement table should be set to point to this model’s ID. A script to apply this change should be -created, tested and stored in the repository. [Story \#6] +created, tested and stored in the repository. ### Changes to processing @@ -1037,111 +1023,63 @@ When a settlement window is closed, the code supporting this activity should perform two functions, as follows. These functions should be performed in the background and without impacting system performance. -##### Generate records in the settlementWindowContent table [Story \#11] +##### Generate records in the settlementWindowContent table [Story \#1095] The code should generate a record in the **settlementWindowContent** table for each ledger entry type/currency combination found in the transfers in the settlement window. This information can be obtained from the following query: - +``` SELECT DISTINCT + @mySettlementWindowId, pc.ledgerAccountTypeId, pc.currencyId +FROM transferFulfilment tf +INNER JOIN transferParticipant tp + ON tp.transferId = tf.transferId +INNER JOIN participantCurrency pc + ON pc.participantCurrencyId = tp.participantCurrencyId +WHERE tf.settlementWindowId = @mySettlementWindowId; +``` -   \@mySettlementId - -, PC.currencyId - -, PC.ledgerAccountTypeId - -FROM - -   transferFulfilment F - -INNER JOIN transferParticipant P on F.transferId = P.transferId - -INNER JOIN participantCurrency PC on P.participantCurrencyId = -PC.participantCurrencyId - -WHERE - -   F.settlementWindowId = \@mySettlementWindowId; - -##### Generate records in the settlementContentTransferParticipant table [Story \#12] +##### Generate records in the settlementContentAggregation table [Story \#1095] The code should calculate the aggregate values for all transfers which form part of that settlement window and store them in the **settlementContentAggregation** table. Aggregates should be produced for the following segmentation: 1. Participant - 2. Currency - 3. Ledger account type - 4. Participant role type - 5. Ledger entry type The following query will perform this function for a given settlement window: +``` INSERT INTO settlementContentAggregation - -   (settlementWindowContentId, participantCurrencyId, -transferParticipantRoleTypeId, - -ledgerEntryTypeId, amount, createdDate) - -SELECT - -   C.settlementWindowContentId - -, PC.participantCurrencyId - -, P.transferParticipantRoleTypeId - -, P.ledgerEntryTypeId - -, sum(P.amount) - -, CURRENT_TIMESTAMP - -FROM - -   transferFulfilment F - -INNER JOIN transferParticipant P on F.transferId = P.transferId - -INNER JOIN participantCurrency PC on P.participantCurrencyId = -PC.participantCurrencyId - -INNER JOIN settlementWindowContent C ON C.settlementWindowId = -F.settlementWindowId - -        AND C.ledgerAccountTypeId = PC.ledgerAccountTypeId - -     AND C.currencyId = PC.currencyId - -WHERE - -   F.settlementWindowId = \@mySettlementId - -GROUP BY - -   C.settlementWindowContentId - -, PC.participantCurrencyId - -, P.transferParticipantRoleTypeId - -, P.ledgerEntryTypeId - -   ; + (settlementWindowContentId, participantCurrencyId, + transferParticipantRoleTypeId, ledgerEntryTypeId, amount) +SELECT swc.settlementWindowContentId, pc.participantCurrencyId, + tp.transferParticipantRoleTypeId, tp.ledgerEntryTypeId, SUM(tp.amount) +FROM transferFulfilment tf +INNER JOIN transferParticipant tp + ON tf.transferId = tp.transferId +INNER JOIN participantCurrency pc + ON pc.participantCurrencyId = tp.participantCurrencyId +INNER JOIN settlementWindowContent swc + ON swc.settlementWindowId = tf.settlementWindowId +  AND swc.ledgerAccountTypeId = pc.ledgerAccountTypeId + AND swc.currencyId = pc.currencyId +WHERE tf.settlementWindowId = @mySettlementWindowId +GROUP BY swc.settlementWindowContentId, pc.participantCurrencyId, + tp.transferParticipantRoleTypeId, tp.ledgerEntryTypeId; +``` #### createSettlement The parameters for the **createSettlement** resource should be extended to -include the settlement model for which the settlement is required. [Story \#13] +include the settlement model for which the settlement is required. When the settlement is created, the settlement model for which the settlement is -required should be added to the new row in the **settlement** table. +required should be added to the new row in the **settlement** table. [Story \#1097] When a settlement is requested, the switch should check that the settlement model for which settlement is being requested requires NET settlement and not @@ -1153,51 +1091,13 @@ should be changed to check that some of the settlement windows associated with the proposed settlement contain entries for the settlement model requested. If there are no entries for the settlement model requested for any of the settlement windows requested, then an error should be returned and the -settlement request rejected. [Story \#14] - -#### Updating the progress of a settlement. +settlement request rejected. [Story \#1096] -The process to update the status of a settlement described in Section 5.1.7.1.2 -above allows the caller to specify the currency whose status is to be changed. -Since the settlement will now be for a settlement model, this parameter should -be removed. [Story \#15] +#### Updating the progress of a settlement -When the status for a settlement participant is updated, this will result in +When the status for a settlement participant is changed to SETTLED, this will result in changes to the status of all the records in the **settlementContentAggregation** -table for the given participant. These records can be identified using the -following query: - -SELECT - -P.settlementContentAggregationId - -FROM - -   settlement S - -INNER JOIN settlementSettlementWindow W ON S.settlementId = W.settlementId - -INNER JOIN settlementModel M ON S.settlementSettlementModelId = -M.idSettlementModel - -INNER JOIN settlementWindowContent C ON W.settlementWindowId = -C.settlementWindowId - -INNER JOIN settlementContentAggregation P ON C.settlementWindowContentId = -P.settlementWindowContentId - -INNER JOIN participantCurrency PC ON P.participantCurrencyId = -PC.participantCurrencyId - -WHERE - -   S.settlementId = \@mySettlementId - -AND PC.ledgerAccountTypeId = M.ledgerAccountTypeId - -AND (C.currencyId = M.settlementCurrencyId OR M.settlementCurrencyId IS NULL) - -; +table for the given participant, identified by the compound key: settlementId + participantCurrencyId. [Story \#16] @@ -1229,13 +1129,11 @@ A number of new tables are required to define a settlement model and to store the enumerations for its definition types. This comprises the following tables in the ERD: -- Settlementdelay - -- Settlementinterchange +- settlementDelay -- Settlementmodel +- settlementInterchange -- Settlementtype +- settlementModel In addition, the **settlementmodel** table has foreign keys to two existing tables, as follows: @@ -1279,7 +1177,7 @@ database would be as follows: | Ledger Entry Type | Ledger Account Type | |-------------------|---------------------------| | PRINCIPAL_VALUE | POSITION | -| INTERCHANGE_FEE | New account type required | +| INTERCHANGE_FEE | INTERCHANGE_FEE | | HUB_FEE | HUB_FEE | | | | @@ -1720,18 +1618,16 @@ Enumerations ------------ The following enumerations are required to support the new ERD: - -DELETE FROM settlementgranularity; - -INSERT INTO settlementgranularity (settlementTypeName) VALUES ('GROSS'), -('NET'); - -DELETE FROM settlementinterchange; - -INSERT INTO settlementinterchange (interchangetypename) VALUES ('BILATERAL'), -('MULTILATERAL'); - -DELETE FROM settlementdelay; - -INSERT INTO settlementdelay(settlementdelayname) VALUES ('IMMEDIATE'), -('DEFERRED'); +``` +DELETE FROM settlementGranularity; +INSERT INTO settlementGranularity (name) +VALUES ('GROSS'), ('NET'); + +DELETE FROM settlementInterchange; +INSERT INTO settlementInterchange (name) +VALUES ('BILATERAL'), ('MULTILATERAL'); + +DELETE FROM settlementDelay; +INSERT INTO settlementDelay(name) +VALUES ('IMMEDIATE'), ('DEFERRED'); +``` \ No newline at end of file