
import db from '../src/database/models/index.ts';

const syncDb = async () => {
    try {
        console.log('Connecting to database...');
        await db.sequelize.authenticate();
        console.log('Database connected.');

        console.log('Syncing database schema (alter: true)...');
        await db.sequelize.sync({ alter: true });
        console.log('Database synced successfully.');

        process.exit(0);
    } catch (error) {
        console.error('Error syncing database:', error);
        process.exit(1);
    }
};

syncDb();
