feat: add archived column to sessions table and isSunday helper
Made-with: Cursor
This commit is contained in:
@@ -56,6 +56,13 @@ function initializeDatabase() {
|
|||||||
)
|
)
|
||||||
`);
|
`);
|
||||||
|
|
||||||
|
// Add archived column if it doesn't exist (for existing databases)
|
||||||
|
try {
|
||||||
|
db.exec(`ALTER TABLE sessions ADD COLUMN archived INTEGER DEFAULT 0`);
|
||||||
|
} catch (err) {
|
||||||
|
// Column already exists, ignore error
|
||||||
|
}
|
||||||
|
|
||||||
// Session games table
|
// Session games table
|
||||||
db.exec(`
|
db.exec(`
|
||||||
CREATE TABLE IF NOT EXISTS session_games (
|
CREATE TABLE IF NOT EXISTS session_games (
|
||||||
|
|||||||
@@ -47,3 +47,12 @@ export function formatLocalDateTime(sqliteTimestamp) {
|
|||||||
return parseUTCTimestamp(sqliteTimestamp).toLocaleString();
|
return parseUTCTimestamp(sqliteTimestamp).toLocaleString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if a SQLite timestamp falls on a Sunday (in local timezone)
|
||||||
|
* @param {string} sqliteTimestamp
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
export function isSunday(sqliteTimestamp) {
|
||||||
|
return parseUTCTimestamp(sqliteTimestamp).getDay() === 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user