import { run } from "./db.js"; async function initializeDatabase() { try { // Create users table await run(` CREATE TABLE IF NOT EXISTS users ( id INTEGER PRIMARY KEY AUTOINCREMENT, username TEXT UNIQUE NOT NULL, password TEXT NOT NULL, role TEXT DEFAULT 'user', team_id INTEGER, created_at DATETIME DEFAULT CURRENT_TIMESTAMP ) `); // Create teams table await run(` CREATE TABLE IF NOT EXISTS teams ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL, code TEXT UNIQUE NOT NULL, created_at DATETIME DEFAULT CURRENT_TIMESTAMP ) `); console.log("Database initialized successfully"); } catch (error) { console.error("Database initialization error:", error); } } initializeDatabase();