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,
-- 0016
`migrated` tinyint(1) DEFAULT '0'
`migrated` tinyint(1) DEFAULT '0',
-- 0019
UNIQUE (user_id, app, kkey_hash)
);
CREATE TABLE `subdomains` (

View File

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