v3: fixed docker image, updated locales
All checks were successful
Build and Publish Docker Image / build-and-push (push) Successful in 39s

This commit is contained in:
khannurien
2026-06-21 14:38:17 +00:00
parent 7afb5d3f07
commit 3d03c9e69c
12 changed files with 451 additions and 357 deletions

View File

@@ -0,0 +1,27 @@
import type { DatabaseSync } from "node:sqlite";
// Idempotent: safe to run against a fresh db (already created from schema.sql
// with these columns/tables) or an existing one that predates them.
export function up(db: DatabaseSync): void {
const commentCols = db.prepare(`PRAGMA table_info(comments);`).all() as {
name: string;
}[];
if (!commentCols.some((c) => c.name === "like_count")) {
db.exec(
`ALTER TABLE comments ADD COLUMN like_count INTEGER NOT NULL DEFAULT 0;`,
);
}
db.exec(`CREATE TABLE IF NOT EXISTS comment_likes (
comment_id TEXT NOT NULL,
user_id TEXT NOT NULL,
created_at TEXT NOT NULL,
PRIMARY KEY (comment_id, user_id),
FOREIGN KEY (comment_id) REFERENCES comments(id) ON DELETE CASCADE,
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
);`);
db.exec(
`CREATE INDEX IF NOT EXISTS idx_comment_likes_user ON comment_likes(user_id);`,
);
}