UpgradeBase.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /**
  2. * Licensed Materials - Property of IBM
  3. * IBM Watson Analytics (C) Copyright IBM Corp. 2016
  4. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  5. *
  6. */
  7. /* jshint ignore:start */
  8. if (typeof define !== 'function') { // NOSONAR
  9. var define = require('amdefine')(module); // NOSONAR
  10. }
  11. /* jshint ignore:end */
  12. define([
  13. 'bluebird'
  14. ],
  15. function(Promise) {
  16. 'use strict';
  17. var Upgrade = function() {
  18. /**
  19. * This is an integer value. The higher the value the higher the version. i.e. 3 < 500
  20. * @type {integer}
  21. */
  22. this.VERSION = null;
  23. };
  24. /**
  25. * This performs a migration from an older version to a newer version
  26. * @param {obj} obj - The javascript object to perform migration on
  27. * @return {promise} - resolved with the upgraded object
  28. */
  29. Upgrade.prototype.up = function (obj) {
  30. return Promise.resolve(obj);
  31. };
  32. /**
  33. * This performs a migration from a newer version to a older version
  34. * It is important not to remove any data, otherwise downgrades are not possible
  35. * @param {obj} obj - The javascript object to perform migration on
  36. * @return {promise} - resolved with the downgraded object
  37. */
  38. Upgrade.prototype.down = function (obj) {
  39. return Promise.resolve(obj);
  40. };
  41. return Upgrade;
  42. });