{
  "db_name": "PostgreSQL",
  "query": "\n            WITH balance_ids AS (\n                SELECT * FROM UNNEST($1::uuid[], $2::uuid[], $3::text[]) \n                AS v(journal_id, account_id, currency)\n            )\n            SELECT \n                h.values,\n                a.normal_balance_type as \"normal_balance_type!: DebitOrCredit\"\n            FROM cala_balance_history h\n            JOIN cala_current_balances c\n                ON h.journal_id = c.journal_id\n                AND h.account_id = c.account_id\n                AND h.currency = c.currency\n                AND h.version = c.latest_version\n            JOIN cala_accounts a\n                ON c.account_id = a.id\n            JOIN balance_ids b \n                ON c.journal_id = b.journal_id\n                AND c.account_id = b.account_id\n                AND c.currency = b.currency",
  "describe": {
    "columns": [
      {
        "ordinal": 0,
        "name": "values",
        "type_info": "Jsonb"
      },
      {
        "ordinal": 1,
        "name": "normal_balance_type!: DebitOrCredit",
        "type_info": {
          "Custom": {
            "name": "debitorcredit",
            "kind": {
              "Enum": [
                "debit",
                "credit"
              ]
            }
          }
        }
      }
    ],
    "parameters": {
      "Left": [
        "UuidArray",
        "UuidArray",
        "TextArray"
      ]
    },
    "nullable": [
      false,
      false
    ]
  },
  "hash": "a1e83a170a78181c9f77de65890838c73310de126ffdb22a55b509836c8ce6ca"
}
