Data model

The following page provides an overview of the core tables and their schemas in Midaz, offering developers and database administrators a reference for understanding data structure and relationships. Note that future versions of Midaz may introduce additional fields or tables.

Tables


Each table is structured to support efficient querying and data integrity, aligning with Midaz's commitment to scalability and flexibility.

Table: organization

ColumnTypeDescription
iduuidThe unique identifier of the Organization.
legalNametextThe legal name of the Organization.
parentOrganizationIduuidThe unique identifier of the parent Organization.
doingBusinessAstextThe trade name of the Organization.
legalDocumenttextThe document of the Organization.
statusjsonbInformation about the status.
addressjsonbInformation about the address of the Organization.
metadatajsonbKey-value pairs to add as metadata.
createdAttimestamptzTimestamp of creation (UTC).
updatedAttimestamptzTimestamp of last update (UTC).
deletedAttimestamptzThe timestamp of soft deletion, if applicable (UTC).

Table: ledger

ColumnTypeDescription
iduuidThe unique identifier of the Ledger.
organizationIduuidThe unique identifier of the Organization.
nametextThe name of the Ledger.
statusjsonbInformation about the status.
metadatajsonbKey-value pairs to add as metadata.
createdAttimestamptzTimestamp of creation (UTC).
updatedAttimestamptzTimestamp of last update (UTC).
deletedAttimestamptzTimestamp of soft deletion, if applicable (UTC).

Table: asset

ColumnTypeDescription
iduuidThe unique identifier of the Asset.
organizationIduuidThe unique identifier of the Organization.
ledgerIduuidThe unique identifier of the Ledger.
nametextThe name of the Asset.
typeenumThe type of Asset (currency, crypto, commodity, others).
codetextThe code used to refer to the Asset.
statustextInformation about the status.
metadatajsonbKey-value pairs to add as metadata.
createdAttimestamptzTimestamp of creation (UTC).
updatedAttimestamptzTimestamp of last update (UTC).
deletedAttimestamptzTimestamp of soft deletion, if applicable (UTC).

Table: account-type

ColumnTypeDescription
iduuidThe unique identifier of the Account Type.
ledgerIduuidThe unique identifier of the Ledger.
nametextName of the Account Type.
descriptiontextDescription of the Account Type.
keyValuetextCustom value defined by the user to identify the Account Type.
createdAttimestamptzTimestamp of creation (UTC).
updatedAttimestamptzTimestamp of last update (UTC).
deletedAttimestamptzTimestamp of soft deletion, if applicable (UTC).

Table: account

ColumnTypeDescription
iduuidThe unique identifier of the Account.
organizationIduuidThe unique identifier of the Organization.
ledgerIduuidThe unique identifier of the Ledger.
assetCodetextThe code used to refer to the Asset.
nametextThe name of the Account.
aliastextA unique, user-friendly identifier for the account.
typetextThe type of account.
parentAccountIduuidThe unique identifier of the Parent Account.
entityIdtextThe unique identifier of the Entity responsible for the Account.
portfolioIduuidThe unique identifier of the Portfolio.
segmentIduuidThe unique identifier of the Segment.
statusjsonbInformation about the status.
metadatajsonbKey-value pairs to add as metadata.
createdAttimestamptzTimestamp of creation (UTC).
updatedAttimestamptzTimestamp of last update (UTC).
deletedAttimestamptzTimestamp of soft deletion, if applicable (UTC).

Table: portfolio

ColumnTypeDescription
iduuidThe unique identifier of the Portfolio.
organizationIduuidThe unique identifier of the Organization.
ledgerIduuidThe unique identifier of the Ledger.
entityIdtextThe unique identifier of the user responsible for the Portfolio.
nametextThe name of the Portfolio.
statusjsonbInformation about the status.
metadatajsonbKey-value pairs to add as metadata.
createdAttimestamptzTimestamp of creation (UTC).
updatedAttimestamptzTimestamp of last update (UTC).
deletedAttimestamptzTimestamp of soft deletion, if applicable (UTC).

Table: segment

ColumnTypeDescription
iduuidThe unique identifier of the Segment.
organizationIduuidThe unique identifier of the Organization.
ledgerIduuidThe unique identifier of the Ledger.
nametextThe name of the Segment.
statusjsonbInformation about the status.
metadatajsonbKey-value pairs to add as metadata.
created_attimestamptzTimestamp of creation (UTC).
updated_attimestamptzTimestamp of last update (UTC).
deleted_attimestamptzTimestamp of soft deletion, if applicable (UTC).

Table: balance

ColumnTypeDescription
idtextThe unique identifier of the Balance.
organizationIduuidThe unique identifier of the Organization.
ledgerIduuidThe unique identifier of the Ledger.
accountIduuidThe unique identifier of the Account.
aliastextThe alias for the account used in the operation.
assetCodetextThe code used to refer to the Asset.
availabletextPrevious available balance.
onHoldtextAmount on hold/reserved.
versionintegerBalance version, which is updated with each transaction.
accountTypetextThe type of account.
allowSendingbooleanIf true, indicates that sending transactions is permitted.
allowReceivingbooleanIf true, indicates that receiving transactions is permitted.
createdAttimestamptzTimestamp of creation (UTC).
updatedAttimestamptzTimestamp of last update (UTC).
deletedAttimestamptzTimestamp of soft deletion, if applicable (UTC).

Table: operation-route

ColumnTypeDescription
iduuidThe unique identifier of the Operation Route.
organizationIduuidThe unique identifier of the Organization.
ledgerIduuidThe unique identifier of the Ledger.
titletextShort text summarizing the purpose of the operation. Used as an entry note for identification.
descriptiontextDetailed description of the Operation Route purpose and usage.
typetextThe type of operation (debit/credit).
accountjsonbDefines the rule for selecting the account that will participate in the operation (debit or credit).
createdAttimestamptzTimestamp of creation (UTC).
updatedAttimestamptzTimestamp of last update (UTC).
deletedAttimestamptzTimestamp of soft deletion, if applicable (UTC).

Table: operation

ColumnTypeDescription
iduuidThe unique identifier of the Transaction Route.
transactionIduuidThe unique identifier of the Transaction.
organizationIduuidThe unique identifier of the Organization.
ledgerIduuidThe unique identifier of the Ledger.
accountIduuidThe unique identifier of the account of which you want to retrieve the balances.
balanceIduuidThe unique identifier of the Balance.
accountAliastextThe alias for the account used in the operation.
descriptiontextDescription of the transaction.
typetextThe type of the operation (debit or credit).
assetCodetextThe name of the asset used in the operation.
⚠️chartOfAccountstext[Deprecated] The name of the Chart-of-Accounts that the operation belongs to.
routetextThe chart of accounts group name that categorizes the operation under a specific group.
amountjsonbAn object containing information about the amount used in the operation.
balancejsonbAn object containing information about the balance before the operation.
balanceAfterjsonbAn object containing information about the balance after the operation.
statusjsonbThe transaction status (pending, completed, reversed).
metadatajsonbKey-value pairs to add as metadata.
createdAttimestamptzTimestamp of creation (UTC).
updatedAttimestamptzTimestamp of last update (UTC).
deletedAttimestamptzTimestamp of soft deletion, if applicable (UTC).

⚠️ Deprecated field — This field is still present for backward compatibility but should no longer be used.


Table: transaction-route

ColumnTypeDescription
iduuidThe unique identifier of the Transaction Route.
organizationIduuidThe unique identifier of the Organization.
ledgerIduuidThe unique identifier of the Ledger.
titletextShort text summarizing the purpose of the transaction. Used as an entry note for identification.
descriptiontextA description for the Transaction Route.
operationRoutesarrayA list of Operation Route IDs that define the debit and credit logic for the transaction.
metadataobjectKey-value pairs to add as metadata.
createdAttimestamptzTimestamp of creation (UTC).
updatedAttimestamptzTimestamp of last update (UTC).
deletedAttimestamptzTimestamp of soft deletion, if applicable (UTC).

Table: transaction

ColumnTypeDescription
iduuidThe unique identifier of the transaction.
organizationIduuidThe unique identifier of the Organization.
ledgerIduuidThe unique identifier of the Ledger.
descriptiontextDescription of the transaction.
routetextThe chart of accounts group name that categorizes the operation under a specific group.
statusjsonbInformation about the status.
amounttextThe sent amount.
assetCodetextThe code used to refer to the Asset.
⚠️chartOfAccountsGroupNametext[Deprecated] The name of the group used to categorize the operations of a transaction under the same group.
sourcearrayThe list of accounts used as source.
destinationarrayThe list of accounts used as destination.
operationsarrayThe list of operations in the transaction.
metadatajsonbKey-value pairs to add as metadata.
createdAttimestamptzTimestamp of creation (UTC).
updatedAttimestamptzTimestamp of last update (UTC).
deletedAttimestamptzTimestamp of soft deletion, if applicable (UTC).

⚠️ Deprecated field — This field is still present for backward compatibility but should no longer be used.


Data model


In Figure 1, you can find a visual representation of the core tables in Midaz and their relationships. The diagram helps developers and DB administrators understand how the different entities are interconnected within the system, serving as a guide for efficient data handling and integration.

Figure 1. Midaz tables and their relations.

Figure 1. Midaz tables and their relations.