Spaces:
Paused
Paused
File size: 848 Bytes
89ec743 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | const mongoose = require('mongoose');
const config = require('../src/config');
require('dotenv').config();
const fixDB = async () => {
try {
if (!process.env.MONGO_URI) {
console.error('MONGO_URI topilmadi');
process.exit(1);
}
await mongoose.connect(process.env.MONGO_URI);
console.log('✅ MongoDB ulandi');
try {
await mongoose.connection.db.dropCollection('users');
console.log('✅ Users jadvali tozalandi (eski xatoliklar ketdi)');
} catch (e) {
console.log('ℹ️ Users jadvali allaqachon toza');
}
console.log('🏁 Tayyor! Endi botni bemalol ishga tushirishingiz mumkin.');
process.exit(0);
} catch (err) {
console.error('❌ Xatolik:', err);
process.exit(1);
}
};
fixDB();
|