From 96961ed731a0cebcf9ed1ef57ab57ca45a45dc42 Mon Sep 17 00:00:00 2001 From: Natsu Kagami Date: Mon, 5 Feb 2024 00:20:35 +0100 Subject: [PATCH] Update the username as well in the upsert case --- ...13936be169df13320dfd7f9d3df62a35ba63c61efc5de70e750d.json} | 4 ++-- youmubot-db-sql/src/models/osu_user.rs | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) rename youmubot-db-sql/.sqlx/{query-e17f70eb4375790907c7ecec1132cab859a7a18a8ce636f0b39c0b5387d9dffc.json => query-26a910506c0613936be169df13320dfd7f9d3df62a35ba63c61efc5de70e750d.json} (55%) diff --git a/youmubot-db-sql/.sqlx/query-e17f70eb4375790907c7ecec1132cab859a7a18a8ce636f0b39c0b5387d9dffc.json b/youmubot-db-sql/.sqlx/query-26a910506c0613936be169df13320dfd7f9d3df62a35ba63c61efc5de70e750d.json similarity index 55% rename from youmubot-db-sql/.sqlx/query-e17f70eb4375790907c7ecec1132cab859a7a18a8ce636f0b39c0b5387d9dffc.json rename to youmubot-db-sql/.sqlx/query-26a910506c0613936be169df13320dfd7f9d3df62a35ba63c61efc5de70e750d.json index bd0d365..cfd5f19 100644 --- a/youmubot-db-sql/.sqlx/query-e17f70eb4375790907c7ecec1132cab859a7a18a8ce636f0b39c0b5387d9dffc.json +++ b/youmubot-db-sql/.sqlx/query-26a910506c0613936be169df13320dfd7f9d3df62a35ba63c61efc5de70e750d.json @@ -1,6 +1,6 @@ { "db_name": "SQLite", - "query": "INSERT\n INTO osu_users(user_id, username, id, last_update, pp_std, pp_taiko, pp_mania, pp_catch, failures)\n VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)\n ON CONFLICT (user_id) WHERE id = ? DO UPDATE\n SET\n last_update = excluded.last_update,\n pp_std = excluded.pp_std,\n pp_taiko = excluded.pp_taiko,\n pp_mania = excluded.pp_mania,\n pp_catch = excluded.pp_catch,\n failures = excluded.failures\n ", + "query": "INSERT\n INTO osu_users(user_id, username, id, last_update, pp_std, pp_taiko, pp_mania, pp_catch, failures)\n VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)\n ON CONFLICT (user_id) WHERE id = ? DO UPDATE\n SET\n last_update = excluded.last_update,\n username = excluded.username,\n pp_std = excluded.pp_std,\n pp_taiko = excluded.pp_taiko,\n pp_mania = excluded.pp_mania,\n pp_catch = excluded.pp_catch,\n failures = excluded.failures\n ", "describe": { "columns": [], "parameters": { @@ -8,5 +8,5 @@ }, "nullable": [] }, - "hash": "e17f70eb4375790907c7ecec1132cab859a7a18a8ce636f0b39c0b5387d9dffc" + "hash": "26a910506c0613936be169df13320dfd7f9d3df62a35ba63c61efc5de70e750d" } diff --git a/youmubot-db-sql/src/models/osu_user.rs b/youmubot-db-sql/src/models/osu_user.rs index bef42b2..3de2487 100644 --- a/youmubot-db-sql/src/models/osu_user.rs +++ b/youmubot-db-sql/src/models/osu_user.rs @@ -95,6 +95,7 @@ impl OsuUser { ON CONFLICT (user_id) WHERE id = ? DO UPDATE SET last_update = excluded.last_update, + username = excluded.username, pp_std = excluded.pp_std, pp_taiko = excluded.pp_taiko, pp_mania = excluded.pp_mania,