fix: migration errors for text to speech and chatflow name index (#5287)
* fix: add another migration to fix missing textToSpeech column * fix: chatflow name index error * fix: review
This commit is contained in:
parent
6fe5b98d6f
commit
ac252516f8
|
|
@ -0,0 +1,12 @@
|
|||
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) await queryRunner.query(`ALTER TABLE \`chat_flow\` ADD COLUMN \`textToSpeech\` TEXT;`)
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`chat_flow\` DROP COLUMN \`textToSpeech\`;`)
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
import { MigrationInterface, QueryRunner } from 'typeorm'
|
||||
|
||||
export class AddChatFlowNameIndex1755748356008 implements MigrationInterface {
|
||||
name = 'AddChatFlowNameIndex1755748356008'
|
||||
export class AddChatFlowNameIndex1759424809984 implements MigrationInterface {
|
||||
name = 'AddChatFlowNameIndex1759424809984'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`CREATE INDEX \`IDX_chatflow_name\` ON \`chat_flow\` (LEFT(\`name\`, 255))`)
|
||||
await queryRunner.query(`CREATE INDEX \`IDX_chatflow_name\` ON \`chat_flow\` (\`name\`(191))`)
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
|
|
@ -38,7 +38,8 @@ import { AddErrorToEvaluationRun1744964560174 } from './1744964560174-AddErrorTo
|
|||
import { ModifyExecutionDataColumnType1747902489801 } from './1747902489801-ModifyExecutionDataColumnType'
|
||||
import { AddTextToSpeechToChatFlow1754986457485 } from './1754986457485-AddTextToSpeechToChatFlow'
|
||||
import { ModifyChatflowType1755066758601 } from './1755066758601-ModifyChatflowType'
|
||||
import { AddChatFlowNameIndex1755748356008 } from './1755748356008-AddChatFlowNameIndex'
|
||||
import { AddTextToSpeechToChatFlow1759419231100 } from './1759419231100-AddTextToSpeechToChatFlow'
|
||||
import { AddChatFlowNameIndex1759424809984 } from './1759424809984-AddChatFlowNameIndex'
|
||||
|
||||
import { AddAuthTables1720230151482 } from '../../../enterprise/database/migrations/mariadb/1720230151482-AddAuthTables'
|
||||
import { AddWorkspace1725437498242 } from '../../../enterprise/database/migrations/mariadb/1725437498242-AddWorkspace'
|
||||
|
|
@ -104,5 +105,6 @@ export const mariadbMigrations = [
|
|||
ModifyExecutionDataColumnType1747902489801,
|
||||
AddTextToSpeechToChatFlow1754986457485,
|
||||
ModifyChatflowType1755066758601,
|
||||
AddChatFlowNameIndex1755748356008
|
||||
AddTextToSpeechToChatFlow1759419231100,
|
||||
AddChatFlowNameIndex1759424809984
|
||||
]
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
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) await queryRunner.query(`ALTER TABLE \`chat_flow\` ADD COLUMN \`textToSpeech\` TEXT;`)
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`chat_flow\` DROP COLUMN \`textToSpeech\`;`)
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
import { MigrationInterface, QueryRunner } from 'typeorm'
|
||||
|
||||
export class AddChatFlowNameIndex1755748356008 implements MigrationInterface {
|
||||
name = 'AddChatFlowNameIndex1755748356008'
|
||||
export class AddChatFlowNameIndex1759424828558 implements MigrationInterface {
|
||||
name = 'AddChatFlowNameIndex1759424828558'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`CREATE INDEX \`IDX_chatflow_name\` ON \`chat_flow\` (LEFT(\`name\`, 255))`)
|
||||
await queryRunner.query(`CREATE INDEX \`IDX_chatflow_name\` ON \`chat_flow\` (\`name\`(191))`)
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
|
|
@ -39,7 +39,8 @@ import { FixErrorsColumnInEvaluationRun1746437114935 } from './1746437114935-Fix
|
|||
import { ModifyExecutionDataColumnType1747902489801 } from './1747902489801-ModifyExecutionDataColumnType'
|
||||
import { AddTextToSpeechToChatFlow1754986468397 } from './1754986468397-AddTextToSpeechToChatFlow'
|
||||
import { ModifyChatflowType1755066758601 } from './1755066758601-ModifyChatflowType'
|
||||
import { AddChatFlowNameIndex1755748356008 } from './1755748356008-AddChatFlowNameIndex'
|
||||
import { AddTextToSpeechToChatFlow1759419216034 } from './1759419216034-AddTextToSpeechToChatFlow'
|
||||
import { AddChatFlowNameIndex1759424828558 } from './1759424828558-AddChatFlowNameIndex'
|
||||
|
||||
import { AddAuthTables1720230151482 } from '../../../enterprise/database/migrations/mysql/1720230151482-AddAuthTables'
|
||||
import { AddWorkspace1720230151484 } from '../../../enterprise/database/migrations/mysql/1720230151484-AddWorkspace'
|
||||
|
|
@ -106,5 +107,6 @@ export const mysqlMigrations = [
|
|||
ModifyExecutionDataColumnType1747902489801,
|
||||
AddTextToSpeechToChatFlow1754986468397,
|
||||
ModifyChatflowType1755066758601,
|
||||
AddChatFlowNameIndex1755748356008
|
||||
AddTextToSpeechToChatFlow1759419216034,
|
||||
AddChatFlowNameIndex1759424828558
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1,13 +0,0 @@
|
|||
import { MigrationInterface, QueryRunner } from 'typeorm'
|
||||
|
||||
export class AddChatFlowNameIndex1755748356008 implements MigrationInterface {
|
||||
name = 'AddChatFlowNameIndex1755748356008'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`CREATE INDEX "IDX_chatflow_name" ON "chat_flow" (substring("name" from 1 for 255))`)
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`DROP INDEX "IDX_chatflow_name"`)
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
import { MigrationInterface, QueryRunner } from 'typeorm'
|
||||
|
||||
export class AddTextToSpeechToChatFlow1759419194331 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "chat_flow" ADD COLUMN IF NOT EXISTS "textToSpeech" TEXT;`)
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "chat_flow" DROP COLUMN "textToSpeech";`)
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
import { MigrationInterface, QueryRunner } from 'typeorm'
|
||||
|
||||
export class AddChatFlowNameIndex1759424903973 implements MigrationInterface {
|
||||
name = 'AddChatFlowNameIndex1759424903973'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`CREATE INDEX IF NOT EXISTS "IDX_chatflow_name" ON "chat_flow" (substring("name" from 1 for 255))`)
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`DROP INDEX IF EXISTS "IDX_chatflow_name"`)
|
||||
}
|
||||
}
|
||||
|
|
@ -38,7 +38,8 @@ import { AddErrorToEvaluationRun1744964560174 } from './1744964560174-AddErrorTo
|
|||
import { ModifyExecutionSessionIdFieldType1748450230238 } from './1748450230238-ModifyExecutionSessionIdFieldType'
|
||||
import { AddTextToSpeechToChatFlow1754986480347 } from './1754986480347-AddTextToSpeechToChatFlow'
|
||||
import { ModifyChatflowType1755066758601 } from './1755066758601-ModifyChatflowType'
|
||||
import { AddChatFlowNameIndex1755748356008 } from './1755748356008-AddChatFlowNameIndex'
|
||||
import { AddTextToSpeechToChatFlow1759419194331 } from './1759419194331-AddTextToSpeechToChatFlow'
|
||||
import { AddChatFlowNameIndex1759424903973 } from './1759424903973-AddChatFlowNameIndex'
|
||||
|
||||
import { AddAuthTables1720230151482 } from '../../../enterprise/database/migrations/postgres/1720230151482-AddAuthTables'
|
||||
import { AddWorkspace1720230151484 } from '../../../enterprise/database/migrations/postgres/1720230151484-AddWorkspace'
|
||||
|
|
@ -104,5 +105,6 @@ export const postgresMigrations = [
|
|||
ModifyExecutionSessionIdFieldType1748450230238,
|
||||
AddTextToSpeechToChatFlow1754986480347,
|
||||
ModifyChatflowType1755066758601,
|
||||
AddChatFlowNameIndex1755748356008
|
||||
AddTextToSpeechToChatFlow1759419194331,
|
||||
AddChatFlowNameIndex1759424903973
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1,13 +0,0 @@
|
|||
import { MigrationInterface, QueryRunner } from 'typeorm'
|
||||
|
||||
export class AddChatFlowNameIndex1755748356008 implements MigrationInterface {
|
||||
name = 'AddChatFlowNameIndex1755748356008'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`CREATE INDEX "IDX_chatflow_name" ON "chat_flow" (substr("name", 1, 255))`)
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`DROP INDEX "IDX_chatflow_name"`)
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
import { MigrationInterface, QueryRunner } from 'typeorm'
|
||||
|
||||
export class AddTextToSpeechToChatFlow1759419136055 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
const tableInfo = await queryRunner.query(`PRAGMA table_info("chat_flow");`)
|
||||
const columnExists = tableInfo.some((column: any) => column.name === 'textToSpeech')
|
||||
if (!columnExists) {
|
||||
await queryRunner.query(`ALTER TABLE "chat_flow" ADD COLUMN "textToSpeech" TEXT;`)
|
||||
}
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
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";`)
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
import { MigrationInterface, QueryRunner } from 'typeorm'
|
||||
|
||||
export class AddChatFlowNameIndex1759424923093 implements MigrationInterface {
|
||||
name = 'AddChatFlowNameIndex1759424923093'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`CREATE INDEX IF NOT EXISTS "IDX_chatflow_name" ON "chat_flow" (substr(name, 1, 255))`)
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`DROP INDEX IF EXISTS "IDX_chatflow_name"`)
|
||||
}
|
||||
}
|
||||
|
|
@ -36,7 +36,8 @@ import { FixOpenSourceAssistantTable1743758056188 } from './1743758056188-FixOpe
|
|||
import { AddErrorToEvaluationRun1744964560174 } from './1744964560174-AddErrorToEvaluationRun'
|
||||
import { AddTextToSpeechToChatFlow1754986486669 } from './1754986486669-AddTextToSpeechToChatFlow'
|
||||
import { ModifyChatflowType1755066758601 } from './1755066758601-ModifyChatflowType'
|
||||
import { AddChatFlowNameIndex1755748356008 } from './1755748356008-AddChatFlowNameIndex'
|
||||
import { AddTextToSpeechToChatFlow1759419136055 } from './1759419136055-AddTextToSpeechToChatFlow'
|
||||
import { AddChatFlowNameIndex1759424923093 } from './1759424923093-AddChatFlowNameIndex'
|
||||
|
||||
import { AddAuthTables1720230151482 } from '../../../enterprise/database/migrations/sqlite/1720230151482-AddAuthTables'
|
||||
import { AddWorkspace1720230151484 } from '../../../enterprise/database/migrations/sqlite/1720230151484-AddWorkspace'
|
||||
|
|
@ -100,5 +101,6 @@ export const sqliteMigrations = [
|
|||
ExecutionLinkWorkspaceId1746862866554,
|
||||
AddTextToSpeechToChatFlow1754986486669,
|
||||
ModifyChatflowType1755066758601,
|
||||
AddChatFlowNameIndex1755748356008
|
||||
AddTextToSpeechToChatFlow1759419136055,
|
||||
AddChatFlowNameIndex1759424923093
|
||||
]
|
||||
|
|
|
|||
Loading…
Reference in New Issue