text: 'use strict';
  
  var Sequelize = require('sequelize');
  
  /**
   * Actions summary:
   *
   * removeColumn "name" from table "rooms"
   *
   **/
  
  var info = {
      "revision": 6,
      "name": "noname",
      "created": "2020-03-19T12:09:56.866Z",
      "comment": ""
  };
  
  var migrationCommands = function(transaction) {
      return [{
          fn: "removeColumn",
          params: [
              "rooms",
              "name",
              {
                  transaction: transaction
              }
          ]
      }];
  };
  var rollbackCommands = function(transaction) {
      return [{
          fn: "addColumn",
          params: [
              "rooms",
              "name",
              {
                  "type": Sequelize.STRING,
                  "field": "name",
                  "allowNull": false
              },
              {
                  transaction: transaction
              }
          ]
      }];
  };
  
  module.exports = {
      pos: 0,
      useTransaction: true,
      execute: function(queryInterface, Sequelize, _commands)
      {
          var index = this.pos;
          function run(transaction) {
              const commands = _commands(transaction);
              return new Promise(function(resolve, reject) {
                  function next() {
                      if (index < commands.length)
                      {
                          let command = commands[index];
                          console.log("[#"+index+"] execute: " + command.fn);
                          index++;
                          queryInterface[command.fn].apply(queryInterface, command.params).then(next, reject);
                      }
                      else
                          resolve();
                  }
                  next();
              });
          }
          if (this.useTransaction) {
              return queryInterface.sequelize.transaction(run);
          } else {
              return run(null);
          }
      },
      up: function(queryInterface, Sequelize)
      {
          return this.execute(queryInterface, Sequelize, migrationCommands);
      },
      down: function(queryInterface, Sequelize)
      {
          return this.execute(queryInterface, Sequelize, rollbackCommands);
      },
      info: info
  };
  