diff --git a/packages/server/src/database/migrations/mariadb/1759419231100-AddTextToSpeechToChatFlow.ts b/packages/server/src/database/migrations/mariadb/1759419231100-AddTextToSpeechToChatFlow.ts new file mode 100644 index 000000000..c9bd5236f --- /dev/null +++ b/packages/server/src/database/migrations/mariadb/1759419231100-AddTextToSpeechToChatFlow.ts @@ -0,0 +1,12 @@ +import { MigrationInterface, QueryRunner } from 'typeorm' + +export class AddTextToSpeechToChatFlow1759419231100 implements MigrationInterface { + public async up(queryRunner: QueryRunner): Promise { + const columnExists = await queryRunner.hasColumn('chat_flow', 'textToSpeech') + if (!columnExists) queryRunner.query(`ALTER TABLE \`chat_flow\` ADD COLUMN \`textToSpeech\` TEXT;`) + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`chat_flow\` DROP COLUMN \`textToSpeech\`;`) + } +} diff --git a/packages/server/src/database/migrations/mariadb/index.ts b/packages/server/src/database/migrations/mariadb/index.ts index 9ec116501..77da68f3f 100644 --- a/packages/server/src/database/migrations/mariadb/index.ts +++ b/packages/server/src/database/migrations/mariadb/index.ts @@ -39,6 +39,7 @@ import { ModifyExecutionDataColumnType1747902489801 } from './1747902489801-Modi import { AddTextToSpeechToChatFlow1754986457485 } from './1754986457485-AddTextToSpeechToChatFlow' import { ModifyChatflowType1755066758601 } from './1755066758601-ModifyChatflowType' import { AddChatFlowNameIndex1755748356008 } from './1755748356008-AddChatFlowNameIndex' +import { AddTextToSpeechToChatFlow1759419231100 } from './1759419231100-AddTextToSpeechToChatFlow' 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 + AddChatFlowNameIndex1755748356008, + AddTextToSpeechToChatFlow1759419231100 ] diff --git a/packages/server/src/database/migrations/mysql/1759419216034-AddTextToSpeechToChatFlow.ts b/packages/server/src/database/migrations/mysql/1759419216034-AddTextToSpeechToChatFlow.ts new file mode 100644 index 000000000..8f60c86ee --- /dev/null +++ b/packages/server/src/database/migrations/mysql/1759419216034-AddTextToSpeechToChatFlow.ts @@ -0,0 +1,12 @@ +import { MigrationInterface, QueryRunner } from 'typeorm' + +export class AddTextToSpeechToChatFlow1759419216034 implements MigrationInterface { + public async up(queryRunner: QueryRunner): Promise { + const columnExists = await queryRunner.hasColumn('chat_flow', 'textToSpeech') + if (!columnExists) queryRunner.query(`ALTER TABLE \`chat_flow\` ADD COLUMN \`textToSpeech\` TEXT;`) + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`chat_flow\` DROP COLUMN \`textToSpeech\`;`) + } +} diff --git a/packages/server/src/database/migrations/mysql/index.ts b/packages/server/src/database/migrations/mysql/index.ts index d3ff8f1c0..95f4ddbcf 100644 --- a/packages/server/src/database/migrations/mysql/index.ts +++ b/packages/server/src/database/migrations/mysql/index.ts @@ -40,6 +40,7 @@ import { ModifyExecutionDataColumnType1747902489801 } from './1747902489801-Modi import { AddTextToSpeechToChatFlow1754986468397 } from './1754986468397-AddTextToSpeechToChatFlow' import { ModifyChatflowType1755066758601 } from './1755066758601-ModifyChatflowType' import { AddChatFlowNameIndex1755748356008 } from './1755748356008-AddChatFlowNameIndex' +import { AddTextToSpeechToChatFlow1759419216034 } from './1759419216034-AddTextToSpeechToChatFlow' 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 + AddChatFlowNameIndex1755748356008, + AddTextToSpeechToChatFlow1759419216034 ] diff --git a/packages/server/src/database/migrations/postgres/1759419194331-AddTextToSpeechToChatFlow.ts b/packages/server/src/database/migrations/postgres/1759419194331-AddTextToSpeechToChatFlow.ts new file mode 100644 index 000000000..510a96b7c --- /dev/null +++ b/packages/server/src/database/migrations/postgres/1759419194331-AddTextToSpeechToChatFlow.ts @@ -0,0 +1,11 @@ +import { MigrationInterface, QueryRunner } from 'typeorm' + +export class AddTextToSpeechToChatFlow1759419194331 implements MigrationInterface { + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "chat_flow" ADD COLUMN IF NOT EXISTS "textToSpeech" TEXT;`) + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "chat_flow" DROP COLUMN "textToSpeech";`) + } +} diff --git a/packages/server/src/database/migrations/postgres/index.ts b/packages/server/src/database/migrations/postgres/index.ts index 59b30583a..8addad024 100644 --- a/packages/server/src/database/migrations/postgres/index.ts +++ b/packages/server/src/database/migrations/postgres/index.ts @@ -39,6 +39,7 @@ import { ModifyExecutionSessionIdFieldType1748450230238 } from './1748450230238- import { AddTextToSpeechToChatFlow1754986480347 } from './1754986480347-AddTextToSpeechToChatFlow' import { ModifyChatflowType1755066758601 } from './1755066758601-ModifyChatflowType' import { AddChatFlowNameIndex1755748356008 } from './1755748356008-AddChatFlowNameIndex' +import { AddTextToSpeechToChatFlow1759419194331 } from './1759419194331-AddTextToSpeechToChatFlow' 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 + AddChatFlowNameIndex1755748356008, + AddTextToSpeechToChatFlow1759419194331 ] diff --git a/packages/server/src/database/migrations/sqlite/1759419136055-AddTextToSpeechToChatFlow.ts b/packages/server/src/database/migrations/sqlite/1759419136055-AddTextToSpeechToChatFlow.ts new file mode 100644 index 000000000..0c072d2f5 --- /dev/null +++ b/packages/server/src/database/migrations/sqlite/1759419136055-AddTextToSpeechToChatFlow.ts @@ -0,0 +1,15 @@ +import { MigrationInterface, QueryRunner } from 'typeorm' + +export class AddTextToSpeechToChatFlow1759419136055 implements MigrationInterface { + public async up(queryRunner: QueryRunner): Promise { + 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 { + await queryRunner.query(`ALTER TABLE "chat_flow" DROP COLUMN "textToSpeech";`) + } +} diff --git a/packages/server/src/database/migrations/sqlite/index.ts b/packages/server/src/database/migrations/sqlite/index.ts index 6f0e706c3..6a7039b96 100644 --- a/packages/server/src/database/migrations/sqlite/index.ts +++ b/packages/server/src/database/migrations/sqlite/index.ts @@ -37,6 +37,7 @@ import { AddErrorToEvaluationRun1744964560174 } from './1744964560174-AddErrorTo import { AddTextToSpeechToChatFlow1754986486669 } from './1754986486669-AddTextToSpeechToChatFlow' import { ModifyChatflowType1755066758601 } from './1755066758601-ModifyChatflowType' import { AddChatFlowNameIndex1755748356008 } from './1755748356008-AddChatFlowNameIndex' +import { AddTextToSpeechToChatFlow1759419136055 } from './1759419136055-AddTextToSpeechToChatFlow' 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 + AddChatFlowNameIndex1755748356008, + AddTextToSpeechToChatFlow1759419136055 ]