fix: review

This commit is contained in:
Ilango Rajagopal 2025-10-03 12:09:53 +05:30
parent f369d77b67
commit db30355399
3 changed files with 10 additions and 3 deletions

View File

@ -3,7 +3,7 @@ import { MigrationInterface, QueryRunner } from 'typeorm'
export class AddTextToSpeechToChatFlow1759419231100 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
const columnExists = await queryRunner.hasColumn('chat_flow', 'textToSpeech')
if (!columnExists) queryRunner.query(`ALTER TABLE \`chat_flow\` ADD COLUMN \`textToSpeech\` TEXT;`)
if (!columnExists) await queryRunner.query(`ALTER TABLE \`chat_flow\` ADD COLUMN \`textToSpeech\` TEXT;`)
}
public async down(queryRunner: QueryRunner): Promise<void> {

View File

@ -3,7 +3,7 @@ import { MigrationInterface, QueryRunner } from 'typeorm'
export class AddTextToSpeechToChatFlow1759419216034 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
const columnExists = await queryRunner.hasColumn('chat_flow', 'textToSpeech')
if (!columnExists) queryRunner.query(`ALTER TABLE \`chat_flow\` ADD COLUMN \`textToSpeech\` TEXT;`)
if (!columnExists) await queryRunner.query(`ALTER TABLE \`chat_flow\` ADD COLUMN \`textToSpeech\` TEXT;`)
}
public async down(queryRunner: QueryRunner): Promise<void> {

View File

@ -10,6 +10,13 @@ export class AddTextToSpeechToChatFlow1759419136055 implements MigrationInterfac
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "chat_flow" DROP COLUMN "textToSpeech";`)
await queryRunner.query(`CREATE TABLE "chat_flow_temp" AS SELECT * FROM "chat_flow" WHERE 1=0;`)
await queryRunner.query(`
INSERT INTO "chat_flow_temp"
SELECT id, name, flowData, deployed, isPublic, apikeyid, chatbotConfig, apiConfig, analytic, speechToText, followUpPrompts, category, type, createdDate, updatedDate, workspaceId
FROM "chat_flow";
`)
await queryRunner.query(`DROP TABLE "chat_flow";`)
await queryRunner.query(`ALTER TABLE "chat_flow_temp" RENAME TO "chat_flow";`)
}
}