From 92a3af229d5d0432d79d2ffdd7c84541cd4f1c68 Mon Sep 17 00:00:00 2001 From: zhishi <1951671751@qq.com> Date: Mon, 6 Apr 2026 22:15:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20=E7=94=9F=E6=88=90?= =?UTF-8?q?=E4=B8=AD=E7=8A=B6=E6=80=81=20=E5=9C=A8=E8=BD=AF=E4=BB=B6?= =?UTF-8?q?=E9=87=8D=E5=90=AF=E6=97=B6=20=E6=94=B9=E4=B8=BA=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib/fixDB.ts | 26 +++++++++++++++++++++++++- src/types/database.d.ts | 19 +------------------ src/utils/db.ts | 3 ++- 3 files changed, 28 insertions(+), 20 deletions(-) diff --git a/src/lib/fixDB.ts b/src/lib/fixDB.ts index 31dce79..7d06c60 100644 --- a/src/lib/fixDB.ts +++ b/src/lib/fixDB.ts @@ -1,5 +1,5 @@ import { Knex } from "knex"; - +import db from "@/utils/db"; export default async (knex: Knex): Promise => { const addColumn = async (table: string, column: string, type: string) => { if (!(await knex.schema.hasTable(table))) return; @@ -23,4 +23,28 @@ export default async (knex: Knex): Promise => { }); } }; + await db("o_novel").where("eventState", 0).update({ + eventState: -1, + errorReason: "软件退出导致失败", + }); + await db("o_script").where("extractState", 0).update({ + extractState: -1, + errorReason: "软件退出导致失败", + }); + await db("o_assets").where("promptState", "生成中").update({ + promptState: "生成失败", + promptErrorReason: "软件退出导致失败", + }); + await db("o_image").where("state", "生成中").update({ + state: "生成失败", + errorReason: "软件退出导致失败", + }); + await db("o_storyboard").where("state", "生成中").update({ + state: "生成失败", + reason: "软件退出导致失败", + }); + await db("o_video").where("state", "生成中").update({ + state: "生成失败", + errorReason: "软件退出导致失败", + }); }; diff --git a/src/types/database.d.ts b/src/types/database.d.ts index dc02b6a..1af96b9 100644 --- a/src/types/database.d.ts +++ b/src/types/database.d.ts @@ -1,22 +1,6 @@ -// @db-hash 19c726e36479d905346c772cfa8007ba +// @db-hash 6fa5017e455bc367c9c902ba574d11b4 //该文件由脚本自动生成,请勿手动修改 -export interface _o_project_old_20260404 { - 'artStyle'?: string | null; - 'createTime'?: number | null; - 'directorManual'?: string | null; - 'id'?: number | null; - 'imageModel'?: string | null; - 'imageQuality'?: string | null; - 'intro'?: string | null; - 'mode'?: string | null; - 'name'?: string | null; - 'projectType'?: string | null; - 'type'?: string | null; - 'userId'?: number | null; - 'videoModel'?: string | null; - 'videoRatio'?: string | null; -} export interface memories { 'content': string; 'createTime': number; @@ -247,7 +231,6 @@ export interface o_videoTrack { } export interface DB { - "_o_project_old_20260404": _o_project_old_20260404; "memories": memories; "o_agentDeploy": o_agentDeploy; "o_agentWorkData": o_agentWorkData; diff --git a/src/utils/db.ts b/src/utils/db.ts index 58522b5..ab4bb69 100644 --- a/src/utils/db.ts +++ b/src/utils/db.ts @@ -7,6 +7,7 @@ import initDB from "@/lib/initDB"; // import fixDB from "@/lib/fixDB"; import type { DB } from "@/types/database"; import crypto from "crypto"; +import fixDB from "@/lib/fixDB"; type TableName = keyof DB & string; type RowType = DB[TName]; @@ -35,7 +36,7 @@ const db = knex({ (async () => { await initDB(db); - // await fixDB(db); + await fixDB(db); if (process.env.NODE_ENV == "dev") initKnexType(db); })();