feat: Implement file upload and management system with database integration
This commit is contained in:
28
update-admin-username.js
Normal file
28
update-admin-username.js
Normal file
@@ -0,0 +1,28 @@
|
||||
import Database from "better-sqlite3";
|
||||
|
||||
const db = new Database("./data/database.sqlite");
|
||||
|
||||
console.log("🔄 Updating admin username...");
|
||||
|
||||
try {
|
||||
// Update admin username from email to simple "admin"
|
||||
const result = db.prepare('UPDATE users SET username = ? WHERE username = ?').run('admin', 'admin@localhost.com');
|
||||
|
||||
if (result.changes > 0) {
|
||||
console.log('✅ Admin username updated to "admin"');
|
||||
} else {
|
||||
console.log('ℹ️ No admin user found with email "admin@localhost.com"');
|
||||
}
|
||||
|
||||
// Show current users
|
||||
const users = db.prepare("SELECT name, username, role FROM users").all();
|
||||
console.log("\nCurrent users:");
|
||||
users.forEach(user => {
|
||||
console.log(` - ${user.name} (${user.role}): username="${user.username}"`);
|
||||
});
|
||||
|
||||
} catch (error) {
|
||||
console.error("❌ Error:", error.message);
|
||||
} finally {
|
||||
db.close();
|
||||
}
|
||||
Reference in New Issue
Block a user