tududi/backend/scripts/db-reset.js
Antonis Anastasiadis e594d1075b
Linting cleanup (#99)
* Add eslint and prettier dependencies and configs

* Lint project.
2025-07-01 11:40:09 +03:00

27 lines
691 B
JavaScript
Executable file

#!/usr/bin/env node
/**
* Database Reset Script
* Resets the database by dropping and recreating all tables
*/
require('dotenv').config();
const { sequelize } = require('../models');
async function resetDatabase() {
try {
console.log('Resetting database...');
console.log('WARNING: This will permanently delete all data!');
await sequelize.sync({ force: true });
console.log('✅ Database reset successfully');
console.log('All tables have been dropped and recreated');
process.exit(0);
} catch (error) {
console.error('❌ Error resetting database:', error.message);
process.exit(1);
}
}
resetDatabase();