From 4d6e1e1fd465901b3ab1f1b5928fb5039804a58b Mon Sep 17 00:00:00 2001 From: shufeng2012 <277665039@qq.com> Date: Wed, 12 Aug 2026 09:57:55 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8=20=E6=9B=B4=E6=96=B0=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5=E7=9B=B4=E6=8E=A5=E4=BD=BF=E7=94=A8=5Finst.sh?= =?UTF-8?q?=E7=9A=84=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _inst.sh | 41 +++++++++++++++++++++-------------------- db2/create_sqlite3.sql | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 20 deletions(-) create mode 100644 db2/create_sqlite3.sql diff --git a/_inst.sh b/_inst.sh index f85d375..7486413 100755 --- a/_inst.sh +++ b/_inst.sh @@ -2,27 +2,27 @@ set -euo pipefail run_if_exists() { - local script="$1" - echo "---- run ${script} ----" + local script="$1" + echo "---- run ${script} ----" - if [ -f "$script" ]; then - bash "$script" - fi + if [ -f "$script" ]; then + bash "$script" + fi } inst_module() { - local module="$1" - echo "======== Install ${module} ========" + local module="$1" + echo "======== Install ${module} ========" - local set_file="./${module}/_set.sh" + local set_file="./${module}/_set.sh" - if [ -f "$set_file" ]; then - run_if_exists "$set_file" - return 0 - else - echo "Failed" >&2 - return 1 - fi + if [ -f "$set_file" ]; then + run_if_exists "$set_file" + return 0 + else + echo "Failed" >&2 + return 1 + fi } inst_module "libth" @@ -31,7 +31,7 @@ inst_module "libcrypt" inst_module "libsqlite3" inst_module "libmsg" inst_module "gateway" -inst_module "waf" # waf 在 gateway 之前编译,部署时由 core 先拉起 waf 再拉起 gateway +inst_module "waf" # waf 在 gateway 之前编译,部署时由 core 先拉起 waf 再拉起 gateway inst_module "static" inst_module "fsys" inst_module "dnfs" @@ -40,8 +40,9 @@ inst_module "db" inst_module "db2" inst_module "smtp" inst_module "captcha" +inst_module "captcha2" inst_module "confs" -inst_module "ai_review" # 需联网拉 chromadb onnx 模型(_fetch_onnx_model.sh 走 ModelScope 镜像) -inst_module "aibox" # 需 ~/.cert/deepseek.key(见 _setenv.sh) -inst_module "redirect80" # 80 端口重定向,依赖 ../pymsg -inst_module "core" # core last +inst_module "ai_review" # 需联网拉 chromadb onnx 模型(_fetch_onnx_model.sh 走 ModelScope 镜像) +inst_module "aibox" # 需 ~/.cert/deepseek.key(见 _setenv.sh) +inst_module "redirect80" # 80 端口重定向,依赖 ../pymsg +inst_module "core" # core last diff --git a/db2/create_sqlite3.sql b/db2/create_sqlite3.sql new file mode 100644 index 0000000..e43a1d3 --- /dev/null +++ b/db2/create_sqlite3.sql @@ -0,0 +1,39 @@ +-- Users 表创建脚本 +-- 数据库类型: SQLite + +CREATE TABLE IF NOT EXISTS Users ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + username TEXT UNIQUE NOT NULL, + password_hash TEXT NOT NULL, + create_at DATETIME DEFAULT CURRENT_TIMESTAMP, + last_login DATETIME, + is_active BOOLEAN DEFAULT 1 +); + +CREATE TABLE IF NOT EXISTS Notes ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + pid INTEGER NOT NULL, + owner VARCHAR(128) DEFAULT 'Unknow', + title VARCHAR(128) NOT NULL, + content TEXT NOT NULL +); + +-- 旧版增量 +-- ALTER TABLE Notes ADD COLUMN owner VARCHAR(128) DEFAULT 'Unknow'; + +-- ── 日志表(db 内置日志模块)───────────────────────────────────────── + +CREATE TABLE IF NOT EXISTS Logs ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + ts TEXT NOT NULL, + service TEXT NOT NULL, + level TEXT NOT NULL, + message TEXT NOT NULL, + trace_id TEXT, + extra TEXT +); + +CREATE INDEX IF NOT EXISTS idx_logs_service_ts ON Logs(service, ts); +CREATE INDEX IF NOT EXISTS idx_logs_level_ts ON Logs(level, ts); +CREATE INDEX IF NOT EXISTS idx_logs_ts ON Logs(ts); +CREATE INDEX IF NOT EXISTS idx_logs_trace ON Logs(trace_id);