feat: call setupAssociations() before sync

This commit is contained in:
karishmas6
2024-10-09 23:07:09 +05:30
parent 5316b915dd
commit 981f75c9c6

View File

@@ -1,5 +1,6 @@
import { Sequelize } from 'sequelize';
import dotenv from 'dotenv';
import setupAssociations from '../models/associations';
dotenv.config();
const sequelize = new Sequelize(
@@ -22,6 +23,7 @@ export const connectDB = async () => {
export const syncDB = async () => {
try {
//setupAssociations();
await sequelize.sync({ force: false }); // force: true will drop and recreate tables on every run
console.log('Database synced successfully!');
} catch (error) {