forked from FlowiseAI/Flowise
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add data source adapter of MariaDB (FlowiseAI#2595)
fix(datasource.ts): add mariadb
- Loading branch information
1 parent
34251fa
commit c8939dc
Showing
24 changed files
with
477 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
packages/server/src/database/migrations/mariadb/1693840429259-Init.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm' | ||
|
||
export class Init1693840429259 implements MigrationInterface { | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
`CREATE TABLE IF NOT EXISTS \`chat_flow\` ( | ||
\`id\` varchar(36) NOT NULL, | ||
\`name\` varchar(255) NOT NULL, | ||
\`flowData\` text NOT NULL, | ||
\`deployed\` tinyint DEFAULT NULL, | ||
\`isPublic\` tinyint DEFAULT NULL, | ||
\`apikeyid\` varchar(255) DEFAULT NULL, | ||
\`chatbotConfig\` 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 \`chat_message\` ( | ||
\`id\` varchar(36) NOT NULL, | ||
\`role\` varchar(255) NOT NULL, | ||
\`chatflowid\` varchar(255) NOT NULL, | ||
\`content\` text NOT NULL, | ||
\`sourceDocuments\` varchar(255) DEFAULT NULL, | ||
\`createdDate\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), | ||
PRIMARY KEY (\`id\`), | ||
KEY \`IDX_e574527322272fd838f4f0f3d3\` (\`chatflowid\`) | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;` | ||
) | ||
await queryRunner.query( | ||
`CREATE TABLE IF NOT EXISTS \`credential\` ( | ||
\`id\` varchar(36) NOT NULL, | ||
\`name\` varchar(255) NOT NULL, | ||
\`credentialName\` varchar(255) NOT NULL, | ||
\`encryptedData\` varchar(255) NOT 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 \`tool\` ( | ||
\`id\` varchar(36) NOT NULL, | ||
\`name\` varchar(255) NOT NULL, | ||
\`description\` text NOT NULL, | ||
\`color\` varchar(255) NOT NULL, | ||
\`iconSrc\` varchar(255) DEFAULT NULL, | ||
\`schema\` varchar(255) DEFAULT NULL, | ||
\`func\` 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;` | ||
) | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`DROP TABLE chat_flow`) | ||
await queryRunner.query(`DROP TABLE chat_message`) | ||
await queryRunner.query(`DROP TABLE credential`) | ||
await queryRunner.query(`DROP TABLE tool`) | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
packages/server/src/database/migrations/mariadb/1693997791471-ModifyChatFlow.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm' | ||
|
||
export class ModifyChatFlow1693997791471 implements MigrationInterface { | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE \`chat_flow\` MODIFY \`chatbotConfig\` TEXT;`) | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE \`chat_flow\` MODIFY \`chatbotConfig\` VARCHAR;`) | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
packages/server/src/database/migrations/mariadb/1693999022236-ModifyChatMessage.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm' | ||
|
||
export class ModifyChatMessage1693999022236 implements MigrationInterface { | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE \`chat_message\` MODIFY \`sourceDocuments\` TEXT;`) | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE \`chat_message\` MODIFY \`sourceDocuments\` VARCHAR;`) | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
packages/server/src/database/migrations/mariadb/1693999261583-ModifyCredential.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm' | ||
|
||
export class ModifyCredential1693999261583 implements MigrationInterface { | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE \`credential\` MODIFY \`encryptedData\` TEXT NOT NULL;`) | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE \`credential\` MODIFY \`encryptedData\` VARCHAR NOT NULL;`) | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
packages/server/src/database/migrations/mariadb/1694001465232-ModifyTool.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm' | ||
|
||
export class ModifyTool1694001465232 implements MigrationInterface { | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE \`tool\` MODIFY \`schema\` TEXT, MODIFY \`func\` TEXT;`) | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE \`tool\` MODIFY \`schema\` VARCHAR, MODIFY \`func\` VARCHAR;`) | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
packages/server/src/database/migrations/mariadb/1694099200729-AddApiConfig.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm' | ||
|
||
export class AddApiConfig1694099200729 implements MigrationInterface { | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
const columnExists = await queryRunner.hasColumn('chat_flow', 'apiConfig') | ||
if (!columnExists) queryRunner.query(`ALTER TABLE \`chat_flow\` ADD COLUMN \`apiConfig\` TEXT;`) | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE \`chat_flow\` DROP COLUMN \`apiConfig\`;`) | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
packages/server/src/database/migrations/mariadb/1694432361423-AddAnalytic.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm' | ||
|
||
export class AddAnalytic1694432361423 implements MigrationInterface { | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
const columnExists = await queryRunner.hasColumn('chat_flow', 'analytic') | ||
if (!columnExists) queryRunner.query(`ALTER TABLE \`chat_flow\` ADD COLUMN \`analytic\` TEXT;`) | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE \`chat_flow\` DROP COLUMN \`analytic\`;`) | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
packages/server/src/database/migrations/mariadb/1694658767766-AddChatHistory.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm' | ||
|
||
export class AddChatHistory1694658767766 implements MigrationInterface { | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
const chatTypeColumnExists = await queryRunner.hasColumn('chat_message', 'chatType') | ||
if (!chatTypeColumnExists) | ||
await queryRunner.query(`ALTER TABLE \`chat_message\` ADD COLUMN \`chatType\` VARCHAR(255) NOT NULL DEFAULT 'INTERNAL';`) | ||
|
||
const chatIdColumnExists = await queryRunner.hasColumn('chat_message', 'chatId') | ||
if (!chatIdColumnExists) await queryRunner.query(`ALTER TABLE \`chat_message\` ADD COLUMN \`chatId\` VARCHAR(255);`) | ||
const results: { id: string; chatflowid: string }[] = await queryRunner.query(`WITH RankedMessages AS ( | ||
SELECT | ||
\`chatflowid\`, | ||
\`id\`, | ||
\`createdDate\`, | ||
ROW_NUMBER() OVER (PARTITION BY \`chatflowid\` ORDER BY \`createdDate\`) AS row_num | ||
FROM \`chat_message\` | ||
) | ||
SELECT \`chatflowid\`, \`id\` | ||
FROM RankedMessages | ||
WHERE row_num = 1;`) | ||
for (const chatMessage of results) { | ||
await queryRunner.query( | ||
`UPDATE \`chat_message\` SET \`chatId\` = '${chatMessage.id}' WHERE \`chatflowid\` = '${chatMessage.chatflowid}'` | ||
) | ||
} | ||
await queryRunner.query(`ALTER TABLE \`chat_message\` MODIFY \`chatId\` VARCHAR(255) NOT NULL;`) | ||
|
||
const memoryTypeColumnExists = await queryRunner.hasColumn('chat_message', 'memoryType') | ||
if (!memoryTypeColumnExists) await queryRunner.query(`ALTER TABLE \`chat_message\` ADD COLUMN \`memoryType\` VARCHAR(255);`) | ||
|
||
const sessionIdColumnExists = await queryRunner.hasColumn('chat_message', 'sessionId') | ||
if (!sessionIdColumnExists) await queryRunner.query(`ALTER TABLE \`chat_message\` ADD COLUMN \`sessionId\` VARCHAR(255);`) | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
`ALTER TABLE \`chat_message\` DROP COLUMN \`chatType\`, DROP COLUMN \`chatId\`, DROP COLUMN \`memoryType\`, DROP COLUMN \`sessionId\`;` | ||
) | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
packages/server/src/database/migrations/mariadb/1699325775451-AddAssistantEntity.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm' | ||
|
||
export class AddAssistantEntity1699325775451 implements MigrationInterface { | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
`CREATE TABLE IF NOT EXISTS \`assistant\` ( | ||
\`id\` varchar(36) NOT NULL, | ||
\`credential\` varchar(255) NOT NULL, | ||
\`details\` text NOT NULL, | ||
\`iconSrc\` 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;` | ||
) | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`DROP TABLE assistant`) | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
packages/server/src/database/migrations/mariadb/1699481607341-AddUsedToolsToChatMessage.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm' | ||
|
||
export class AddUsedToolsToChatMessage1699481607341 implements MigrationInterface { | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
const columnExists = await queryRunner.hasColumn('chat_message', 'usedTools') | ||
if (!columnExists) queryRunner.query(`ALTER TABLE \`chat_message\` ADD COLUMN \`usedTools\` TEXT;`) | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE \`chat_message\` DROP COLUMN \`usedTools\`;`) | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
packages/server/src/database/migrations/mariadb/1699900910291-AddCategoryToChatFlow.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm' | ||
|
||
export class AddCategoryToChatFlow1699900910291 implements MigrationInterface { | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
const columnExists = await queryRunner.hasColumn('chat_flow', 'category') | ||
if (!columnExists) queryRunner.query(`ALTER TABLE \`chat_flow\` ADD COLUMN \`category\` TEXT;`) | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE \`chat_flow\` DROP COLUMN \`category\`;`) | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...s/server/src/database/migrations/mariadb/1700271021237-AddFileAnnotationsToChatMessage.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm' | ||
|
||
export class AddFileAnnotationsToChatMessage1700271021237 implements MigrationInterface { | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
const columnExists = await queryRunner.hasColumn('chat_message', 'fileAnnotations') | ||
if (!columnExists) queryRunner.query(`ALTER TABLE \`chat_message\` ADD COLUMN \`fileAnnotations\` TEXT;`) | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE \`chat_message\` DROP COLUMN \`fileAnnotations\`;`) | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
packages/server/src/database/migrations/mariadb/1701788586491-AddFileUploadsToChatMessage.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm' | ||
|
||
export class AddFileUploadsToChatMessage1701788586491 implements MigrationInterface { | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
const columnExists = await queryRunner.hasColumn('chat_message', 'fileUploads') | ||
if (!columnExists) queryRunner.query(`ALTER TABLE \`chat_message\` ADD COLUMN \`fileUploads\` TEXT;`) | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE \`chat_message\` DROP COLUMN \`fileUploads\`;`) | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
packages/server/src/database/migrations/mariadb/1702200925471-AddVariableEntity.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm' | ||
|
||
export class AddVariableEntity1699325775451 implements MigrationInterface { | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
`CREATE TABLE IF NOT EXISTS \`variable\` ( | ||
\`id\` varchar(36) NOT NULL, | ||
\`name\` varchar(255) NOT NULL, | ||
\`value\` text NOT NULL, | ||
\`type\` 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;` | ||
) | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`DROP TABLE variable`) | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
packages/server/src/database/migrations/mariadb/1706364937060-AddSpeechToText.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm' | ||
|
||
export class AddSpeechToText1706364937060 implements MigrationInterface { | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
const columnExists = await queryRunner.hasColumn('chat_flow', 'speechToText') | ||
if (!columnExists) queryRunner.query(`ALTER TABLE \`chat_flow\` ADD COLUMN \`speechToText\` TEXT;`) | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE \`chat_flow\` DROP COLUMN \`speechToText\`;`) | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
packages/server/src/database/migrations/mariadb/1707213626553-AddFeedback.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm' | ||
|
||
export class AddFeedback1707213626553 implements MigrationInterface { | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
`CREATE TABLE IF NOT EXISTS \`chat_message_feedback\` ( | ||
\`id\` varchar(36) NOT NULL, | ||
\`chatflowid\` varchar(255) NOT NULL, | ||
\`content\` text, | ||
\`chatId\` varchar(255) NOT NULL, | ||
\`messageId\` varchar(255) NOT NULL, | ||
\`rating\` varchar(255) NOT NULL, | ||
\`createdDate\` datetime(6) NOT NULL DEFAULT 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 chat_message_feedback`) | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
packages/server/src/database/migrations/mariadb/1709814301358-AddUpsertHistoryEntity.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm' | ||
|
||
export class AddUpsertHistoryEntity1709814301358 implements MigrationInterface { | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
`CREATE TABLE IF NOT EXISTS \`upsert_history\` ( | ||
\`id\` varchar(36) NOT NULL, | ||
\`chatflowid\` varchar(255) NOT NULL, | ||
\`result\` text NOT NULL, | ||
\`flowData\` text NOT NULL, | ||
\`date\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), | ||
PRIMARY KEY (\`id\`), | ||
KEY \`IDX_a0b59fd66f6e48d2b198123cb6\` (\`chatflowid\`) | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;` | ||
) | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`DROP TABLE upsert_history`) | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
packages/server/src/database/migrations/mariadb/1710832127079-AddLead.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm' | ||
|
||
export class AddLead1710832127079 implements MigrationInterface { | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
`CREATE TABLE IF NOT EXISTS \`lead\` ( | ||
\`id\` varchar(36) NOT NULL, | ||
\`chatflowid\` varchar(255) NOT NULL, | ||
\`chatId\` varchar(255) NOT NULL, | ||
\`name\` text, | ||
\`email\` text, | ||
\`phone\` text, | ||
\`createdDate\` datetime(6) NOT NULL DEFAULT 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 lead`) | ||
} | ||
} |
Oops, something went wrong.