aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/application.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-05-15 22:22:03 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-05-20 09:57:40 +0200
commit65fcc3119c334b75dd13bcfdebf186afdc580a8f (patch)
tree4f2158c61a9b7c3f47cfa233d01413b946ee53c0 /server/models/application.js
parentd5f345ed4cfac4e1fa84dcb4fce1cda4d32f9c73 (diff)
downloadPeerTube-65fcc3119c334b75dd13bcfdebf186afdc580a8f.tar.gz
PeerTube-65fcc3119c334b75dd13bcfdebf186afdc580a8f.tar.zst
PeerTube-65fcc3119c334b75dd13bcfdebf186afdc580a8f.zip
First typescript iteration
Diffstat (limited to 'server/models/application.js')
-rw-r--r--server/models/application.js52
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
3module.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
28function 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
40function 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}