import sequelize from "./sequelize";
import User from "../models/User.js";
import { NextResponse } from "next/server";

export const initDb = async () => {
  try {
    await sequelize.authenticate();
    console.log("Database connected...");
   //await User.sync({ force: true }); // creates/updates tables
    console.log("Models synchronized...");
  } catch (error) {
    console.error("Database connection failed:", error);
    return NextResponse.json({
    succcess: true,
    message: "Connection Error!!!!",
  });
  }
};
