From 65fcc3119c334b75dd13bcfdebf186afdc580a8f Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 15 May 2017 22:22:03 +0200 Subject: First typescript iteration --- server/models/application.js | 52 -------------------------------------------- 1 file changed, 52 deletions(-) delete mode 100644 server/models/application.js (limited to 'server/models/application.js') 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 @@ -'use strict' - -module.exports = function (sequelize, DataTypes) { - const Application = sequelize.define('Application', - { - migrationVersion: { - type: DataTypes.INTEGER, - defaultValue: 0, - allowNull: false, - validate: { - isInt: true - } - } - }, - { - classMethods: { - loadMigrationVersion, - updateMigrationVersion - } - } - ) - - return Application -} - -// --------------------------------------------------------------------------- - -function loadMigrationVersion (callback) { - const query = { - attributes: [ 'migrationVersion' ] - } - - return this.findOne(query).asCallback(function (err, data) { - const version = data ? data.migrationVersion : null - - return callback(err, version) - }) -} - -function updateMigrationVersion (newVersion, transaction, callback) { - const options = { - where: {} - } - - if (!callback) { - transaction = callback - } else { - options.transaction = transaction - } - - return this.update({ migrationVersion: newVersion }, options).asCallback(callback) -} -- cgit v1.2.3