Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/storage/providers/SQLiteProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ const provider: StorageProvider<NitroSQLiteConnection | undefined> = {
throw new Error('Store is not initialized!');
}

const query = 'REPLACE INTO keyvaluepairs (record_key, valueJSON) VALUES (?, json(?));';
const query = 'REPLACE INTO keyvaluepairs (record_key, valueJSON) VALUES (?, ?);';
const params = pairs.map((pair) => [pair[0], JSON.stringify(pair[1] === undefined ? null : pair[1])]);
if (utils.isEmptyObject(params)) {
return Promise.resolve();
Expand All @@ -143,15 +143,15 @@ const provider: StorageProvider<NitroSQLiteConnection | undefined> = {

// Query to merge the change into the DB value.
const patchQuery = `INSERT INTO keyvaluepairs (record_key, valueJSON)
VALUES (:key, JSON(:value))
VALUES (:key, :value)
ON CONFLICT DO UPDATE
SET valueJSON = JSON_PATCH(valueJSON, JSON(:value));
SET valueJSON = JSON_PATCH(valueJSON, :value);
`;
const patchQueryArguments: string[][] = [];

// Query to fully replace the nested objects of the DB value.
const replaceQuery = `UPDATE keyvaluepairs
SET valueJSON = JSON_REPLACE(valueJSON, ?, JSON(?))
SET valueJSON = JSON_REPLACE(valueJSON, ?, ?)
WHERE record_key = ?;
`;
const replaceQueryArguments: string[][] = [];
Expand Down
Loading