diff options
Diffstat (limited to 'server/models/shared/update.ts')
-rw-r--r-- | server/models/shared/update.ts | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/server/models/shared/update.ts b/server/models/shared/update.ts index d338211e3..d02c4535d 100644 --- a/server/models/shared/update.ts +++ b/server/models/shared/update.ts | |||
@@ -1,9 +1,15 @@ | |||
1 | import { QueryTypes, Transaction } from 'sequelize' | 1 | import { QueryTypes, Sequelize, Transaction } from 'sequelize' |
2 | import { sequelizeTypescript } from '@server/initializers/database' | ||
3 | 2 | ||
4 | // Sequelize always skip the update if we only update updatedAt field | 3 | // Sequelize always skip the update if we only update updatedAt field |
5 | function setAsUpdated (table: string, id: number, transaction?: Transaction) { | 4 | function setAsUpdated (options: { |
6 | return sequelizeTypescript.query( | 5 | sequelize: Sequelize |
6 | table: string | ||
7 | id: number | ||
8 | transaction?: Transaction | ||
9 | }) { | ||
10 | const { sequelize, table, id, transaction } = options | ||
11 | |||
12 | return sequelize.query( | ||
7 | `UPDATE "${table}" SET "updatedAt" = :updatedAt WHERE id = :id`, | 13 | `UPDATE "${table}" SET "updatedAt" = :updatedAt WHERE id = :id`, |
8 | { | 14 | { |
9 | replacements: { table, id, updatedAt: new Date() }, | 15 | replacements: { table, id, updatedAt: new Date() }, |