add sqlite modify chatflow

This commit is contained in:
chungyau97
2023-09-05 21:50:00 +08:00
parent 0e891bfb3a
commit 427ec32dc6
3 changed files with 21 additions and 2 deletions
@@ -0,0 +1,18 @@
import { MigrationInterface, QueryRunner } from 'typeorm'
export class ModifyChatFlow1693920824108 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`CREATE TABLE "temp_chat_flow" ("id" varchar PRIMARY KEY NOT NULL, "name" varchar NOT NULL, "flowData" text NOT NULL, "deployed" boolean, "isPublic" boolean, "apikeyid" varchar, "chatbotConfig" text, "createdDate" datetime NOT NULL DEFAULT (datetime('now')), "updatedDate" datetime NOT NULL DEFAULT (datetime('now')));`
)
await queryRunner.query(
`INSERT INTO "temp_chat_flow" ("id", "name", "flowData", "deployed", "isPublic", "apikeyid", "chatbotConfig", "createdDate", "updatedDate") SELECT "id", "name", "flowData", "deployed", "isPublic", "apikeyid", "chatbotConfig", "createdDate", "updatedDate" FROM "chat_flow";`
)
await queryRunner.query(`DROP TABLE chat_flow;`)
await queryRunner.query(`ALTER TABLE temp_chat_flow RENAME TO chat_flow;`)
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DROP TABLE temp_chat_flow`)
}
}
@@ -1,3 +1,4 @@
import { Init1693835579790 } from './1693835579790-Init'
import { ModifyChatFlow1693920824108 } from './1693920824108-ModifyChatFlow'
export const sqliteMigrations = [Init1693835579790]
export const sqliteMigrations = [Init1693835579790, ModifyChatFlow1693920824108]