import { isDbReadOnly } from '../../config.js'; /** * 运行时建表守卫。 * * 只读预览(DB_READ_ONLY=1)下不允许任何 DDL。此前只读保护只按 HTTP 方法拦截, * 而建表实际由 GET 处理器触发,于是"只读"预览仍可能执行 CREATE TABLE。 */ export function ddlAllowed(): boolean { return !isDbReadOnly(); } /** 统一的跳过日志,避免每个 schema 模块各写一份。 */ export function logDdlSkipped(name: string): void { console.log(`[schema] ${name} skipped (DB_READ_ONLY=1)`); }