]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/models/shared/update.ts
Move test functions outside extra-utils
[github/Chocobozzz/PeerTube.git] / server / models / shared / update.ts
CommitLineData
fa47956e
C
1import { QueryTypes, Transaction } from 'sequelize'
2import { sequelizeTypescript } from '@server/initializers/database'
3
4// Sequelize always skip the update if we only update updatedAt field
5function setAsUpdated (table: string, id: number, transaction?: Transaction) {
6 return sequelizeTypescript.query(
7 `UPDATE "${table}" SET "updatedAt" = :updatedAt WHERE id = :id`,
8 {
9 replacements: { table, id, updatedAt: new Date() },
10 type: QueryTypes.UPDATE,
11 transaction
12 }
13 )
14}
15
16export {
17 setAsUpdated
18}