diff options
Diffstat (limited to 'server/models/application.js')
-rw-r--r-- | server/models/application.js | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/server/models/application.js b/server/models/application.js deleted file mode 100644 index 64e1a0540..000000000 --- a/server/models/application.js +++ /dev/null | |||
@@ -1,52 +0,0 @@ | |||
1 | 'use strict' | ||
2 | |||
3 | module.exports = function (sequelize, DataTypes) { | ||
4 | const Application = sequelize.define('Application', | ||
5 | { | ||
6 | migrationVersion: { | ||
7 | type: DataTypes.INTEGER, | ||
8 | defaultValue: 0, | ||
9 | allowNull: false, | ||
10 | validate: { | ||
11 | isInt: true | ||
12 | } | ||
13 | } | ||
14 | }, | ||
15 | { | ||
16 | classMethods: { | ||
17 | loadMigrationVersion, | ||
18 | updateMigrationVersion | ||
19 | } | ||
20 | } | ||
21 | ) | ||
22 | |||
23 | return Application | ||
24 | } | ||
25 | |||
26 | // --------------------------------------------------------------------------- | ||
27 | |||
28 | function loadMigrationVersion (callback) { | ||
29 | const query = { | ||
30 | attributes: [ 'migrationVersion' ] | ||
31 | } | ||
32 | |||
33 | return this.findOne(query).asCallback(function (err, data) { | ||
34 | const version = data ? data.migrationVersion : null | ||
35 | |||
36 | return callback(err, version) | ||
37 | }) | ||
38 | } | ||
39 | |||
40 | function updateMigrationVersion (newVersion, transaction, callback) { | ||
41 | const options = { | ||
42 | where: {} | ||
43 | } | ||
44 | |||
45 | if (!callback) { | ||
46 | transaction = callback | ||
47 | } else { | ||
48 | options.transaction = transaction | ||
49 | } | ||
50 | |||
51 | return this.update({ migrationVersion: newVersion }, options).asCallback(callback) | ||
52 | } | ||