mirror of
https://github.com/strapi/strapi.git
synced 2025-12-05 11:32:13 +00:00
Update transaction to its latest API
This commit is contained in:
parent
950dda7877
commit
0546a826b7
@ -55,7 +55,8 @@ const init = (licenseDir, logger) => {
|
||||
* Store the result in database to avoid unecessary requests, and will fallback to that in case of a network failure.
|
||||
*/
|
||||
const onlineUpdate = async ({ strapi }) => {
|
||||
const transaction = await strapi.db.transaction();
|
||||
const { get, commit, rollback } = await strapi.db.transaction();
|
||||
const transaction = get();
|
||||
|
||||
try {
|
||||
const storedInfo = await strapi.db
|
||||
@ -111,10 +112,10 @@ const onlineUpdate = async ({ strapi }) => {
|
||||
await query.execute();
|
||||
}
|
||||
|
||||
await transaction.commit();
|
||||
await commit();
|
||||
} catch (error) {
|
||||
// Example of errors: SQLite does not support FOR UPDATE
|
||||
await transaction.rollback();
|
||||
await rollback();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user