Add migrations

This commit is contained in:
Ilango
2024-02-06 17:09:18 +05:30
parent 7d00f6fbe9
commit 336b4174dc
6 changed files with 66 additions and 3 deletions
@@ -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_0900_ai_ci;`
)
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DROP TABLE chat_message_feedback`)
}
}
@@ -11,6 +11,7 @@ import { AddUsedToolsToChatMessage1699481607341 } from './1699481607341-AddUsedT
import { AddCategoryToChatFlow1699900910291 } from './1699900910291-AddCategoryToChatFlow' import { AddCategoryToChatFlow1699900910291 } from './1699900910291-AddCategoryToChatFlow'
import { AddFileAnnotationsToChatMessage1700271021237 } from './1700271021237-AddFileAnnotationsToChatMessage' import { AddFileAnnotationsToChatMessage1700271021237 } from './1700271021237-AddFileAnnotationsToChatMessage'
import { AddVariableEntity1699325775451 } from './1702200925471-AddVariableEntity' import { AddVariableEntity1699325775451 } from './1702200925471-AddVariableEntity'
import { AddFeedback1707213626553 } from './1707213626553-AddFeedback'
export const mysqlMigrations = [ export const mysqlMigrations = [
Init1693840429259, Init1693840429259,
@@ -25,5 +26,6 @@ export const mysqlMigrations = [
AddUsedToolsToChatMessage1699481607341, AddUsedToolsToChatMessage1699481607341,
AddCategoryToChatFlow1699900910291, AddCategoryToChatFlow1699900910291,
AddFileAnnotationsToChatMessage1700271021237, AddFileAnnotationsToChatMessage1700271021237,
AddVariableEntity1699325775451 AddVariableEntity1699325775451,
AddFeedback1707213626553
] ]
@@ -0,0 +1,22 @@
import { MigrationInterface, QueryRunner } from 'typeorm'
export class AddFeedback1707213601923 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`CREATE TABLE IF NOT EXISTS chat_message_feedback (
id uuid NOT NULL DEFAULT uuid_generate_v4(),
"chatflowid" varchar NOT NULL,
"content" text,
"chatId" varchar NOT NULL,
"messageId" varchar NOT NULL,
"rating" varchar NOT NULL,
"createdDate" timestamp NOT NULL DEFAULT now(),
CONSTRAINT "PK_98419043dd704f54-9830ab78f8" PRIMARY KEY (id)
);`
)
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DROP TABLE chat_message_feedback`)
}
}
@@ -11,6 +11,7 @@ import { AddUsedToolsToChatMessage1699481607341 } from './1699481607341-AddUsedT
import { AddCategoryToChatFlow1699900910291 } from './1699900910291-AddCategoryToChatFlow' import { AddCategoryToChatFlow1699900910291 } from './1699900910291-AddCategoryToChatFlow'
import { AddFileAnnotationsToChatMessage1700271021237 } from './1700271021237-AddFileAnnotationsToChatMessage' import { AddFileAnnotationsToChatMessage1700271021237 } from './1700271021237-AddFileAnnotationsToChatMessage'
import { AddVariableEntity1699325775451 } from './1702200925471-AddVariableEntity' import { AddVariableEntity1699325775451 } from './1702200925471-AddVariableEntity'
import { AddFeedback1707213601923 } from './1707213601923-AddFeedback'
export const postgresMigrations = [ export const postgresMigrations = [
Init1693891895163, Init1693891895163,
@@ -25,5 +26,6 @@ export const postgresMigrations = [
AddUsedToolsToChatMessage1699481607341, AddUsedToolsToChatMessage1699481607341,
AddCategoryToChatFlow1699900910291, AddCategoryToChatFlow1699900910291,
AddFileAnnotationsToChatMessage1700271021237, AddFileAnnotationsToChatMessage1700271021237,
AddVariableEntity1699325775451 AddVariableEntity1699325775451,
AddFeedback1707213601923
] ]
@@ -0,0 +1,13 @@
import { MigrationInterface, QueryRunner } from 'typeorm'
export class AddFeedback1707213619308 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`CREATE TABLE IF NOT EXISTS "chat_message_feedback" ("id" varchar PRIMARY KEY NOT NULL, "chatflowid" varchar NOT NULL, "content" text, "chatId" varchar NOT NULL, "messageId" varchar NOT NULL, "rating" varchar NOT NULL, "createdDate" datetime NOT NULL DEFAULT (datetime('now')));`
)
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DROP TABLE IF EXISTS "chat_message_feedback";`)
}
}
@@ -11,6 +11,7 @@ import { AddUsedToolsToChatMessage1699481607341 } from './1699481607341-AddUsedT
import { AddCategoryToChatFlow1699900910291 } from './1699900910291-AddCategoryToChatFlow' import { AddCategoryToChatFlow1699900910291 } from './1699900910291-AddCategoryToChatFlow'
import { AddFileAnnotationsToChatMessage1700271021237 } from './1700271021237-AddFileAnnotationsToChatMessage' import { AddFileAnnotationsToChatMessage1700271021237 } from './1700271021237-AddFileAnnotationsToChatMessage'
import { AddVariableEntity1699325775451 } from './1702200925471-AddVariableEntity' import { AddVariableEntity1699325775451 } from './1702200925471-AddVariableEntity'
import { AddFeedback1707213619308 } from './1707213619308-AddFeedback'
export const sqliteMigrations = [ export const sqliteMigrations = [
Init1693835579790, Init1693835579790,
@@ -25,5 +26,6 @@ export const sqliteMigrations = [
AddUsedToolsToChatMessage1699481607341, AddUsedToolsToChatMessage1699481607341,
AddCategoryToChatFlow1699900910291, AddCategoryToChatFlow1699900910291,
AddFileAnnotationsToChatMessage1700271021237, AddFileAnnotationsToChatMessage1700271021237,
AddVariableEntity1699325775451 AddVariableEntity1699325775451,
AddFeedback1707213619308
] ]