Bugfix/Add artifacts migration script to other database types (#3210)
add artifacts migration script to other database types
This commit is contained in:
parent
f5214e7bbc
commit
1c89a3309e
|
|
@ -0,0 +1,12 @@
|
||||||
|
import { MigrationInterface, QueryRunner } from 'typeorm'
|
||||||
|
|
||||||
|
export class AddArtifactsToChatMessage1726156258465 implements MigrationInterface {
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
const columnExists = await queryRunner.hasColumn('chat_message', 'artifacts')
|
||||||
|
if (!columnExists) queryRunner.query(`ALTER TABLE \`chat_message\` ADD COLUMN \`artifacts\` LONGTEXT;`)
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE \`chat_message\` DROP COLUMN \`artifacts\`;`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -24,6 +24,7 @@ import { AddApiKey1720230151480 } from './1720230151480-AddApiKey'
|
||||||
import { AddActionToChatMessage1721078251523 } from './1721078251523-AddActionToChatMessage'
|
import { AddActionToChatMessage1721078251523 } from './1721078251523-AddActionToChatMessage'
|
||||||
import { LongTextColumn1722301395521 } from './1722301395521-LongTextColumn'
|
import { LongTextColumn1722301395521 } from './1722301395521-LongTextColumn'
|
||||||
import { AddCustomTemplate1725629836652 } from './1725629836652-AddCustomTemplate'
|
import { AddCustomTemplate1725629836652 } from './1725629836652-AddCustomTemplate'
|
||||||
|
import { AddArtifactsToChatMessage1726156258465 } from './1726156258465-AddArtifactsToChatMessage'
|
||||||
|
|
||||||
export const mariadbMigrations = [
|
export const mariadbMigrations = [
|
||||||
Init1693840429259,
|
Init1693840429259,
|
||||||
|
|
@ -51,5 +52,6 @@ export const mariadbMigrations = [
|
||||||
AddApiKey1720230151480,
|
AddApiKey1720230151480,
|
||||||
AddActionToChatMessage1721078251523,
|
AddActionToChatMessage1721078251523,
|
||||||
LongTextColumn1722301395521,
|
LongTextColumn1722301395521,
|
||||||
AddCustomTemplate1725629836652
|
AddCustomTemplate1725629836652,
|
||||||
|
AddArtifactsToChatMessage1726156258465
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
import { MigrationInterface, QueryRunner } from 'typeorm'
|
||||||
|
|
||||||
|
export class AddArtifactsToChatMessage1726156258465 implements MigrationInterface {
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
const columnExists = await queryRunner.hasColumn('chat_message', 'artifacts')
|
||||||
|
if (!columnExists) queryRunner.query(`ALTER TABLE \`chat_message\` ADD COLUMN \`artifacts\` LONGTEXT;`)
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE \`chat_message\` DROP COLUMN \`artifacts\`;`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -25,6 +25,7 @@ import { AddApiKey1720230151480 } from './1720230151480-AddApiKey'
|
||||||
import { AddActionToChatMessage1721078251523 } from './1721078251523-AddActionToChatMessage'
|
import { AddActionToChatMessage1721078251523 } from './1721078251523-AddActionToChatMessage'
|
||||||
import { LongTextColumn1722301395521 } from './1722301395521-LongTextColumn'
|
import { LongTextColumn1722301395521 } from './1722301395521-LongTextColumn'
|
||||||
import { AddCustomTemplate1725629836652 } from './1725629836652-AddCustomTemplate'
|
import { AddCustomTemplate1725629836652 } from './1725629836652-AddCustomTemplate'
|
||||||
|
import { AddArtifactsToChatMessage1726156258465 } from './1726156258465-AddArtifactsToChatMessage'
|
||||||
|
|
||||||
export const mysqlMigrations = [
|
export const mysqlMigrations = [
|
||||||
Init1693840429259,
|
Init1693840429259,
|
||||||
|
|
@ -53,5 +54,6 @@ export const mysqlMigrations = [
|
||||||
AddApiKey1720230151480,
|
AddApiKey1720230151480,
|
||||||
AddActionToChatMessage1721078251523,
|
AddActionToChatMessage1721078251523,
|
||||||
LongTextColumn1722301395521,
|
LongTextColumn1722301395521,
|
||||||
AddCustomTemplate1725629836652
|
AddCustomTemplate1725629836652,
|
||||||
|
AddArtifactsToChatMessage1726156258465
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { MigrationInterface, QueryRunner } from 'typeorm'
|
||||||
|
|
||||||
|
export class AddArtifactsToChatMessage1726156258465 implements MigrationInterface {
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE "chat_message" ADD COLUMN IF NOT EXISTS "artifacts" TEXT;`)
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE "chat_message" DROP COLUMN "artifacts";`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -25,6 +25,7 @@ import { AddTypeToChatFlow1716300000000 } from './1716300000000-AddTypeToChatFlo
|
||||||
import { AddApiKey1720230151480 } from './1720230151480-AddApiKey'
|
import { AddApiKey1720230151480 } from './1720230151480-AddApiKey'
|
||||||
import { AddActionToChatMessage1721078251523 } from './1721078251523-AddActionToChatMessage'
|
import { AddActionToChatMessage1721078251523 } from './1721078251523-AddActionToChatMessage'
|
||||||
import { AddCustomTemplate1725629836652 } from './1725629836652-AddCustomTemplate'
|
import { AddCustomTemplate1725629836652 } from './1725629836652-AddCustomTemplate'
|
||||||
|
import { AddArtifactsToChatMessage1726156258465 } from './1726156258465-AddArtifactsToChatMessage'
|
||||||
|
|
||||||
export const postgresMigrations = [
|
export const postgresMigrations = [
|
||||||
Init1693891895163,
|
Init1693891895163,
|
||||||
|
|
@ -53,5 +54,6 @@ export const postgresMigrations = [
|
||||||
AddVectorStoreConfigToDocStore1715861032479,
|
AddVectorStoreConfigToDocStore1715861032479,
|
||||||
AddApiKey1720230151480,
|
AddApiKey1720230151480,
|
||||||
AddActionToChatMessage1721078251523,
|
AddActionToChatMessage1721078251523,
|
||||||
AddCustomTemplate1725629836652
|
AddCustomTemplate1725629836652,
|
||||||
|
AddArtifactsToChatMessage1726156258465
|
||||||
]
|
]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue