mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-13 08:52:16 +00:00
fix(store_sqlite): Principal upsert
This commit is contained in:
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"db_name": "SQLite",
|
||||
"query": "\n REPLACE INTO principals\n (id, displayname, principal_type, password_hash)\n VALUES (?, ?, ?, ?)\n ",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 4
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "2f043f62a7c0eae1023e319f0bc8f35dfdcf6a8247e03b1de3e2cabb2d3ab8ae"
|
||||
}
|
||||
12
.sqlx/query-5c09c2a3c052188435409d4ff076575394e625dd19f00dea2d4c71a9f34a5952.json
generated
Normal file
12
.sqlx/query-5c09c2a3c052188435409d4ff076575394e625dd19f00dea2d4c71a9f34a5952.json
generated
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"db_name": "SQLite",
|
||||
"query": "\n INSERT INTO principals\n (id, displayname, principal_type, password_hash) VALUES (?, ?, ?, ?)\n ON CONFLICT(id) DO UPDATE SET\n (displayname, principal_type, password_hash)\n = (excluded.displayname, excluded.principal_type, excluded.password_hash)\n ",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 4
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "5c09c2a3c052188435409d4ff076575394e625dd19f00dea2d4c71a9f34a5952"
|
||||
}
|
||||
@@ -114,9 +114,11 @@ impl AuthenticationProvider for SqlitePrincipalStore {
|
||||
let password = user.password.map(Secret::into_inner);
|
||||
sqlx::query!(
|
||||
r#"
|
||||
REPLACE INTO principals
|
||||
(id, displayname, principal_type, password_hash)
|
||||
VALUES (?, ?, ?, ?)
|
||||
INSERT INTO principals
|
||||
(id, displayname, principal_type, password_hash) VALUES (?, ?, ?, ?)
|
||||
ON CONFLICT(id) DO UPDATE SET
|
||||
(displayname, principal_type, password_hash)
|
||||
= (excluded.displayname, excluded.principal_type, excluded.password_hash)
|
||||
"#,
|
||||
user.id,
|
||||
user.displayname,
|
||||
|
||||
Reference in New Issue
Block a user