Files
peworkshop/migrations/create_hunt_timer_table.js
T

27 lines
755 B
JavaScript

import { run } from "@/lib/db";
export async function createHuntTimerTable() {
console.log("Creating hunt_timer table...");
try {
await run(`
CREATE TABLE IF NOT EXISTS hunt_timer (
id INTEGER PRIMARY KEY AUTOINCREMENT,
active INTEGER NOT NULL DEFAULT 0,
start_time TEXT NOT NULL,
end_time TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)
`);
console.log("hunt_timer table created successfully");
return { success: true };
} catch (error) {
console.error("Error creating hunt_timer table:", error);
return { success: false, error };
}
}
// Run this migration if you want to execute it directly:
// createHuntTimerTable().then(console.log).catch(console.error);