"use strict";

module.exports = {
  up: (queryInterface, Sequelize) => {
    const tableFields = {
      id: {
        type: Sequelize.BIGINT,
        autoIncrement: true,
        primaryKey: true,
        allowNull: false
      },
      kiviAdId: {
        type: Sequelize.UUID,
        allowNull: false,
        references: {
          model: "KiviOriginal",
          key: "kiviAdId"
        }
      },
      photoUrl: {
        type: Sequelize.TEXT,
        allowNull: false
      },
      createdAt: {
        type: Sequelize.DATE,
        defaultValue: Sequelize.literal("NOW()")
      },
      updatedAt: {
        type: Sequelize.DATE,
        defaultValue: Sequelize.literal("NOW()")
      }
    };
    return queryInterface.createTable("KiviOriginalAdsPhotos", tableFields);
  },

  down: (queryInterface, Sequelize) => {
    return queryInterface.dropTable("KiviOriginalAdsPhotos", {});
  }
};
