From 2ea098fef482660f793f30d8d8e85b64d24f8ada Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karlo=20Ben=C4=8Di=C4=87?= Date: Sat, 26 Oct 2024 02:38:27 +0200 Subject: [PATCH] fix: Add missing migration in MariaDB (#3409) Add missing migration for vector store configuration in document store for MariaDB --- ...861032479-AddVectorStoreConfigToDocStore.ts | 18 ++++++++++++++++++ .../src/database/migrations/mariadb/index.ts | 2 ++ 2 files changed, 20 insertions(+) create mode 100644 packages/server/src/database/migrations/mariadb/1715861032479-AddVectorStoreConfigToDocStore.ts diff --git a/packages/server/src/database/migrations/mariadb/1715861032479-AddVectorStoreConfigToDocStore.ts b/packages/server/src/database/migrations/mariadb/1715861032479-AddVectorStoreConfigToDocStore.ts new file mode 100644 index 00000000000..c5d5422751d --- /dev/null +++ b/packages/server/src/database/migrations/mariadb/1715861032479-AddVectorStoreConfigToDocStore.ts @@ -0,0 +1,18 @@ +import { MigrationInterface, QueryRunner } from 'typeorm' + +export class AddVectorStoreConfigToDocStore1715861032479 implements MigrationInterface { + public async up(queryRunner: QueryRunner): Promise { + const columnExists = await queryRunner.hasColumn('document_store', 'vectorStoreConfig') + if (!columnExists) { + await queryRunner.query(`ALTER TABLE \`document_store\` ADD COLUMN \`vectorStoreConfig\` TEXT;`) + await queryRunner.query(`ALTER TABLE \`document_store\` ADD COLUMN \`embeddingConfig\` TEXT;`) + await queryRunner.query(`ALTER TABLE \`document_store\` ADD COLUMN \`recordManagerConfig\` TEXT;`) + } + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`document_store\` DROP COLUMN \`vectorStoreConfig\`;`) + await queryRunner.query(`ALTER TABLE \`document_store\` DROP COLUMN \`embeddingConfig\`;`) + await queryRunner.query(`ALTER TABLE \`document_store\` DROP COLUMN \`recordManagerConfig\`;`) + } +} diff --git a/packages/server/src/database/migrations/mariadb/index.ts b/packages/server/src/database/migrations/mariadb/index.ts index 6c0f6274d17..cf246a644a4 100644 --- a/packages/server/src/database/migrations/mariadb/index.ts +++ b/packages/server/src/database/migrations/mariadb/index.ts @@ -17,6 +17,7 @@ import { AddFeedback1707213626553 } from './1707213626553-AddFeedback' import { AddUpsertHistoryEntity1709814301358 } from './1709814301358-AddUpsertHistoryEntity' import { AddLead1710832127079 } from './1710832127079-AddLead' import { AddLeadToChatMessage1711538023578 } from './1711538023578-AddLeadToChatMessage' +import { AddVectorStoreConfigToDocStore1715861032479 } from './1715861032479-AddVectorStoreConfigToDocStore' import { AddDocumentStore1711637331047 } from './1711637331047-AddDocumentStore' import { AddAgentReasoningToChatMessage1714679514451 } from './1714679514451-AddAgentReasoningToChatMessage' import { AddTypeToChatFlow1716300000000 } from './1716300000000-AddTypeToChatFlow' @@ -50,6 +51,7 @@ export const mariadbMigrations = [ AddLeadToChatMessage1711538023578, AddAgentReasoningToChatMessage1714679514451, AddTypeToChatFlow1716300000000, + AddVectorStoreConfigToDocStore1715861032479, AddApiKey1720230151480, AddActionToChatMessage1721078251523, LongTextColumn1722301395521,