feat: Implement comments, notifications, and custom emojis with new API routes, UI components, and database migrations.
This commit is contained in:
34
debug/init_emojis.mjs
Normal file
34
debug/init_emojis.mjs
Normal file
@@ -0,0 +1,34 @@
|
||||
import db from "../src/inc/sql.mjs";
|
||||
|
||||
async function run() {
|
||||
try {
|
||||
console.log("Creating custom_emojis table...");
|
||||
|
||||
await db`
|
||||
CREATE TABLE IF NOT EXISTS custom_emojis (
|
||||
id SERIAL PRIMARY KEY,
|
||||
name TEXT NOT NULL UNIQUE,
|
||||
url TEXT NOT NULL,
|
||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
|
||||
)
|
||||
`;
|
||||
|
||||
// Seed with existing default emojis if table is empty
|
||||
const count = await db`SELECT count(*) FROM custom_emojis`;
|
||||
if (count[0].count == 0) {
|
||||
console.log("Seeding default emojis...");
|
||||
await db`
|
||||
INSERT INTO custom_emojis (name, url) VALUES
|
||||
('f0ck', '/s/img/f0ck.png')
|
||||
`;
|
||||
}
|
||||
|
||||
console.log("Done.");
|
||||
process.exit(0);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
run();
|
||||
Reference in New Issue
Block a user