Files
expenses/server/.sqlx/query-644b5254e749e03696892b2234c1e8feee5d852e443c4fe0c1c71cdddfab3f6e.json

142 lines
4.1 KiB
JSON

{
"db_name": "PostgreSQL",
"query": "\n INSERT INTO transactions (id, account_id, amount_cents, direction, date, description)\n SELECT $2, $3, $4, $5, $6, $7\n FROM accessible_accounts($1) AS accounts\n WHERE accounts.id = $3\n ON CONFLICT (id) DO UPDATE SET\n account_id = EXCLUDED.account_id,\n amount_cents = EXCLUDED.amount_cents,\n direction = EXCLUDED.direction,\n date = EXCLUDED.date,\n description = EXCLUDED.description\n WHERE transactions.account_id IN (SELECT id FROM accessible_accounts($1))\n RETURNING WITH (OLD AS old_row, NEW AS new_row)\n old_row.id AS \"old_id?\",\n COALESCE(old_row.account_id, new_row.account_id) AS \"old_account_id!\",\n COALESCE(old_row.amount_cents, new_row.amount_cents) AS \"old_amount_cents!\",\n COALESCE(old_row.direction, new_row.direction) AS \"old_direction!\",\n COALESCE(old_row.date, new_row.date) AS \"old_date!\",\n COALESCE(old_row.description, new_row.description) AS \"old_description!\",\n new_row.id AS \"id!\",\n new_row.account_id AS \"account_id!\",\n new_row.amount_cents AS \"amount_cents!\",\n new_row.direction AS \"direction!\",\n new_row.date AS \"date!\",\n new_row.description AS \"description!\"\n ",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "old_id?",
"type_info": "Uuid",
"origin": {
"Table": {
"table": "transactions",
"name": "id"
}
}
},
{
"ordinal": 1,
"name": "old_account_id!",
"type_info": "Uuid",
"origin": "Expression"
},
{
"ordinal": 2,
"name": "old_amount_cents!",
"type_info": "Int8",
"origin": "Expression"
},
{
"ordinal": 3,
"name": "old_direction!",
"type_info": "Text",
"origin": "Expression"
},
{
"ordinal": 4,
"name": "old_date!",
"type_info": "Timestamptz",
"origin": "Expression"
},
{
"ordinal": 5,
"name": "old_description!",
"type_info": "Text",
"origin": "Expression"
},
{
"ordinal": 6,
"name": "id!",
"type_info": "Uuid",
"origin": {
"Table": {
"table": "transactions",
"name": "id"
}
}
},
{
"ordinal": 7,
"name": "account_id!",
"type_info": "Uuid",
"origin": {
"Table": {
"table": "transactions",
"name": "account_id"
}
}
},
{
"ordinal": 8,
"name": "amount_cents!",
"type_info": "Int8",
"origin": {
"Table": {
"table": "transactions",
"name": "amount_cents"
}
}
},
{
"ordinal": 9,
"name": "direction!",
"type_info": "Text",
"origin": {
"Table": {
"table": "transactions",
"name": "direction"
}
}
},
{
"ordinal": 10,
"name": "date!",
"type_info": "Timestamptz",
"origin": {
"Table": {
"table": "transactions",
"name": "date"
}
}
},
{
"ordinal": 11,
"name": "description!",
"type_info": "Text",
"origin": {
"Table": {
"table": "transactions",
"name": "description"
}
}
}
],
"parameters": {
"Left": [
"Uuid",
"Uuid",
"Uuid",
"Int8",
"Text",
"Timestamptz",
"Text"
]
},
"nullable": [
false,
null,
null,
null,
null,
null,
false,
false,
false,
false,
false,
false
]
},
"hash": "644b5254e749e03696892b2234c1e8feee5d852e443c4fe0c1c71cdddfab3f6e"
}