diff options
author | Chocobozzz <me@florianbigard.com> | 2017-12-14 10:07:57 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2017-12-14 10:07:57 +0100 |
commit | d48ff09d27d234425c3e9f091ae9072d8e6d8b7a (patch) | |
tree | 3a842b79aec40ca55d68c1cb6cf9b8aadcf2a1d1 /server/models/application/application.ts | |
parent | 94edfc3b2a9cf83f1c9c470a76e4769bc37aad14 (diff) | |
download | PeerTube-d48ff09d27d234425c3e9f091ae9072d8e6d8b7a.tar.gz PeerTube-d48ff09d27d234425c3e9f091ae9072d8e6d8b7a.tar.zst PeerTube-d48ff09d27d234425c3e9f091ae9072d8e6d8b7a.zip |
Use sequelize scopes
Diffstat (limited to 'server/models/application/application.ts')
-rw-r--r-- | server/models/application/application.ts | 18 |
1 files changed, 0 insertions, 18 deletions
diff --git a/server/models/application/application.ts b/server/models/application/application.ts index f3c0f1052..9fc07e850 100644 --- a/server/models/application/application.ts +++ b/server/models/application/application.ts | |||
@@ -1,4 +1,3 @@ | |||
1 | import { Transaction } from 'sequelize' | ||
2 | import { AllowNull, Column, Default, IsInt, Model, Table } from 'sequelize-typescript' | 1 | import { AllowNull, Column, Default, IsInt, Model, Table } from 'sequelize-typescript' |
3 | 2 | ||
4 | @Table({ | 3 | @Table({ |
@@ -15,21 +14,4 @@ export class ApplicationModel extends Model<ApplicationModel> { | |||
15 | static countTotal () { | 14 | static countTotal () { |
16 | return ApplicationModel.count() | 15 | return ApplicationModel.count() |
17 | } | 16 | } |
18 | |||
19 | static loadMigrationVersion () { | ||
20 | const query = { | ||
21 | attributes: [ 'migrationVersion' ] | ||
22 | } | ||
23 | |||
24 | return ApplicationModel.findOne(query).then(data => data ? data.migrationVersion : null) | ||
25 | } | ||
26 | |||
27 | static updateMigrationVersion (newVersion: number, transaction: Transaction) { | ||
28 | const options = { | ||
29 | where: {}, | ||
30 | transaction: transaction | ||
31 | } | ||
32 | |||
33 | return ApplicationModel.update({ migrationVersion: newVersion }, options) | ||
34 | } | ||
35 | } | 17 | } |