feat: sync database

This commit is contained in:
karishmas6
2024-09-24 18:00:25 +05:30
parent 1bcc8d372b
commit f671014444

View File

@@ -23,4 +23,14 @@ export const connectDB = async () => {
}
};
export const syncDB = async () => {
try {
await sequelize.sync({ force: false }); // force: true will drop and recreate tables on every run
console.log('Database synced successfully!');
} catch (error) {
console.error('Failed to sync database:', error);
}
};
export default sequelize;