module.exports = {
  up: (queryInterface, Sequelize) => {
    return queryInterface.sequelize.transaction(t => {
      return Promise.all([
        queryInterface.removeColumn("RealEstateRequests", "sizeRange", {
          transaction: t
        }),
        queryInterface.removeColumn("RealEstateRequests", "gardenSizeRange", {
          transaction: t
        }),
        queryInterface.removeColumn("RealEstateRequests", "priceRange", {
          transaction: t
        }),
        queryInterface.removeColumn("RealEstateRequests", "size", {
          transaction: t
        }),
        queryInterface.removeColumn("RealEstateRequests", "gardenSize", {
          transaction: t
        }),
        queryInterface.removeColumn("RealEstateRequests", "price", {
          transaction: t
        }),
        queryInterface.addColumn(
          "RealEstateRequests",
          "gardenSizeMin",
          {
            type: Sequelize.INTEGER
          },
          { transaction: t }
        ),
        queryInterface.addColumn(
          "RealEstateRequests",
          "gardenSizeMax",
          {
            type: Sequelize.INTEGER
          },
          { transaction: t }
        ),
        queryInterface.addColumn(
          "RealEstateRequests",
          "sizeMin",
          {
            type: Sequelize.INTEGER
          },
          { transaction: t }
        ),
        queryInterface.addColumn(
          "RealEstateRequests",
          "sizeMax",
          {
            type: Sequelize.INTEGER
          },
          { transaction: t }
        ),
        queryInterface.addColumn(
          "RealEstateRequests",
          "priceMin",
          {
            type: Sequelize.INTEGER
          },
          { transaction: t }
        ),
        queryInterface.addColumn(
          "RealEstateRequests",
          "priceMax",
          {
            type: Sequelize.INTEGER
          },
          { transaction: t }
        )
      ]);
    });
  },

  down: (queryInterface, Sequelize) => {
    return queryInterface.sequelize.transaction(t => {
      return Promise.all([
        queryInterface.removeColumn("RealEstateRequests", "gardenSizeMin", {
          transaction: t
        }),
        queryInterface.removeColumn("RealEstateRequests", "gardenSizeMax", {
          transaction: t
        }),
        queryInterface.removeColumn("RealEstateRequests", "sizeMin", {
          transaction: t
        }),
        queryInterface.removeColumn("RealEstateRequests", "sizeMax", {
          transaction: t
        }),
        queryInterface.removeColumn("RealEstateRequests", "priceMin", {
          transaction: t
        }),
        queryInterface.removeColumn("RealEstateRequests", "priceMin", {
          transaction: t
        }),
        queryInterface.addColumn(
          "RealEstateRequests",
          "priceMax",
          {
            type: Sequelize.STRING
          },
          { transaction: t }
        ),
        queryInterface.addColumn(
          "RealEstateRequests",
          "gardenSizeRange",
          {
            type: Sequelize.STRING
          },
          { transaction: t }
        ),
        queryInterface.addColumn(
          "RealEstateRequests",
          "priceRange",
          {
            type: Sequelize.STRING
          },
          { transaction: t }
        ),
        queryInterface.addColumn(
          "RealEstateRequests",
          "size",
          {
            type: Sequelize.STRING
          },
          { transaction: t }
        ),
        queryInterface.addColumn(
          "RealEstateRequests",
          "gardenSize",
          {
            type: Sequelize.STRING
          },
          { transaction: t }
        ),
        queryInterface.addColumn(
          "RealEstateRequests",
          "price",
          {
            type: Sequelize.STRING
          },
          { transaction: t }
        )
      ]);
    });
  }
};
