Migrate config to PostgreSQL

This commit is contained in:
mstfyldz
2026-05-27 16:53:06 +03:00
parent 10f7ee95dd
commit a5951a97e9
6 changed files with 117 additions and 48 deletions
+26 -1
View File
@@ -33,8 +33,33 @@ pool.query(`
);
CREATE INDEX IF NOT EXISTS idx_pv_domain ON pageviews(domain, ts DESC);
CREATE INDEX IF NOT EXISTS idx_pv_ts ON pageviews(ts DESC);
`).catch(console.error)
CREATE TABLE IF NOT EXISTS config_sites (
id TEXT PRIMARY KEY,
name TEXT NOT NULL,
url TEXT NOT NULL,
interval_min INTEGER
);
CREATE TABLE IF NOT EXISTS config_databases (
id TEXT PRIMARY KEY,
name TEXT NOT NULL,
host TEXT NOT NULL,
port INTEGER NOT NULL,
database TEXT NOT NULL,
username TEXT NOT NULL,
password TEXT NOT NULL,
ssl BOOLEAN NOT NULL DEFAULT FALSE,
color TEXT
);
CREATE TABLE IF NOT EXISTS config_services (
id TEXT PRIMARY KEY,
name TEXT NOT NULL,
url TEXT NOT NULL,
icon TEXT,
description TEXT
);
`).catch(console.error)
export type PingLog = {
id: number
site_id: string