the-tip-top-backend/scripts/delete-all-tickets.js
soufiane 33668e5a64 fix: resolve all ESLint warnings and update dependencies
- Remove unused variables and imports across codebase
- Use empty catch blocks where error object not needed
- Remove unused fs, path imports from apply-grand-prize-migration.js
- Remove unused OAuth2Client from oauth.controller.js
- Update dependencies to latest patch versions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-27 10:49:45 +01:00

35 lines
1.3 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { pool } from '../db.js';
const deleteAllTickets = async () => {
try {
console.log('🗑️ Suppression de tous les tickets...\n');
// Compter les tickets avant suppression
const countResult = await pool.query('SELECT COUNT(*) as count FROM tickets');
const totalTickets = parseInt(countResult.rows[0].count);
if (totalTickets === 0) {
console.log(' Aucun ticket à supprimer. La table est déjà vide.\n');
process.exit(0);
}
console.log(`📊 Nombre de tickets trouvés: ${totalTickets}`);
console.log('⚠️ Suppression en cours...\n');
// Supprimer tous les tickets
await pool.query('DELETE FROM tickets');
console.log('✅ Suppression terminée!\n');
console.log('═══════════════════════════════════════════════════');
console.log(`🗑️ ${totalTickets} ticket(s) supprimé(s)`);
console.log('═══════════════════════════════════════════════════\n');
process.exit(0);
} catch (error) {
console.error('❌ Erreur lors de la suppression:', error.message);
process.exit(1);
}
};
deleteAllTickets();