Standardized the upsert and delete pattern across the repo.
This commit is contained in:
+60
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "\n\t\tINSERT INTO accounts (id, name)\n\t\tVALUES ($1, $2)\n\t\tON CONFLICT (id) DO UPDATE SET\n\t\t\tname = EXCLUDED.name\n\t\tRETURNING WITH (OLD AS old_row, NEW AS new_row)\n\t\t\told_row.id AS \"old_id?\",\n\t\t\tCOALESCE(old_row.name, new_row.name) AS \"old_name!\",\n\t\t\tnew_row.id AS \"id!\",\n\t\t\tnew_row.name AS \"name!\"\n\t\t",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "old_id?",
|
||||
"type_info": "Uuid",
|
||||
"origin": {
|
||||
"Table": {
|
||||
"table": "accounts",
|
||||
"name": "id"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "old_name!",
|
||||
"type_info": "Text",
|
||||
"origin": "Expression"
|
||||
},
|
||||
{
|
||||
"ordinal": 2,
|
||||
"name": "id!",
|
||||
"type_info": "Uuid",
|
||||
"origin": {
|
||||
"Table": {
|
||||
"table": "accounts",
|
||||
"name": "id"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 3,
|
||||
"name": "name!",
|
||||
"type_info": "Text",
|
||||
"origin": {
|
||||
"Table": {
|
||||
"table": "accounts",
|
||||
"name": "name"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Uuid",
|
||||
"Text"
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
null,
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "3b4b5bac598a8ef53be0c31ae751fb7e69f2e0b2ee18d628035fc198dadb4b9c"
|
||||
}
|
||||
Reference in New Issue
Block a user