import { pool } from "./config/db.js";

const corrections = [
  { id: 1, full_name: "María Rodríguez" },
  { id: 2, full_name: "José Castillo" },
  { id: 3, full_name: "Ana López" },
  { id: 4, full_name: "Pedro Gómez" },
  { id: 5, full_name: "Sofía Fernández" }
];

async function fix() {
  try {
    for (const c of corrections) {
      await pool.query("UPDATE customers SET full_name = ? WHERE id = ?", [c.full_name, c.id]);
      console.log(`Updated ID ${c.id} to ${c.full_name}`);
    }
    console.log("Corrections complete!");
    process.exit(0);
  } catch (err) {
    console.error(err);
    process.exit(1);
  }
}

fix();
