diff --git a/packages/server/src/database/migrations/mariadb/1766759476232-AddTypeToChatFlow.ts b/packages/server/src/database/migrations/mariadb/1716300000000-AddTypeToChatFlow.ts similarity index 68% rename from packages/server/src/database/migrations/mariadb/1766759476232-AddTypeToChatFlow.ts rename to packages/server/src/database/migrations/mariadb/1716300000000-AddTypeToChatFlow.ts index f19e4ad5664..1b1ab8da3da 100644 --- a/packages/server/src/database/migrations/mariadb/1766759476232-AddTypeToChatFlow.ts +++ b/packages/server/src/database/migrations/mariadb/1716300000000-AddTypeToChatFlow.ts @@ -1,9 +1,9 @@ import { MigrationInterface, QueryRunner } from 'typeorm' -export class AddTypeToChatFlow1766759476232 implements MigrationInterface { +export class AddTypeToChatFlow1716300000000 implements MigrationInterface { public async up(queryRunner: QueryRunner): Promise { const columnExists = await queryRunner.hasColumn('chat_flow', 'type') - if (!columnExists) queryRunner.query(`ALTER TABLE \`chat_flow\` ADD COLUMN \`type\` TEXT;`) + if (!columnExists) await queryRunner.query(`ALTER TABLE \`chat_flow\` ADD COLUMN \`type\` TEXT;`) } public async down(queryRunner: QueryRunner): Promise { diff --git a/packages/server/src/database/migrations/mariadb/index.ts b/packages/server/src/database/migrations/mariadb/index.ts index e2dbd8c226f..4d6866751c5 100644 --- a/packages/server/src/database/migrations/mariadb/index.ts +++ b/packages/server/src/database/migrations/mariadb/index.ts @@ -13,13 +13,13 @@ import { AddFileAnnotationsToChatMessage1700271021237 } from './1700271021237-Ad import { AddFileUploadsToChatMessage1701788586491 } from './1701788586491-AddFileUploadsToChatMessage' import { AddVariableEntity1699325775451 } from './1702200925471-AddVariableEntity' import { AddSpeechToText1706364937060 } from './1706364937060-AddSpeechToText' -import { AddUpsertHistoryEntity1709814301358 } from './1709814301358-AddUpsertHistoryEntity' import { AddFeedback1707213626553 } from './1707213626553-AddFeedback' -import { AddDocumentStore1711637331047 } from './1711637331047-AddDocumentStore' +import { AddUpsertHistoryEntity1709814301358 } from './1709814301358-AddUpsertHistoryEntity' import { AddLead1710832127079 } from './1710832127079-AddLead' import { AddLeadToChatMessage1711538023578 } from './1711538023578-AddLeadToChatMessage' +import { AddDocumentStore1711637331047 } from './1711637331047-AddDocumentStore' import { AddAgentReasoningToChatMessage1714679514451 } from './1714679514451-AddAgentReasoningToChatMessage' -import { AddTypeToChatFlow1766759476232 } from './1766759476232-AddTypeToChatFlow' +import { AddTypeToChatFlow1716300000000 } from './1716300000000-AddTypeToChatFlow' import { AddApiKey1720230151480 } from './1720230151480-AddApiKey' import { AddActionToChatMessage1721078251523 } from './1721078251523-AddActionToChatMessage' import { LongTextColumn1722301395521 } from './1722301395521-LongTextColumn' @@ -46,7 +46,7 @@ export const mariadbMigrations = [ AddLead1710832127079, AddLeadToChatMessage1711538023578, AddAgentReasoningToChatMessage1714679514451, - AddTypeToChatFlow1766759476232, + AddTypeToChatFlow1716300000000, AddApiKey1720230151480, AddActionToChatMessage1721078251523, LongTextColumn1722301395521 diff --git a/packages/server/src/database/migrations/mysql/1766759476232-AddTypeToChatFlow.ts b/packages/server/src/database/migrations/mysql/1716300000000-AddTypeToChatFlow.ts similarity index 68% rename from packages/server/src/database/migrations/mysql/1766759476232-AddTypeToChatFlow.ts rename to packages/server/src/database/migrations/mysql/1716300000000-AddTypeToChatFlow.ts index f19e4ad5664..1b1ab8da3da 100644 --- a/packages/server/src/database/migrations/mysql/1766759476232-AddTypeToChatFlow.ts +++ b/packages/server/src/database/migrations/mysql/1716300000000-AddTypeToChatFlow.ts @@ -1,9 +1,9 @@ import { MigrationInterface, QueryRunner } from 'typeorm' -export class AddTypeToChatFlow1766759476232 implements MigrationInterface { +export class AddTypeToChatFlow1716300000000 implements MigrationInterface { public async up(queryRunner: QueryRunner): Promise { const columnExists = await queryRunner.hasColumn('chat_flow', 'type') - if (!columnExists) queryRunner.query(`ALTER TABLE \`chat_flow\` ADD COLUMN \`type\` TEXT;`) + if (!columnExists) await queryRunner.query(`ALTER TABLE \`chat_flow\` ADD COLUMN \`type\` TEXT;`) } public async down(queryRunner: QueryRunner): Promise { diff --git a/packages/server/src/database/migrations/mysql/index.ts b/packages/server/src/database/migrations/mysql/index.ts index 8578d4b61bd..99e98956de2 100644 --- a/packages/server/src/database/migrations/mysql/index.ts +++ b/packages/server/src/database/migrations/mysql/index.ts @@ -13,13 +13,13 @@ import { AddFileAnnotationsToChatMessage1700271021237 } from './1700271021237-Ad import { AddFileUploadsToChatMessage1701788586491 } from './1701788586491-AddFileUploadsToChatMessage' import { AddVariableEntity1699325775451 } from './1702200925471-AddVariableEntity' import { AddSpeechToText1706364937060 } from './1706364937060-AddSpeechToText' -import { AddUpsertHistoryEntity1709814301358 } from './1709814301358-AddUpsertHistoryEntity' import { AddFeedback1707213626553 } from './1707213626553-AddFeedback' -import { AddDocumentStore1711637331047 } from './1711637331047-AddDocumentStore' +import { AddUpsertHistoryEntity1709814301358 } from './1709814301358-AddUpsertHistoryEntity' import { AddLead1710832127079 } from './1710832127079-AddLead' import { AddLeadToChatMessage1711538023578 } from './1711538023578-AddLeadToChatMessage' +import { AddDocumentStore1711637331047 } from './1711637331047-AddDocumentStore' import { AddAgentReasoningToChatMessage1714679514451 } from './1714679514451-AddAgentReasoningToChatMessage' -import { AddTypeToChatFlow1766759476232 } from './1766759476232-AddTypeToChatFlow' +import { AddTypeToChatFlow1716300000000 } from './1716300000000-AddTypeToChatFlow' import { AddApiKey1720230151480 } from './1720230151480-AddApiKey' import { AddActionToChatMessage1721078251523 } from './1721078251523-AddActionToChatMessage' import { LongTextColumn1722301395521 } from './1722301395521-LongTextColumn' @@ -46,7 +46,7 @@ export const mysqlMigrations = [ AddLead1710832127079, AddLeadToChatMessage1711538023578, AddAgentReasoningToChatMessage1714679514451, - AddTypeToChatFlow1766759476232, + AddTypeToChatFlow1716300000000, AddApiKey1720230151480, AddActionToChatMessage1721078251523, LongTextColumn1722301395521 diff --git a/packages/server/src/database/migrations/postgres/1766759476232-AddTypeToChatFlow.ts b/packages/server/src/database/migrations/postgres/1716300000000-AddTypeToChatFlow.ts similarity index 85% rename from packages/server/src/database/migrations/postgres/1766759476232-AddTypeToChatFlow.ts rename to packages/server/src/database/migrations/postgres/1716300000000-AddTypeToChatFlow.ts index ad79a1973ce..a4c8b15bed9 100644 --- a/packages/server/src/database/migrations/postgres/1766759476232-AddTypeToChatFlow.ts +++ b/packages/server/src/database/migrations/postgres/1716300000000-AddTypeToChatFlow.ts @@ -1,6 +1,6 @@ import { MigrationInterface, QueryRunner } from 'typeorm' -export class AddTypeToChatFlow1766759476232 implements MigrationInterface { +export class AddTypeToChatFlow1716300000000 implements MigrationInterface { public async up(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "chat_flow" ADD COLUMN IF NOT EXISTS "type" TEXT;`) } diff --git a/packages/server/src/database/migrations/postgres/index.ts b/packages/server/src/database/migrations/postgres/index.ts index 5334b4fac42..79760204731 100644 --- a/packages/server/src/database/migrations/postgres/index.ts +++ b/packages/server/src/database/migrations/postgres/index.ts @@ -13,14 +13,14 @@ import { AddFileAnnotationsToChatMessage1700271021237 } from './1700271021237-Ad import { AddFileUploadsToChatMessage1701788586491 } from './1701788586491-AddFileUploadsToChatMessage' import { AddVariableEntity1699325775451 } from './1702200925471-AddVariableEntity' import { AddSpeechToText1706364937060 } from './1706364937060-AddSpeechToText' -import { AddUpsertHistoryEntity1709814301358 } from './1709814301358-AddUpsertHistoryEntity' import { AddFeedback1707213601923 } from './1707213601923-AddFeedback' +import { AddUpsertHistoryEntity1709814301358 } from './1709814301358-AddUpsertHistoryEntity' import { FieldTypes1710497452584 } from './1710497452584-FieldTypes' -import { AddDocumentStore1711637331047 } from './1711637331047-AddDocumentStore' import { AddLead1710832137905 } from './1710832137905-AddLead' import { AddLeadToChatMessage1711538016098 } from './1711538016098-AddLeadToChatMessage' +import { AddDocumentStore1711637331047 } from './1711637331047-AddDocumentStore' import { AddAgentReasoningToChatMessage1714679514451 } from './1714679514451-AddAgentReasoningToChatMessage' -import { AddTypeToChatFlow1766759476232 } from './1766759476232-AddTypeToChatFlow' +import { AddTypeToChatFlow1716300000000 } from './1716300000000-AddTypeToChatFlow' import { AddApiKey1720230151480 } from './1720230151480-AddApiKey' import { AddActionToChatMessage1721078251523 } from './1721078251523-AddActionToChatMessage' @@ -47,7 +47,7 @@ export const postgresMigrations = [ AddLead1710832137905, AddLeadToChatMessage1711538016098, AddAgentReasoningToChatMessage1714679514451, - AddTypeToChatFlow1766759476232, + AddTypeToChatFlow1716300000000, AddApiKey1720230151480, AddActionToChatMessage1721078251523 ] diff --git a/packages/server/src/database/migrations/sqlite/1766759476232-AddTypeToChatFlow.ts b/packages/server/src/database/migrations/sqlite/1716300000000-AddTypeToChatFlow.ts similarity index 54% rename from packages/server/src/database/migrations/sqlite/1766759476232-AddTypeToChatFlow.ts rename to packages/server/src/database/migrations/sqlite/1716300000000-AddTypeToChatFlow.ts index f41d9ed9f93..700d3df30d2 100644 --- a/packages/server/src/database/migrations/sqlite/1766759476232-AddTypeToChatFlow.ts +++ b/packages/server/src/database/migrations/sqlite/1716300000000-AddTypeToChatFlow.ts @@ -1,8 +1,9 @@ import { MigrationInterface, QueryRunner } from 'typeorm' -export class AddTypeToChatFlow1766759476232 implements MigrationInterface { +export class AddTypeToChatFlow1716300000000 implements MigrationInterface { public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE "chat_flow" ADD COLUMN "type" TEXT;`) + const columnExists = await queryRunner.hasColumn('chat_flow', 'type') + if (!columnExists) await queryRunner.query(`ALTER TABLE "chat_flow"ADD COLUMN "type" TEXT;`) } public async down(queryRunner: QueryRunner): Promise { diff --git a/packages/server/src/database/migrations/sqlite/index.ts b/packages/server/src/database/migrations/sqlite/index.ts index 44a602c4266..331cf3d0c37 100644 --- a/packages/server/src/database/migrations/sqlite/index.ts +++ b/packages/server/src/database/migrations/sqlite/index.ts @@ -13,15 +13,15 @@ import { AddFileAnnotationsToChatMessage1700271021237 } from './1700271021237-Ad import { AddFileUploadsToChatMessage1701788586491 } from './1701788586491-AddFileUploadsToChatMessage' import { AddVariableEntity1699325775451 } from './1702200925471-AddVariableEntity' import { AddSpeechToText1706364937060 } from './1706364937060-AddSpeechToText' -import { AddUpsertHistoryEntity1709814301358 } from './1709814301358-AddUpsertHistoryEntity' import { AddFeedback1707213619308 } from './1707213619308-AddFeedback' -import { AddDocumentStore1711637331047 } from './1711637331047-AddDocumentStore' +import { AddUpsertHistoryEntity1709814301358 } from './1709814301358-AddUpsertHistoryEntity' import { AddLead1710832117612 } from './1710832117612-AddLead' import { AddLeadToChatMessage1711537986113 } from './1711537986113-AddLeadToChatMessage' +import { AddDocumentStore1711637331047 } from './1711637331047-AddDocumentStore' import { AddAgentReasoningToChatMessage1714679514451 } from './1714679514451-AddAgentReasoningToChatMessage' -import { AddTypeToChatFlow1766759476232 } from './1766759476232-AddTypeToChatFlow' -import { AddActionToChatMessage1721078251523 } from './1721078251523-AddActionToChatMessage' +import { AddTypeToChatFlow1716300000000 } from './1716300000000-AddTypeToChatFlow' import { AddApiKey1720230151480 } from './1720230151480-AddApiKey' +import { AddActionToChatMessage1721078251523 } from './1721078251523-AddActionToChatMessage' export const sqliteMigrations = [ Init1693835579790, @@ -45,7 +45,7 @@ export const sqliteMigrations = [ AddLead1710832117612, AddLeadToChatMessage1711537986113, AddAgentReasoningToChatMessage1714679514451, - AddTypeToChatFlow1766759476232, + AddTypeToChatFlow1716300000000, AddApiKey1720230151480, AddActionToChatMessage1721078251523 ]