'use strict';

module.exports = {
  up: async (queryInterface, Sequelize) => {
    await queryInterface.addColumn({
      tableName: 'contact_message',
      schema: 'service'
    }, 'answer', {
      type: Sequelize.TEXT,
      allowNull: true
    });
    await queryInterface.addColumn({
      tableName: 'contact_message',
      schema: 'service'
    }, 'answered_at', {
      type: Sequelize.DATE,
      allowNull: true
    });
    await queryInterface.addColumn({
      tableName: 'contact_message',
      schema: 'service'
    }, 'is_answered', {
      type: Sequelize.BOOLEAN,
      allowNull: false,
      defaultValue: false
    });
  },

  down: async (queryInterface, Sequelize) => {
    await queryInterface.removeColumn({
      tableName: 'contact_message',
      schema: 'service'
    }, 'answer');
    await queryInterface.removeColumn({
      tableName: 'contact_message',
      schema: 'service'
    }, 'answered_at');
    await queryInterface.removeColumn({
      tableName: 'contact_message',
      schema: 'service'
    }, 'is_answered');
  }
};
