Merge pull request #280 from vineeth-vk11/#206

fixing on conflict issue in sqlite kv write
This commit is contained in:
Eric Dubé 2024-04-15 17:55:52 -04:00 committed by GitHub
commit e4f2c4a28b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 3 deletions

View File

@ -120,7 +120,10 @@ CREATE TABLE `kv` (
`value` text, `value` text,
-- 0016 -- 0016
`migrated` tinyint(1) DEFAULT '0' `migrated` tinyint(1) DEFAULT '0',
-- 0019
UNIQUE (user_id, app, kkey_hash)
); );
CREATE TABLE `subdomains` ( CREATE TABLE `subdomains` (

View File

@ -90,8 +90,7 @@ class DBKVStore extends BaseImplementation {
VALUES (?, ?, ?, ?, ?) ` + VALUES (?, ?, ?, ?, ?) ` +
db.case({ db.case({
mysql: 'ON DUPLICATE KEY UPDATE value = ?', mysql: 'ON DUPLICATE KEY UPDATE value = ?',
sqlite: ' ', sqlite: 'ON CONFLICT(user_id, app, kkey_hash) DO UPDATE SET value = excluded.value',
// sqlite: 'ON CONFLICT(user_id, app, kkey_hash) DO UPDATE SET value = ?',
}), }),
[ [
user.id, app?.uid ?? 'global', key_hash, key, value, user.id, app?.uid ?? 'global', key_hash, key, value,