mirror of
https://github.com/Unleash/unleash.git
synced 2025-04-15 01:16:22 +02:00
task: make setting service handle conflict on insert
Currently, in enterprise we're struggling with setting service and transactionality; all our verfications says that the setting key is not present, so setting-store happily tries to insert a new row with a new PK. However, somehow at the same time, the key already exists. This commit adds conflict handling to the insertNewRow.
This commit is contained in:
parent
4d582aac5a
commit
cb6af7b902
File diff suppressed because one or more lines are too long
@ -1,3 +1,3 @@
|
||||
nodeLinker: node-modules
|
||||
|
||||
yarnPath: .yarn/releases/yarn-4.5.3.cjs
|
||||
yarnPath: .yarn/releases/yarn-4.6.0.cjs
|
||||
|
@ -251,5 +251,5 @@
|
||||
"yarn biome format --write --no-errors-on-unmatched"
|
||||
]
|
||||
},
|
||||
"packageManager": "yarn@4.5.3"
|
||||
"packageManager": "yarn@4.6.0"
|
||||
}
|
||||
|
@ -33,7 +33,10 @@ export default class SettingStore implements ISettingStore {
|
||||
}
|
||||
|
||||
async insertNewRow(name: string, content: any) {
|
||||
return this.db(TABLE).insert({ name, content });
|
||||
return this.db(TABLE)
|
||||
.insert({ name, content })
|
||||
.onConflict('name')
|
||||
.merge();
|
||||
}
|
||||
|
||||
async exists(name: string): Promise<boolean> {
|
||||
|
Loading…
Reference in New Issue
Block a user