Merge asset statistics and contextual AI assistant into main
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import pool from "../mysql.js";
|
||||
import { ddlAllowed } from "./guard.js";
|
||||
|
||||
const SCHEMA = `CREATE TABLE IF NOT EXISTS bi_asset_ai_gaps (
|
||||
id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
||||
user_id VARCHAR(64) NOT NULL, fingerprint CHAR(64) NOT NULL,
|
||||
demand VARCHAR(600) NOT NULL, reason VARCHAR(24) NOT NULL, status VARCHAR(24) NOT NULL DEFAULT 'open',
|
||||
occurrences INT NOT NULL DEFAULT 1, first_seen DATETIME NOT NULL, last_seen DATETIME NOT NULL,
|
||||
UNIQUE KEY user_demand (user_id, fingerprint), KEY last_seen (last_seen)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`;
|
||||
|
||||
export async function ensureAssetAiGapTable() {
|
||||
if (!ddlAllowed()) throw new Error("只读环境不创建需求记录表。");
|
||||
await pool.query(SCHEMA);
|
||||
}
|
||||
Reference in New Issue
Block a user