mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 15:00:57 +03:00
Chore/refractor (#4454)
* markdown files and env examples cleanup * components update * update jsonlines description * server refractor * update telemetry * add execute custom node * add ui refractor * add username and password authenticate * correctly retrieve past images in agentflowv2 * disable e2e temporarily * add existing username and password authenticate * update migration to default workspace * update todo * blob storage migrating * throw error on agent tool call error * add missing execution import * add referral * chore: add error message when importData is undefined * migrate api keys to db * fix: data too long for column executionData * migrate api keys from json to db at init * add info on account setup * update docstore missing fields --------- Co-authored-by: chungyau97 <chungyau97@gmail.com>
This commit is contained in:
@@ -18,4 +18,7 @@ export class ApiKey implements IApiKey {
|
||||
@Column({ type: 'timestamp' })
|
||||
@UpdateDateColumn()
|
||||
updatedDate: Date
|
||||
|
||||
@Column({ nullable: true, type: 'text' })
|
||||
workspaceId?: string
|
||||
}
|
||||
|
||||
@@ -26,4 +26,7 @@ export class Assistant implements IAssistant {
|
||||
@Column({ type: 'timestamp' })
|
||||
@UpdateDateColumn()
|
||||
updatedDate: Date
|
||||
|
||||
@Column({ nullable: true, type: 'text' })
|
||||
workspaceId?: string
|
||||
}
|
||||
|
||||
@@ -50,4 +50,7 @@ export class ChatFlow implements IChatFlow {
|
||||
@Column({ type: 'timestamp' })
|
||||
@UpdateDateColumn()
|
||||
updatedDate: Date
|
||||
|
||||
@Column({ nullable: true, type: 'text' })
|
||||
workspaceId?: string
|
||||
}
|
||||
|
||||
@@ -23,4 +23,7 @@ export class Credential implements ICredential {
|
||||
@Column({ type: 'timestamp' })
|
||||
@UpdateDateColumn()
|
||||
updatedDate: Date
|
||||
|
||||
@Column({ nullable: true, type: 'text' })
|
||||
workspaceId?: string
|
||||
}
|
||||
|
||||
@@ -27,6 +27,9 @@ export class CustomTemplate implements ICustomTemplate {
|
||||
@Column({ nullable: true, type: 'text' })
|
||||
type?: string
|
||||
|
||||
@Column({ nullable: true, type: 'text' })
|
||||
workspaceId: string
|
||||
|
||||
@Column({ type: 'timestamp' })
|
||||
@CreateDateColumn()
|
||||
createdDate: Date
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
/* eslint-disable */
|
||||
import { Entity, Column, CreateDateColumn, UpdateDateColumn, PrimaryGeneratedColumn } from 'typeorm'
|
||||
import { IAssistant, IDataset } from '../../Interface'
|
||||
|
||||
@Entity()
|
||||
export class Dataset implements IDataset {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string
|
||||
|
||||
@Column({ type: 'text' })
|
||||
name: string
|
||||
|
||||
@Column({ type: 'text' })
|
||||
description: string
|
||||
|
||||
@CreateDateColumn()
|
||||
createdDate: Date
|
||||
|
||||
@UpdateDateColumn()
|
||||
updatedDate: Date
|
||||
|
||||
@Column({ nullable: true, type: 'text' })
|
||||
workspaceId?: string
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/* eslint-disable */
|
||||
import { Entity, Column, CreateDateColumn, UpdateDateColumn, PrimaryGeneratedColumn, Index } from 'typeorm'
|
||||
import { IAssistant, IDataset, IDatasetRow } from '../../Interface'
|
||||
|
||||
@Entity()
|
||||
export class DatasetRow implements IDatasetRow {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string
|
||||
|
||||
@Column({ type: 'text' })
|
||||
@Index()
|
||||
datasetId: string
|
||||
|
||||
@Column({ type: 'text' })
|
||||
input: string
|
||||
|
||||
@Column({ type: 'text' })
|
||||
output: string
|
||||
|
||||
@UpdateDateColumn()
|
||||
updatedDate: Date
|
||||
|
||||
@Column({ name: 'sequence_no' })
|
||||
sequenceNo: number
|
||||
}
|
||||
@@ -37,4 +37,7 @@ export class DocumentStore implements IDocumentStore {
|
||||
|
||||
@Column({ nullable: true, type: 'text' })
|
||||
recordManagerConfig: string | null
|
||||
|
||||
@Column({ nullable: true, type: 'text' })
|
||||
workspaceId?: string
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
import { Column, Entity, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm'
|
||||
import { IEvaluation } from '../../Interface'
|
||||
|
||||
@Entity()
|
||||
export class Evaluation implements IEvaluation {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string
|
||||
|
||||
@Column({ type: 'text' })
|
||||
average_metrics: string
|
||||
|
||||
@Column({ type: 'text' })
|
||||
additionalConfig: string
|
||||
|
||||
@Column()
|
||||
name: string
|
||||
|
||||
@Column()
|
||||
evaluationType: string
|
||||
|
||||
@Column()
|
||||
chatflowId: string
|
||||
|
||||
@Column()
|
||||
chatflowName: string
|
||||
|
||||
@Column()
|
||||
datasetId: string
|
||||
|
||||
@Column()
|
||||
datasetName: string
|
||||
|
||||
@Column()
|
||||
status: string
|
||||
|
||||
@UpdateDateColumn()
|
||||
runDate: Date
|
||||
|
||||
@Column({ nullable: true, type: 'text' })
|
||||
workspaceId?: string
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
import { Column, Entity, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm'
|
||||
import { IEvaluationRun } from '../../Interface'
|
||||
|
||||
@Entity()
|
||||
export class EvaluationRun implements IEvaluationRun {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string
|
||||
|
||||
@Column()
|
||||
evaluationId: string
|
||||
|
||||
@Column({ type: 'text' })
|
||||
input: string
|
||||
|
||||
@Column({ type: 'text' })
|
||||
expectedOutput: string
|
||||
|
||||
@UpdateDateColumn()
|
||||
runDate: Date
|
||||
|
||||
@Column({ type: 'text' })
|
||||
actualOutput: string
|
||||
|
||||
@Column({ type: 'text' })
|
||||
metrics: string
|
||||
|
||||
@Column({ type: 'text' })
|
||||
llmEvaluators: string
|
||||
|
||||
@Column({ type: 'text' })
|
||||
evaluators: string
|
||||
|
||||
@Column({ type: 'text' })
|
||||
errors: string
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import { Column, CreateDateColumn, Entity, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm'
|
||||
import { IEvaluator } from '../../Interface'
|
||||
|
||||
//1714808591644
|
||||
|
||||
@Entity()
|
||||
export class Evaluator implements IEvaluator {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string
|
||||
|
||||
@Column()
|
||||
name: string
|
||||
|
||||
@Column()
|
||||
type: string
|
||||
|
||||
@Column()
|
||||
config: string
|
||||
|
||||
@CreateDateColumn()
|
||||
createdDate: Date
|
||||
|
||||
@UpdateDateColumn()
|
||||
updatedDate: Date
|
||||
|
||||
@Column({ nullable: true, type: 'text' })
|
||||
workspaceId?: string
|
||||
}
|
||||
@@ -41,4 +41,7 @@ export class Execution implements IExecution {
|
||||
@ManyToOne(() => ChatFlow)
|
||||
@JoinColumn({ name: 'agentflowId' })
|
||||
agentflow: ChatFlow
|
||||
|
||||
@Column({ nullable: true, type: 'text' })
|
||||
workspaceId?: string
|
||||
}
|
||||
|
||||
@@ -32,4 +32,7 @@ export class Tool implements ITool {
|
||||
@Column({ type: 'timestamp' })
|
||||
@UpdateDateColumn()
|
||||
updatedDate: Date
|
||||
|
||||
@Column({ nullable: true, type: 'text' })
|
||||
workspaceId?: string
|
||||
}
|
||||
|
||||
@@ -23,4 +23,7 @@ export class Variable implements IVariable {
|
||||
@Column({ type: 'timestamp' })
|
||||
@UpdateDateColumn()
|
||||
updatedDate: Date
|
||||
|
||||
@Column({ nullable: true, type: 'text' })
|
||||
workspaceId?: string
|
||||
}
|
||||
|
||||
@@ -9,9 +9,22 @@ import { DocumentStore } from './DocumentStore'
|
||||
import { DocumentStoreFileChunk } from './DocumentStoreFileChunk'
|
||||
import { Lead } from './Lead'
|
||||
import { UpsertHistory } from './UpsertHistory'
|
||||
import { Dataset } from './Dataset'
|
||||
import { DatasetRow } from './DatasetRow'
|
||||
import { EvaluationRun } from './EvaluationRun'
|
||||
import { Evaluation } from './Evaluation'
|
||||
import { Evaluator } from './Evaluator'
|
||||
import { ApiKey } from './ApiKey'
|
||||
import { CustomTemplate } from './CustomTemplate'
|
||||
import { Execution } from './Execution'
|
||||
import { LoginActivity, WorkspaceShared, WorkspaceUsers } from '../../enterprise/database/entities/EnterpriseEntities'
|
||||
import { User } from '../../enterprise/database/entities/user.entity'
|
||||
import { Organization } from '../../enterprise/database/entities/organization.entity'
|
||||
import { Role } from '../../enterprise/database/entities/role.entity'
|
||||
import { OrganizationUser } from '../../enterprise/database/entities/organization-user.entity'
|
||||
import { Workspace } from '../../enterprise/database/entities/workspace.entity'
|
||||
import { WorkspaceUser } from '../../enterprise/database/entities/workspace-user.entity'
|
||||
import { LoginMethod } from '../../enterprise/database/entities/login-method.entity'
|
||||
|
||||
export const entities = {
|
||||
ChatFlow,
|
||||
@@ -21,11 +34,26 @@ export const entities = {
|
||||
Tool,
|
||||
Assistant,
|
||||
Variable,
|
||||
UpsertHistory,
|
||||
DocumentStore,
|
||||
DocumentStoreFileChunk,
|
||||
Lead,
|
||||
UpsertHistory,
|
||||
Dataset,
|
||||
DatasetRow,
|
||||
Evaluation,
|
||||
EvaluationRun,
|
||||
Evaluator,
|
||||
ApiKey,
|
||||
User,
|
||||
WorkspaceUsers,
|
||||
LoginActivity,
|
||||
WorkspaceShared,
|
||||
CustomTemplate,
|
||||
Execution
|
||||
Execution,
|
||||
Organization,
|
||||
Role,
|
||||
OrganizationUser,
|
||||
Workspace,
|
||||
WorkspaceUser,
|
||||
LoginMethod
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm'
|
||||
|
||||
export class AddEvaluation1714548873039 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE IF NOT EXISTS \`evaluation\` (
|
||||
\`id\` varchar(36) NOT NULL,
|
||||
\`chatflowId\` LONGTEXT NOT NULL,
|
||||
\`datasetId\` LONGTEXT NOT NULL,
|
||||
\`name\` varchar(255) NOT NULL,
|
||||
\`chatflowName\` varchar(255) NOT NULL,
|
||||
\`datasetName\` varchar(255) NOT NULL,
|
||||
\`additionalConfig\` LONGTEXT,
|
||||
\`average_metrics\` LONGTEXT NOT NULL,
|
||||
\`status\` varchar(10) NOT NULL,
|
||||
\`evaluationType\` varchar(20) NOT NULL,
|
||||
\`runDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
|
||||
PRIMARY KEY (\`id\`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;`
|
||||
)
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE IF NOT EXISTS \`evaluation_run\` (
|
||||
\`id\` varchar(36) NOT NULL,
|
||||
\`evaluationId\` varchar(36) NOT NULL,
|
||||
\`expectedOutput\` LONGTEXT NOT NULL,
|
||||
\`actualOutput\` LONGTEXT NOT NULL,
|
||||
\`evaluators\` LONGTEXT,
|
||||
\`input\` LONGTEXT DEFAULT NULL,
|
||||
\`metrics\` TEXT DEFAULT NULL,
|
||||
\`llmEvaluators\` TEXT DEFAULT NULL,
|
||||
\`runDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
|
||||
PRIMARY KEY (\`id\`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;`
|
||||
)
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`DROP TABLE evaluation`)
|
||||
await queryRunner.query(`DROP TABLE evaluation_run`)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm'
|
||||
|
||||
export class AddDatasets1714548903384 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE IF NOT EXISTS \`dataset\` (
|
||||
\`id\` varchar(36) NOT NULL,
|
||||
\`name\` varchar(255) NOT NULL,
|
||||
\`description\` varchar(255) DEFAULT NULL,
|
||||
\`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
|
||||
\`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
|
||||
PRIMARY KEY (\`id\`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;`
|
||||
)
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE IF NOT EXISTS \`dataset_row\` (
|
||||
\`id\` varchar(36) NOT NULL,
|
||||
\`datasetId\` varchar(36) NOT NULL,
|
||||
\`input\` LONGTEXT NOT NULL,
|
||||
\`output\` LONGTEXT DEFAULT NULL,
|
||||
\`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
|
||||
PRIMARY KEY (\`id\`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;`
|
||||
)
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`DROP TABLE dataset`)
|
||||
await queryRunner.query(`DROP TABLE dataset_row`)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm'
|
||||
|
||||
export class AddEvaluator1714808591644 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE IF NOT EXISTS \`evaluator\` (
|
||||
\`id\` varchar(36) NOT NULL,
|
||||
\`name\` varchar(255) NOT NULL,
|
||||
\`type\` varchar(25) DEFAULT NULL,
|
||||
\`config\` LONGTEXT DEFAULT NULL,
|
||||
\`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
|
||||
\`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
|
||||
PRIMARY KEY (\`id\`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;`
|
||||
)
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`DROP TABLE evaluator`)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm'
|
||||
|
||||
export class AddSeqNoToDatasetRow1733752119696 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
const columnExists = await queryRunner.hasColumn('dataset_row', 'sequence_no')
|
||||
if (!columnExists) queryRunner.query(`ALTER TABLE \`dataset_row\` ADD COLUMN \`sequence_no\` INT DEFAULT -1;`)
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "dataset_row" DROP COLUMN "sequence_no";`)
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm'
|
||||
import { Assistant } from '../../entities/Assistant'
|
||||
|
||||
export class FixOpenSourceAssistantTable1743758056188 implements MigrationInterface {
|
||||
name = 'FixOpenSourceAssistantTable1743758056188'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
const columnExists = await queryRunner.hasColumn('assistant', 'type')
|
||||
if (!columnExists) {
|
||||
await queryRunner.query(`ALTER TABLE \`assistant\` ADD COLUMN \`type\` TEXT;`)
|
||||
await queryRunner.query(`UPDATE \`assistant\` SET \`type\` = 'OPENAI';`)
|
||||
|
||||
const assistants: Assistant[] = await queryRunner.query(`SELECT * FROM \`assistant\`;`)
|
||||
for (let assistant of assistants) {
|
||||
const details = JSON.parse(assistant.details)
|
||||
if (!details?.id) await queryRunner.query(`UPDATE \`assistant\` SET \`type\` = 'CUSTOM' WHERE id = '${assistant.id}';`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`assistant\` DROP COLUMN \`type\`;`)
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm'
|
||||
|
||||
export class AddErrorToEvaluationRun1744964560174 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
const columnExists = await queryRunner.hasColumn('evaluation_run', 'errors')
|
||||
if (!columnExists) queryRunner.query(`ALTER TABLE \`evaluation_run\` ADD COLUMN \`errors\` LONGTEXT NULL DEFAULT '[]';`)
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "evaluation_run" DROP COLUMN "errors";`)
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm'
|
||||
|
||||
export class ModifyExecutionDataColumnType1747902489801 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
queryRunner.query(`ALTER TABLE \`execution\` MODIFY COLUMN \`executionData\` LONGTEXT NOT NULL;`)
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
queryRunner.query(`ALTER TABLE \`execution\` MODIFY COLUMN \`executionData\` TEXT NOT NULL;`)
|
||||
}
|
||||
}
|
||||
@@ -17,9 +17,12 @@ 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 { AddEvaluation1714548873039 } from './1714548873039-AddEvaluation'
|
||||
import { AddDatasets1714548903384 } from './1714548903384-AddDataset'
|
||||
import { AddAgentReasoningToChatMessage1714679514451 } from './1714679514451-AddAgentReasoningToChatMessage'
|
||||
import { AddEvaluator1714808591644 } from './1714808591644-AddEvaluator'
|
||||
import { AddVectorStoreConfigToDocStore1715861032479 } from './1715861032479-AddVectorStoreConfigToDocStore'
|
||||
import { AddTypeToChatFlow1716300000000 } from './1716300000000-AddTypeToChatFlow'
|
||||
import { AddApiKey1720230151480 } from './1720230151480-AddApiKey'
|
||||
import { AddActionToChatMessage1721078251523 } from './1721078251523-AddActionToChatMessage'
|
||||
@@ -28,7 +31,23 @@ import { AddCustomTemplate1725629836652 } from './1725629836652-AddCustomTemplat
|
||||
import { AddArtifactsToChatMessage1726156258465 } from './1726156258465-AddArtifactsToChatMessage'
|
||||
import { AddFollowUpPrompts1726666318346 } from './1726666318346-AddFollowUpPrompts'
|
||||
import { AddTypeToAssistant1733011290987 } from './1733011290987-AddTypeToAssistant'
|
||||
import { AddSeqNoToDatasetRow1733752119696 } from './1733752119696-AddSeqNoToDatasetRow'
|
||||
import { AddExecutionEntity1738090872625 } from './1738090872625-AddExecutionEntity'
|
||||
import { FixOpenSourceAssistantTable1743758056188 } from './1743758056188-FixOpenSourceAssistantTable'
|
||||
import { AddErrorToEvaluationRun1744964560174 } from './1744964560174-AddErrorToEvaluationRun'
|
||||
import { ModifyExecutionDataColumnType1747902489801 } from './1747902489801-ModifyExecutionDataColumnType'
|
||||
|
||||
import { AddAuthTables1720230151482 } from '../../../enterprise/database/migrations/mariadb/1720230151482-AddAuthTables'
|
||||
import { AddWorkspace1725437498242 } from '../../../enterprise/database/migrations/mariadb/1725437498242-AddWorkspace'
|
||||
import { AddWorkspaceShared1726654922034 } from '../../../enterprise/database/migrations/mariadb/1726654922034-AddWorkspaceShared'
|
||||
import { AddWorkspaceIdToCustomTemplate1726655750383 } from '../../../enterprise/database/migrations/mariadb/1726655750383-AddWorkspaceIdToCustomTemplate'
|
||||
import { AddOrganization1727798417345 } from '../../../enterprise/database/migrations/mariadb/1727798417345-AddOrganization'
|
||||
import { LinkWorkspaceId1729130948686 } from '../../../enterprise/database/migrations/mariadb/1729130948686-LinkWorkspaceId'
|
||||
import { LinkOrganizationId1729133111652 } from '../../../enterprise/database/migrations/mariadb/1729133111652-LinkOrganizationId'
|
||||
import { AddSSOColumns1730519457880 } from '../../../enterprise/database/migrations/mariadb/1730519457880-AddSSOColumns'
|
||||
import { AddPersonalWorkspace1734074497540 } from '../../../enterprise/database/migrations/mariadb/1734074497540-AddPersonalWorkspace'
|
||||
import { RefactorEnterpriseDatabase1737076223692 } from '../../../enterprise/database/migrations/mariadb/1737076223692-RefactorEnterpriseDatabase'
|
||||
import { ExecutionLinkWorkspaceId1746862866554 } from '../../../enterprise/database/migrations/mariadb/1746862866554-ExecutionLinkWorkspaceId'
|
||||
|
||||
export const mariadbMigrations = [
|
||||
Init1693840429259,
|
||||
@@ -51,15 +70,33 @@ export const mariadbMigrations = [
|
||||
AddDocumentStore1711637331047,
|
||||
AddLead1710832127079,
|
||||
AddLeadToChatMessage1711538023578,
|
||||
AddEvaluation1714548873039,
|
||||
AddDatasets1714548903384,
|
||||
AddAgentReasoningToChatMessage1714679514451,
|
||||
AddTypeToChatFlow1716300000000,
|
||||
AddEvaluator1714808591644,
|
||||
AddVectorStoreConfigToDocStore1715861032479,
|
||||
AddTypeToChatFlow1716300000000,
|
||||
AddApiKey1720230151480,
|
||||
AddActionToChatMessage1721078251523,
|
||||
LongTextColumn1722301395521,
|
||||
AddCustomTemplate1725629836652,
|
||||
AddArtifactsToChatMessage1726156258465,
|
||||
AddFollowUpPrompts1726666318346,
|
||||
AddTypeToAssistant1733011290987,
|
||||
AddExecutionEntity1738090872625
|
||||
AddArtifactsToChatMessage1726156258465,
|
||||
AddAuthTables1720230151482,
|
||||
AddWorkspace1725437498242,
|
||||
AddWorkspaceShared1726654922034,
|
||||
AddWorkspaceIdToCustomTemplate1726655750383,
|
||||
AddOrganization1727798417345,
|
||||
LinkWorkspaceId1729130948686,
|
||||
LinkOrganizationId1729133111652,
|
||||
AddSSOColumns1730519457880,
|
||||
AddSeqNoToDatasetRow1733752119696,
|
||||
AddPersonalWorkspace1734074497540,
|
||||
RefactorEnterpriseDatabase1737076223692,
|
||||
AddExecutionEntity1738090872625,
|
||||
FixOpenSourceAssistantTable1743758056188,
|
||||
AddErrorToEvaluationRun1744964560174,
|
||||
ExecutionLinkWorkspaceId1746862866554,
|
||||
ModifyExecutionDataColumnType1747902489801
|
||||
]
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm'
|
||||
|
||||
export class AddEvaluation1714548873039 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE IF NOT EXISTS \`evaluation\` (
|
||||
\`id\` varchar(36) NOT NULL,
|
||||
\`chatflowId\` LONGTEXT NOT NULL,
|
||||
\`datasetId\` LONGTEXT NOT NULL,
|
||||
\`name\` varchar(255) NOT NULL,
|
||||
\`chatflowName\` varchar(255) NOT NULL,
|
||||
\`datasetName\` varchar(255) NOT NULL,
|
||||
\`additionalConfig\` LONGTEXT,
|
||||
\`average_metrics\` LONGTEXT NOT NULL,
|
||||
\`status\` varchar(10) NOT NULL,
|
||||
\`evaluationType\` varchar(20) NOT NULL,
|
||||
\`runDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
|
||||
PRIMARY KEY (\`id\`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;`
|
||||
)
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE IF NOT EXISTS \`evaluation_run\` (
|
||||
\`id\` varchar(36) NOT NULL,
|
||||
\`evaluationId\` varchar(36) NOT NULL,
|
||||
\`expectedOutput\` LONGTEXT NOT NULL,
|
||||
\`actualOutput\` LONGTEXT NOT NULL,
|
||||
\`evaluators\` LONGTEXT,
|
||||
\`input\` LONGTEXT DEFAULT NULL,
|
||||
\`metrics\` TEXT DEFAULT NULL,
|
||||
\`llmEvaluators\` TEXT DEFAULT NULL,
|
||||
\`runDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
|
||||
PRIMARY KEY (\`id\`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;`
|
||||
)
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`DROP TABLE evaluation`)
|
||||
await queryRunner.query(`DROP TABLE evaluation_run`)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm'
|
||||
|
||||
export class AddDatasets1714548903384 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE IF NOT EXISTS \`dataset\` (
|
||||
\`id\` varchar(36) NOT NULL,
|
||||
\`name\` varchar(255) NOT NULL,
|
||||
\`description\` varchar(255) DEFAULT NULL,
|
||||
\`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
|
||||
\`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
|
||||
PRIMARY KEY (\`id\`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;`
|
||||
)
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE IF NOT EXISTS \`dataset_row\` (
|
||||
\`id\` varchar(36) NOT NULL,
|
||||
\`datasetId\` varchar(36) NOT NULL,
|
||||
\`input\` LONGTEXT NOT NULL,
|
||||
\`output\` LONGTEXT DEFAULT NULL,
|
||||
\`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
|
||||
PRIMARY KEY (\`id\`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;`
|
||||
)
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`DROP TABLE dataset`)
|
||||
await queryRunner.query(`DROP TABLE dataset_row`)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm'
|
||||
|
||||
export class AddEvaluator1714808591644 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE IF NOT EXISTS \`evaluator\` (
|
||||
\`id\` varchar(36) NOT NULL,
|
||||
\`name\` varchar(255) NOT NULL,
|
||||
\`type\` varchar(25) DEFAULT NULL,
|
||||
\`config\` LONGTEXT DEFAULT NULL,
|
||||
\`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
|
||||
\`updatedDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
|
||||
PRIMARY KEY (\`id\`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;`
|
||||
)
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`DROP TABLE evaluator`)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm'
|
||||
|
||||
export class AddSeqNoToDatasetRow1733752119696 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
const columnExists = await queryRunner.hasColumn('dataset_row', 'sequence_no')
|
||||
if (!columnExists) queryRunner.query(`ALTER TABLE \`dataset_row\` ADD COLUMN \`sequence_no\` INT DEFAULT -1;`)
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "dataset_row" DROP COLUMN "sequence_no";`)
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm'
|
||||
import { Assistant } from '../../entities/Assistant'
|
||||
|
||||
export class FixOpenSourceAssistantTable1743758056188 implements MigrationInterface {
|
||||
name = 'FixOpenSourceAssistantTable1743758056188'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
const columnExists = await queryRunner.hasColumn('assistant', 'type')
|
||||
if (!columnExists) {
|
||||
await queryRunner.query(`ALTER TABLE \`assistant\` ADD COLUMN \`type\` TEXT;`)
|
||||
await queryRunner.query(`UPDATE \`assistant\` SET \`type\` = 'OPENAI';`)
|
||||
|
||||
const assistants: Assistant[] = await queryRunner.query(`SELECT * FROM \`assistant\`;`)
|
||||
for (let assistant of assistants) {
|
||||
const details = JSON.parse(assistant.details)
|
||||
if (!details?.id) await queryRunner.query(`UPDATE \`assistant\` SET \`type\` = 'CUSTOM' WHERE id = '${assistant.id}';`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`assistant\` DROP COLUMN \`type\`;`)
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm'
|
||||
|
||||
export class AddErrorToEvaluationRun1744964560174 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
const columnExists = await queryRunner.hasColumn('evaluation_run', 'errors')
|
||||
if (!columnExists) queryRunner.query(`ALTER TABLE \`evaluation_run\` ADD COLUMN \`errors\` LONGTEXT NULL DEFAULT ('[]');`)
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "evaluation_run" DROP COLUMN "errors";`)
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm'
|
||||
|
||||
export class FixErrorsColumnInEvaluationRun1746437114935 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
const columnExists = await queryRunner.hasColumn('evaluation_run', 'errors')
|
||||
if (!columnExists) queryRunner.query(`ALTER TABLE \`evaluation_run\` ADD COLUMN \`errors\` LONGTEXT NULL DEFAULT ('[]');`)
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "evaluation_run" DROP COLUMN "errors";`)
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm'
|
||||
|
||||
export class ModifyExecutionDataColumnType1747902489801 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
queryRunner.query(`ALTER TABLE \`execution\` MODIFY COLUMN \`executionData\` LONGTEXT NOT NULL;`)
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
queryRunner.query(`ALTER TABLE \`execution\` MODIFY COLUMN \`executionData\` TEXT NOT NULL;`)
|
||||
}
|
||||
}
|
||||
@@ -17,9 +17,12 @@ 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 { AddEvaluation1714548873039 } from './1714548873039-AddEvaluation'
|
||||
import { AddDatasets1714548903384 } from './1714548903384-AddDataset'
|
||||
import { AddAgentReasoningToChatMessage1714679514451 } from './1714679514451-AddAgentReasoningToChatMessage'
|
||||
import { AddEvaluator1714808591644 } from './1714808591644-AddEvaluator'
|
||||
import { AddVectorStoreConfigToDocStore1715861032479 } from './1715861032479-AddVectorStoreConfigToDocStore'
|
||||
import { AddTypeToChatFlow1716300000000 } from './1716300000000-AddTypeToChatFlow'
|
||||
import { AddApiKey1720230151480 } from './1720230151480-AddApiKey'
|
||||
import { AddActionToChatMessage1721078251523 } from './1721078251523-AddActionToChatMessage'
|
||||
@@ -28,7 +31,24 @@ import { AddCustomTemplate1725629836652 } from './1725629836652-AddCustomTemplat
|
||||
import { AddArtifactsToChatMessage1726156258465 } from './1726156258465-AddArtifactsToChatMessage'
|
||||
import { AddFollowUpPrompts1726666302024 } from './1726666302024-AddFollowUpPrompts'
|
||||
import { AddTypeToAssistant1733011290987 } from './1733011290987-AddTypeToAssistant'
|
||||
import { AddSeqNoToDatasetRow1733752119696 } from './1733752119696-AddSeqNoToDatasetRow'
|
||||
import { AddExecutionEntity1738090872625 } from './1738090872625-AddExecutionEntity'
|
||||
import { FixOpenSourceAssistantTable1743758056188 } from './1743758056188-FixOpenSourceAssistantTable'
|
||||
import { AddErrorToEvaluationRun1744964560174 } from './1744964560174-AddErrorToEvaluationRun'
|
||||
import { FixErrorsColumnInEvaluationRun1746437114935 } from './1746437114935-FixErrorsColumnInEvaluationRun'
|
||||
import { ModifyExecutionDataColumnType1747902489801 } from './1747902489801-ModifyExecutionDataColumnType'
|
||||
|
||||
import { AddAuthTables1720230151482 } from '../../../enterprise/database/migrations/mysql/1720230151482-AddAuthTables'
|
||||
import { AddWorkspace1720230151484 } from '../../../enterprise/database/migrations/mysql/1720230151484-AddWorkspace'
|
||||
import { AddWorkspaceShared1726654922034 } from '../../../enterprise/database/migrations/mysql/1726654922034-AddWorkspaceShared'
|
||||
import { AddWorkspaceIdToCustomTemplate1726655750383 } from '../../../enterprise/database/migrations/mysql/1726655750383-AddWorkspaceIdToCustomTemplate'
|
||||
import { AddOrganization1727798417345 } from '../../../enterprise/database/migrations/mysql/1727798417345-AddOrganization'
|
||||
import { LinkWorkspaceId1729130948686 } from '../../../enterprise/database/migrations/mysql/1729130948686-LinkWorkspaceId'
|
||||
import { LinkOrganizationId1729133111652 } from '../../../enterprise/database/migrations/mysql/1729133111652-LinkOrganizationId'
|
||||
import { AddSSOColumns1730519457880 } from '../../../enterprise/database/migrations/mysql/1730519457880-AddSSOColumns'
|
||||
import { AddPersonalWorkspace1734074497540 } from '../../../enterprise/database/migrations/mysql/1734074497540-AddPersonalWorkspace'
|
||||
import { RefactorEnterpriseDatabase1737076223692 } from '../../../enterprise/database/migrations/mysql/1737076223692-RefactorEnterpriseDatabase'
|
||||
import { ExecutionLinkWorkspaceId1746862866554 } from '../../../enterprise/database/migrations/mysql/1746862866554-ExecutionLinkWorkspaceId'
|
||||
|
||||
export const mysqlMigrations = [
|
||||
Init1693840429259,
|
||||
@@ -48,12 +68,15 @@ export const mysqlMigrations = [
|
||||
AddSpeechToText1706364937060,
|
||||
AddUpsertHistoryEntity1709814301358,
|
||||
AddFeedback1707213626553,
|
||||
AddEvaluation1714548873039,
|
||||
AddDatasets1714548903384,
|
||||
AddEvaluator1714808591644,
|
||||
AddDocumentStore1711637331047,
|
||||
AddLead1710832127079,
|
||||
AddLeadToChatMessage1711538023578,
|
||||
AddAgentReasoningToChatMessage1714679514451,
|
||||
AddTypeToChatFlow1716300000000,
|
||||
AddVectorStoreConfigToDocStore1715861032479,
|
||||
AddTypeToChatFlow1716300000000,
|
||||
AddApiKey1720230151480,
|
||||
AddActionToChatMessage1721078251523,
|
||||
LongTextColumn1722301395521,
|
||||
@@ -61,5 +84,21 @@ export const mysqlMigrations = [
|
||||
AddArtifactsToChatMessage1726156258465,
|
||||
AddFollowUpPrompts1726666302024,
|
||||
AddTypeToAssistant1733011290987,
|
||||
AddExecutionEntity1738090872625
|
||||
AddAuthTables1720230151482,
|
||||
AddWorkspace1720230151484,
|
||||
AddWorkspaceShared1726654922034,
|
||||
AddWorkspaceIdToCustomTemplate1726655750383,
|
||||
AddOrganization1727798417345,
|
||||
LinkWorkspaceId1729130948686,
|
||||
LinkOrganizationId1729133111652,
|
||||
AddSSOColumns1730519457880,
|
||||
AddSeqNoToDatasetRow1733752119696,
|
||||
AddPersonalWorkspace1734074497540,
|
||||
RefactorEnterpriseDatabase1737076223692,
|
||||
FixOpenSourceAssistantTable1743758056188,
|
||||
AddExecutionEntity1738090872625,
|
||||
AddErrorToEvaluationRun1744964560174,
|
||||
FixErrorsColumnInEvaluationRun1746437114935,
|
||||
ExecutionLinkWorkspaceId1746862866554,
|
||||
ModifyExecutionDataColumnType1747902489801
|
||||
]
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm'
|
||||
|
||||
export class AddEvaluation1714548873039 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE IF NOT EXISTS evaluation (
|
||||
id uuid NOT NULL DEFAULT uuid_generate_v4(),
|
||||
"name" varchar NOT NULL,
|
||||
"chatflowId" text NOT NULL,
|
||||
"chatflowName" text NOT NULL,
|
||||
"datasetId" varchar NOT NULL,
|
||||
"datasetName" varchar NOT NULL,
|
||||
"additionalConfig" text NULL,
|
||||
"evaluationType" varchar NOT NULL,
|
||||
"status" varchar NOT NULL,
|
||||
"average_metrics" text NULL,
|
||||
"runDate" timestamp NOT NULL DEFAULT now(),
|
||||
CONSTRAINT "PK_98989043dd804f54-9830ab99f8" PRIMARY KEY (id)
|
||||
);`
|
||||
)
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE IF NOT EXISTS evaluation_run (
|
||||
id uuid NOT NULL DEFAULT uuid_generate_v4(),
|
||||
"evaluationId" varchar NOT NULL,
|
||||
"input" text NOT NULL,
|
||||
"expectedOutput" text NULL,
|
||||
"actualOutput" text NULL,
|
||||
"evaluators" text NULL,
|
||||
"llmEvaluators" text DEFAULT NULL,
|
||||
"metrics" text NULL,
|
||||
"runDate" timestamp NOT NULL DEFAULT now(),
|
||||
CONSTRAINT "PK_98989927dd804f54-9840ab23f8" PRIMARY KEY (id)
|
||||
);`
|
||||
)
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`DROP TABLE evaluation`)
|
||||
await queryRunner.query(`DROP TABLE evaluation_run`)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm'
|
||||
|
||||
export class AddDatasets1714548903384 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE IF NOT EXISTS dataset (
|
||||
id uuid NOT NULL DEFAULT uuid_generate_v4(),
|
||||
"name" varchar NOT NULL,
|
||||
"description" varchar NULL,
|
||||
"createdDate" timestamp NOT NULL DEFAULT now(),
|
||||
"updatedDate" timestamp NOT NULL DEFAULT now(),
|
||||
CONSTRAINT "PK_98419043dd804f54-9830ab99f8" PRIMARY KEY (id)
|
||||
);`
|
||||
)
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE IF NOT EXISTS dataset_row (
|
||||
id uuid NOT NULL DEFAULT uuid_generate_v4(),
|
||||
"datasetId" varchar NOT NULL,
|
||||
"input" text NOT NULL,
|
||||
"output" text NULL,
|
||||
"updatedDate" timestamp NOT NULL DEFAULT now(),
|
||||
CONSTRAINT "PK_98909027dd804f54-9840ab99f8" PRIMARY KEY (id)
|
||||
);`
|
||||
)
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`DROP TABLE dataset`)
|
||||
await queryRunner.query(`DROP TABLE dataset_row`)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm'
|
||||
|
||||
export class AddEvaluator1714808591644 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE IF NOT EXISTS evaluator (
|
||||
id uuid NOT NULL DEFAULT uuid_generate_v4(),
|
||||
"name" varchar NOT NULL,
|
||||
"type" text NULL,
|
||||
"config" text NULL,
|
||||
"createdDate" timestamp NOT NULL DEFAULT now(),
|
||||
"updatedDate" timestamp NOT NULL DEFAULT now(),
|
||||
CONSTRAINT "PK_90019043dd804f54-9830ab11f8" PRIMARY KEY (id)
|
||||
);`
|
||||
)
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`DROP TABLE evaluator`)
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm'
|
||||
|
||||
export class AddSeqNoToDatasetRow1733752119696 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "dataset_row" ADD COLUMN IF NOT EXISTS "sequence_no" integer DEFAULT -1;`)
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "dataset_row" DROP COLUMN "sequence_no";`)
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm'
|
||||
import { Assistant } from '../../entities/Assistant'
|
||||
|
||||
export class FixOpenSourceAssistantTable1743758056188 implements MigrationInterface {
|
||||
name = 'FixOpenSourceAssistantTable1743758056188'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
const columnExists = await queryRunner.hasColumn('assistant', 'type')
|
||||
if (!columnExists) {
|
||||
await queryRunner.query(`ALTER TABLE "assistant" ADD COLUMN "type" TEXT;`)
|
||||
await queryRunner.query(`UPDATE "assistant" SET "type" = 'OPENAI';`)
|
||||
|
||||
const assistants: Assistant[] = await queryRunner.query(`SELECT * FROM "assistant";`)
|
||||
for (let assistant of assistants) {
|
||||
const details = JSON.parse(assistant.details)
|
||||
if (!details?.id) await queryRunner.query(`UPDATE "assistant" SET "type" = 'CUSTOM' WHERE id = '${assistant.id}';`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "assistant" DROP COLUMN "type";`)
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm'
|
||||
|
||||
export class AddErrorToEvaluationRun1744964560174 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "evaluation_run" ADD COLUMN IF NOT EXISTS "errors" TEXT NULL DEFAULT '[]';`)
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "evaluation_run" DROP COLUMN "errors";`)
|
||||
}
|
||||
}
|
||||
@@ -18,9 +18,12 @@ import { AddUpsertHistoryEntity1709814301358 } from './1709814301358-AddUpsertHi
|
||||
import { FieldTypes1710497452584 } from './1710497452584-FieldTypes'
|
||||
import { AddLead1710832137905 } from './1710832137905-AddLead'
|
||||
import { AddLeadToChatMessage1711538016098 } from './1711538016098-AddLeadToChatMessage'
|
||||
import { AddVectorStoreConfigToDocStore1715861032479 } from './1715861032479-AddVectorStoreConfigToDocStore'
|
||||
import { AddDocumentStore1711637331047 } from './1711637331047-AddDocumentStore'
|
||||
import { AddEvaluation1714548873039 } from './1714548873039-AddEvaluation'
|
||||
import { AddDatasets1714548903384 } from './1714548903384-AddDataset'
|
||||
import { AddAgentReasoningToChatMessage1714679514451 } from './1714679514451-AddAgentReasoningToChatMessage'
|
||||
import { AddEvaluator1714808591644 } from './1714808591644-AddEvaluator'
|
||||
import { AddVectorStoreConfigToDocStore1715861032479 } from './1715861032479-AddVectorStoreConfigToDocStore'
|
||||
import { AddTypeToChatFlow1716300000000 } from './1716300000000-AddTypeToChatFlow'
|
||||
import { AddApiKey1720230151480 } from './1720230151480-AddApiKey'
|
||||
import { AddActionToChatMessage1721078251523 } from './1721078251523-AddActionToChatMessage'
|
||||
@@ -28,7 +31,22 @@ import { AddCustomTemplate1725629836652 } from './1725629836652-AddCustomTemplat
|
||||
import { AddArtifactsToChatMessage1726156258465 } from './1726156258465-AddArtifactsToChatMessage'
|
||||
import { AddFollowUpPrompts1726666309552 } from './1726666309552-AddFollowUpPrompts'
|
||||
import { AddTypeToAssistant1733011290987 } from './1733011290987-AddTypeToAssistant'
|
||||
import { AddSeqNoToDatasetRow1733752119696 } from './1733752119696-AddSeqNoToDatasetRow'
|
||||
import { AddExecutionEntity1738090872625 } from './1738090872625-AddExecutionEntity'
|
||||
import { FixOpenSourceAssistantTable1743758056188 } from './1743758056188-FixOpenSourceAssistantTable'
|
||||
import { AddErrorToEvaluationRun1744964560174 } from './1744964560174-AddErrorToEvaluationRun'
|
||||
|
||||
import { AddAuthTables1720230151482 } from '../../../enterprise/database/migrations/postgres/1720230151482-AddAuthTables'
|
||||
import { AddWorkspace1720230151484 } from '../../../enterprise/database/migrations/postgres/1720230151484-AddWorkspace'
|
||||
import { AddWorkspaceShared1726654922034 } from '../../../enterprise/database/migrations/postgres/1726654922034-AddWorkspaceShared'
|
||||
import { AddWorkspaceIdToCustomTemplate1726655750383 } from '../../../enterprise/database/migrations/postgres/1726655750383-AddWorkspaceIdToCustomTemplate'
|
||||
import { AddOrganization1727798417345 } from '../../../enterprise/database/migrations/postgres/1727798417345-AddOrganization'
|
||||
import { LinkWorkspaceId1729130948686 } from '../../../enterprise/database/migrations/postgres/1729130948686-LinkWorkspaceId'
|
||||
import { LinkOrganizationId1729133111652 } from '../../../enterprise/database/migrations/postgres/1729133111652-LinkOrganizationId'
|
||||
import { AddSSOColumns1730519457880 } from '../../../enterprise/database/migrations/postgres/1730519457880-AddSSOColumns'
|
||||
import { AddPersonalWorkspace1734074497540 } from '../../../enterprise/database/migrations/postgres/1734074497540-AddPersonalWorkspace'
|
||||
import { RefactorEnterpriseDatabase1737076223692 } from '../../../enterprise/database/migrations/postgres/1737076223692-RefactorEnterpriseDatabase'
|
||||
import { ExecutionLinkWorkspaceId1746862866554 } from '../../../enterprise/database/migrations/postgres/1746862866554-ExecutionLinkWorkspaceId'
|
||||
|
||||
export const postgresMigrations = [
|
||||
Init1693891895163,
|
||||
@@ -49,17 +67,34 @@ export const postgresMigrations = [
|
||||
AddUpsertHistoryEntity1709814301358,
|
||||
AddFeedback1707213601923,
|
||||
FieldTypes1710497452584,
|
||||
AddEvaluation1714548873039,
|
||||
AddDatasets1714548903384,
|
||||
AddEvaluator1714808591644,
|
||||
AddDocumentStore1711637331047,
|
||||
AddLead1710832137905,
|
||||
AddLeadToChatMessage1711538016098,
|
||||
AddAgentReasoningToChatMessage1714679514451,
|
||||
AddTypeToChatFlow1716300000000,
|
||||
AddVectorStoreConfigToDocStore1715861032479,
|
||||
AddTypeToChatFlow1716300000000,
|
||||
AddApiKey1720230151480,
|
||||
AddActionToChatMessage1721078251523,
|
||||
AddCustomTemplate1725629836652,
|
||||
AddArtifactsToChatMessage1726156258465,
|
||||
AddFollowUpPrompts1726666309552,
|
||||
AddTypeToAssistant1733011290987,
|
||||
AddExecutionEntity1738090872625
|
||||
AddAuthTables1720230151482,
|
||||
AddWorkspace1720230151484,
|
||||
AddWorkspaceShared1726654922034,
|
||||
AddWorkspaceIdToCustomTemplate1726655750383,
|
||||
AddOrganization1727798417345,
|
||||
LinkWorkspaceId1729130948686,
|
||||
LinkOrganizationId1729133111652,
|
||||
AddSSOColumns1730519457880,
|
||||
AddSeqNoToDatasetRow1733752119696,
|
||||
AddPersonalWorkspace1734074497540,
|
||||
RefactorEnterpriseDatabase1737076223692,
|
||||
AddExecutionEntity1738090872625,
|
||||
FixOpenSourceAssistantTable1743758056188,
|
||||
AddErrorToEvaluationRun1744964560174,
|
||||
ExecutionLinkWorkspaceId1746862866554
|
||||
]
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm'
|
||||
|
||||
export class AddEvaluation1714548873039 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE IF NOT EXISTS "evaluation" (
|
||||
"id" varchar PRIMARY KEY NOT NULL,
|
||||
"name" varchar NOT NULL,
|
||||
"chatflowId" text NOT NULL,
|
||||
"chatflowName" text NOT NULL,
|
||||
"datasetId" varchar NOT NULL,
|
||||
"datasetName" varchar NOT NULL,
|
||||
"additionalConfig" text,
|
||||
"status" varchar NOT NULL,
|
||||
"evaluationType" varchar,
|
||||
"average_metrics" text,
|
||||
"runDate" datetime NOT NULL DEFAULT (datetime('now')));`
|
||||
)
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE IF NOT EXISTS "evaluation_run" (
|
||||
"id" varchar PRIMARY KEY NOT NULL,
|
||||
"evaluationId" text NOT NULL,
|
||||
"input" text NOT NULL,
|
||||
"expectedOutput" text NOT NULL,
|
||||
"actualOutput" text NOT NULL,
|
||||
"evaluators" text,
|
||||
"llmEvaluators" TEXT DEFAULT NULL,
|
||||
"metrics" text NULL,
|
||||
"runDate" datetime NOT NULL DEFAULT (datetime('now')));`
|
||||
)
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`DROP TABLE evaluation`)
|
||||
await queryRunner.query(`DROP TABLE evaluation_run`)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm'
|
||||
|
||||
export class AddDatasets1714548903384 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE IF NOT EXISTS "dataset" ("id" varchar PRIMARY KEY NOT NULL,
|
||||
"name" text NOT NULL,
|
||||
"description" varchar,
|
||||
"createdDate" datetime NOT NULL DEFAULT (datetime('now')),
|
||||
"updatedDate" datetime NOT NULL DEFAULT (datetime('now')));`
|
||||
)
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE IF NOT EXISTS "dataset_row" ("id" varchar PRIMARY KEY NOT NULL,
|
||||
"datasetId" text NOT NULL,
|
||||
"input" text NOT NULL,
|
||||
"output" text NOT NULL,
|
||||
"updatedDate" datetime NOT NULL DEFAULT (datetime('now')));`
|
||||
)
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`DROP TABLE dataset`)
|
||||
await queryRunner.query(`DROP TABLE dataset_row`)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm'
|
||||
|
||||
export class AddEvaluator1714808591644 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE IF NOT EXISTS "evaluator" ("id" varchar PRIMARY KEY NOT NULL,
|
||||
"name" text NOT NULL,
|
||||
"type" varchar,
|
||||
"config" text,
|
||||
"createdDate" datetime NOT NULL DEFAULT (datetime('now')),
|
||||
"updatedDate" datetime NOT NULL DEFAULT (datetime('now')));`
|
||||
)
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`DROP TABLE evaluator`)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm'
|
||||
|
||||
export class AddSeqNoToDatasetRow1733752119696 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "dataset_row" ADD COLUMN "sequence_no" integer DEFAULT -1;`)
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "dataset_row" DROP COLUMN "sequence_no";`)
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm'
|
||||
import { Assistant } from '../../entities/Assistant'
|
||||
|
||||
export async function fixOpenSourceAssistantTable(queryRunner: QueryRunner): Promise<void> {
|
||||
const columnExists = await queryRunner.hasColumn('assistant', 'type')
|
||||
if (!columnExists) {
|
||||
await queryRunner.query(`ALTER TABLE "assistant" ADD COLUMN "type" TEXT;`)
|
||||
await queryRunner.query(`UPDATE "assistant" SET "type" = 'OPENAI';`)
|
||||
|
||||
const assistants: Assistant[] = await queryRunner.query(`SELECT * FROM "assistant";`)
|
||||
for (let assistant of assistants) {
|
||||
const details = JSON.parse(assistant.details)
|
||||
if (!details?.id) await queryRunner.query(`UPDATE "assistant" SET "type" = 'CUSTOM' WHERE id = '${assistant.id}';`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class FixOpenSourceAssistantTable1743758056188 implements MigrationInterface {
|
||||
name = 'FixOpenSourceAssistantTable1743758056188'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await fixOpenSourceAssistantTable(queryRunner)
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "assistant" DROP COLUMN "type";`)
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm'
|
||||
|
||||
export class AddErrorToEvaluationRun1744964560174 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "evaluation_run" ADD COLUMN "errors" TEXT NULL DEFAULT '[]';`)
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "evaluation_run" DROP COLUMN "errors";`)
|
||||
}
|
||||
}
|
||||
@@ -17,17 +17,35 @@ import { AddFeedback1707213619308 } from './1707213619308-AddFeedback'
|
||||
import { AddUpsertHistoryEntity1709814301358 } from './1709814301358-AddUpsertHistoryEntity'
|
||||
import { AddLead1710832117612 } from './1710832117612-AddLead'
|
||||
import { AddLeadToChatMessage1711537986113 } from './1711537986113-AddLeadToChatMessage'
|
||||
import { AddVectorStoreConfigToDocStore1715861032479 } from './1715861032479-AddVectorStoreConfigToDocStore'
|
||||
import { AddDocumentStore1711637331047 } from './1711637331047-AddDocumentStore'
|
||||
import { AddEvaluation1714548873039 } from './1714548873039-AddEvaluation'
|
||||
import { AddDatasets1714548903384 } from './1714548903384-AddDataset'
|
||||
import { AddAgentReasoningToChatMessage1714679514451 } from './1714679514451-AddAgentReasoningToChatMessage'
|
||||
import { AddEvaluator1714808591644 } from './1714808591644-AddEvaluator'
|
||||
import { AddVectorStoreConfigToDocStore1715861032479 } from './1715861032479-AddVectorStoreConfigToDocStore'
|
||||
import { AddTypeToChatFlow1716300000000 } from './1716300000000-AddTypeToChatFlow'
|
||||
import { AddApiKey1720230151480 } from './1720230151480-AddApiKey'
|
||||
import { AddActionToChatMessage1721078251523 } from './1721078251523-AddActionToChatMessage'
|
||||
import { AddArtifactsToChatMessage1726156258465 } from './1726156258465-AddArtifactsToChatMessage'
|
||||
import { AddCustomTemplate1725629836652 } from './1725629836652-AddCustomTemplate'
|
||||
import { AddArtifactsToChatMessage1726156258465 } from './1726156258465-AddArtifactsToChatMessage'
|
||||
import { AddFollowUpPrompts1726666294213 } from './1726666294213-AddFollowUpPrompts'
|
||||
import { AddTypeToAssistant1733011290987 } from './1733011290987-AddTypeToAssistant'
|
||||
import { AddSeqNoToDatasetRow1733752119696 } from './1733752119696-AddSeqNoToDatasetRow'
|
||||
import { AddExecutionEntity1738090872625 } from './1738090872625-AddExecutionEntity'
|
||||
import { FixOpenSourceAssistantTable1743758056188 } from './1743758056188-FixOpenSourceAssistantTable'
|
||||
import { AddErrorToEvaluationRun1744964560174 } from './1744964560174-AddErrorToEvaluationRun'
|
||||
|
||||
import { AddAuthTables1720230151482 } from '../../../enterprise/database/migrations/sqlite/1720230151482-AddAuthTables'
|
||||
import { AddWorkspace1720230151484 } from '../../../enterprise/database/migrations/sqlite/1720230151484-AddWorkspace'
|
||||
import { AddWorkspaceShared1726654922034 } from '../../../enterprise/database/migrations/sqlite/1726654922034-AddWorkspaceShared'
|
||||
import { AddWorkspaceIdToCustomTemplate1726655750383 } from '../../../enterprise/database/migrations/sqlite/1726655750383-AddWorkspaceIdToCustomTemplate'
|
||||
import { AddOrganization1727798417345 } from '../../../enterprise/database/migrations/sqlite/1727798417345-AddOrganization'
|
||||
import { LinkWorkspaceId1729130948686 } from '../../../enterprise/database/migrations/sqlite/1729130948686-LinkWorkspaceId'
|
||||
import { LinkOrganizationId1729133111652 } from '../../../enterprise/database/migrations/sqlite/1729133111652-LinkOrganizationId'
|
||||
import { AddSSOColumns1730519457880 } from '../../../enterprise/database/migrations/sqlite/1730519457880-AddSSOColumns'
|
||||
import { AddPersonalWorkspace1734074497540 } from '../../../enterprise/database/migrations/sqlite/1734074497540-AddPersonalWorkspace'
|
||||
import { RefactorEnterpriseDatabase1737076223692 } from '../../../enterprise/database/migrations/sqlite/1737076223692-RefactorEnterpriseDatabase'
|
||||
import { ExecutionLinkWorkspaceId1746862866554 } from '../../../enterprise/database/migrations/sqlite/1746862866554-ExecutionLinkWorkspaceId'
|
||||
|
||||
export const sqliteMigrations = [
|
||||
Init1693835579790,
|
||||
@@ -46,18 +64,35 @@ export const sqliteMigrations = [
|
||||
AddFileUploadsToChatMessage1701788586491,
|
||||
AddSpeechToText1706364937060,
|
||||
AddUpsertHistoryEntity1709814301358,
|
||||
AddEvaluation1714548873039,
|
||||
AddDatasets1714548903384,
|
||||
AddEvaluator1714808591644,
|
||||
AddFeedback1707213619308,
|
||||
AddDocumentStore1711637331047,
|
||||
AddLead1710832117612,
|
||||
AddLeadToChatMessage1711537986113,
|
||||
AddAgentReasoningToChatMessage1714679514451,
|
||||
AddTypeToChatFlow1716300000000,
|
||||
AddVectorStoreConfigToDocStore1715861032479,
|
||||
AddTypeToChatFlow1716300000000,
|
||||
AddApiKey1720230151480,
|
||||
AddActionToChatMessage1721078251523,
|
||||
AddArtifactsToChatMessage1726156258465,
|
||||
AddCustomTemplate1725629836652,
|
||||
AddFollowUpPrompts1726666294213,
|
||||
AddTypeToAssistant1733011290987,
|
||||
AddExecutionEntity1738090872625
|
||||
AddCustomTemplate1725629836652,
|
||||
AddAuthTables1720230151482,
|
||||
AddWorkspace1720230151484,
|
||||
AddWorkspaceShared1726654922034,
|
||||
AddWorkspaceIdToCustomTemplate1726655750383,
|
||||
AddOrganization1727798417345,
|
||||
LinkWorkspaceId1729130948686,
|
||||
LinkOrganizationId1729133111652,
|
||||
AddSSOColumns1730519457880,
|
||||
AddSeqNoToDatasetRow1733752119696,
|
||||
AddPersonalWorkspace1734074497540,
|
||||
RefactorEnterpriseDatabase1737076223692,
|
||||
AddExecutionEntity1738090872625,
|
||||
FixOpenSourceAssistantTable1743758056188,
|
||||
AddErrorToEvaluationRun1744964560174,
|
||||
ExecutionLinkWorkspaceId1746862866554
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user