feat: Implement comments, notifications, and custom emojis with new API routes, UI components, and database migrations.
This commit is contained in:
22
debug/init_comments.mjs
Normal file
22
debug/init_comments.mjs
Normal file
@@ -0,0 +1,22 @@
|
||||
import db from "../src/inc/sql.mjs";
|
||||
import { promises as fs } from "fs";
|
||||
|
||||
(async () => {
|
||||
try {
|
||||
const migration = await fs.readFile("./migration_comments.sql", "utf-8");
|
||||
console.log("Applying migration...");
|
||||
// Split by semicolon to handle multiple statements if the driver requires it,
|
||||
// but postgres.js usually handles simple files well or we can execute as one block
|
||||
// if it's just DDL. However, postgres.js template literal usually prefers single statements
|
||||
// or we can use `db.file` if available, or just execute the string.
|
||||
|
||||
// Simple approach: execute the whole string
|
||||
await db.unsafe(migration);
|
||||
|
||||
console.log("Migration applied successfully.");
|
||||
process.exit(0);
|
||||
} catch (e) {
|
||||
console.error("Migration failed:", e);
|
||||
process.exit(1);
|
||||
}
|
||||
})();
|
||||
Reference in New Issue
Block a user