"use strict";

module.exports = {
  up: (queryInterface, Sequelize) => {
    return queryInterface.sequelize.transaction(t => {
      return Promise.all([
        queryInterface.addColumn(
          "MarketAlerts",
          "size",
          {
            type: Sequelize.INTEGER
          },
          { transaction: t }
        ),
        queryInterface.addColumn(
          "MarketAlerts",
          "gardenSize",
          {
            type: Sequelize.INTEGER
          },
          { transaction: t }
        ),
        queryInterface.addColumn(
          "MarketAlerts",
          "price",
          {
            type: Sequelize.INTEGER
          },
          { transaction: t }
        ),
        queryInterface.addColumn(
          "MarketAlerts",
          "municipality",
          {
            type: Sequelize.STRING
          },
          { transaction: t }
        ),
        queryInterface.addColumn(
          "MarketAlerts",
          "region",
          {
            type: Sequelize.STRING
          },
          { transaction: t }
        )
      ]);
    });
  },

  down: (queryInterface, Sequelize) => {
    return queryInterface.sequelize.transaction(t => {
      return Promise.all([
        queryInterface.removeColumn("MarketAlerts", "size", { transaction: t }),
        queryInterface.removeColumn("MarketAlerts", "gardenSize", {
          transaction: t
        }),
        queryInterface.removeColumn("MarketAlerts", "price", {
          transaction: t
        }),
        queryInterface.removeColumn("MarketAlerts", "municipality", {
          transaction: t
        }),
        queryInterface.removeColumn("MarketAlerts", "region", {
          transaction: t
        })
      ]);
    });
  }
};
