v0.1.18 - 설정 화면과 기간형 D-DAY 관리 추가

This commit is contained in:
2026-04-22 09:47:04 +09:00
parent 4355185203
commit fe538fc88b
13 changed files with 1033 additions and 173 deletions

View File

@@ -1,5 +1,14 @@
import { sqlite } from './client.js'
function ensureColumn(tableName, columnName, definition) {
const columns = sqlite.prepare(`PRAGMA table_info(${tableName})`).all()
const hasColumn = columns.some((column) => column.name === columnName)
if (!hasColumn) {
sqlite.exec(`ALTER TABLE ${tableName} ADD COLUMN ${columnName} ${definition}`)
}
}
export function ensureDatabaseSchema() {
sqlite.exec(`
CREATE TABLE IF NOT EXISTS users (
@@ -38,6 +47,8 @@ export function ensureDatabaseSchema() {
user_id INTEGER NOT NULL,
title TEXT NOT NULL,
target_date TEXT NOT NULL,
active_from TEXT,
active_until TEXT,
status TEXT NOT NULL DEFAULT 'active',
color TEXT NOT NULL DEFAULT '#1c1917',
created_at INTEGER NOT NULL,
@@ -46,4 +57,7 @@ export function ensureDatabaseSchema() {
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
);
`)
ensureColumn('goals', 'active_from', 'TEXT')
ensureColumn('goals', 'active_until', 'TEXT')
}