"use strict";

module.exports = {
  up: async (queryInterface, Sequelize) => {
    // Rename image fields to consistent naming convention
    // Using TEXT type for all to support long URLs/paths
    await queryInterface.renameColumn("Items", "images", "imageFilenames");
    await queryInterface.renameColumn("Users", "profileImage", "imageFilename");
    await queryInterface.renameColumn("Messages", "imagePath", "imageFilename");
    await queryInterface.renameColumn("ConditionChecks", "photos", "imageFilenames");
    await queryInterface.renameColumn("ForumPosts", "images", "imageFilenames");
    await queryInterface.renameColumn("ForumComments", "images", "imageFilenames");
  },

  down: async (queryInterface, Sequelize) => {
    // Revert to original column names
    await queryInterface.renameColumn("Items", "imageFilenames", "images");
    await queryInterface.renameColumn("Users", "imageFilename", "profileImage");
    await queryInterface.renameColumn("Messages", "imageFilename", "imagePath");
    await queryInterface.renameColumn("ConditionChecks", "imageFilenames", "photos");
    await queryInterface.renameColumn("ForumPosts", "imageFilenames", "images");
    await queryInterface.renameColumn("ForumComments", "imageFilenames", "images");
  },
};
