bunch of shit

This commit is contained in:
kittentm 2026-08-05 06:36:58 +02:00
commit 0f577eef4d
Signed by: kitten
GPG key ID: 394B4EABE4405A83
22 changed files with 2889 additions and 37 deletions

View file

@ -28,7 +28,35 @@ const initDb = async () => {
ALTER TABLE users ADD COLUMN IF NOT EXISTS pid INTEGER;
`)
console.log('[DB INIT]: Table "users" checked/updated successfully.')
await pool.query(`
CREATE TABLE IF NOT EXISTS audit_logs (
id SERIAL PRIMARY KEY,
log_id VARCHAR(255) UNIQUE NOT NULL,
editor_sfid VARCHAR(255),
editor_pid INTEGER,
target_name VARCHAR(255),
target_pid INTEGER,
changes JSONB NOT NULL,
created_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP
);
`)
await pool.query(`
CREATE TABLE IF NOT EXISTS ban_logs (
id SERIAL PRIMARY KEY,
log_id VARCHAR(255) UNIQUE NOT NULL,
target_pid INTEGER NOT NULL,
target_name VARCHAR(255),
editor_sfid VARCHAR(255),
editor_pid INTEGER,
ban_level INTEGER NOT NULL,
reason VARCHAR(255) NOT NULL,
mod_note TEXT NOT NULL,
created_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP
);
`)
console.log('[DB INIT]: Tables "users", "audit_logs", and "ban_logs" checked/updated successfully.')
} catch (err) {
console.error('[DB INIT ERROR]:', err)
}