ToolJet/server/data-migrations/1750927083207-AddArtifactsTable.ts
NishidhJain11 fb7c751a34
Feat/AI modularisation (#13142)
* fix deps

* Modularisation changes for Build with AI feature

* New app loading UI for Build with AI feature & added animation for chat messages

* Fix Error using AI feature

* add missing services and logic

* fix app gen

* update submodules

* EE frontend submodule updated

* update submodules

* EE frontend submodule updated post sync

* Added Artifact Preview component to ee moddules list

* Updated ai slice code

* app gen changes

* Resolved fix with AI bugs

* Resolved AI Copilot bugs

* app gen changes and query fixes

* fix query generation bugs

* update copilot

* Resolved ChatMode dropdown & popover bug fix

* Resolved PR suggestions & PreviewBox component in CE edition

* Synced frontend/ee with main

* Synced server/ee with main branch

* Enhance submodule checkout process to handle branch existence and fallback to main (#13218)

* Enhance submodule checkout process to handle branch existence and fallback to main

* Improve submodule checkout process to handle branch validation and fallback to main

* chore: Comment out Node.js setup, dependency installation, and build steps in cloud frontend workflow

* refactor: Enhance submodule checkout process to include submodule name in logs

* Update submodule checkout process to use the correct submodule name extraction method

* fix: Update submodule checkout script to use correct submodule path variable

* Improve submodule checkout process to correctly handle branch names and fallback to main

* chore: Uncomment Node.js setup, dependency installation, and build steps in cloud frontend workflow

* fix: Update branch checkout logic to use correct syntax and improve fallback handling

* fix: Update git checkout command to use -B flag for branch creation

* fix: Improve submodule checkout process to explicitly fetch branch ref before checkout

* fix: Enhance submodule checkout process with improved branch validation and error handling

* fix: Improve branch checkout logic by enhancing fetch command and validating branch existence

* fix: Enhance manual Git checkout process with improved fetch and error handling

* fix: Restore Node.js setup, dependency installation, and Netlify deployment steps in workflow

* 🔄 chore: update submodules to latest main after auto-merge

* Took sync of fix/appbuilder-02 in frontend/ee

---------

Co-authored-by: Kartik Gupta <gupta.kartik18kg@gmail.com>
Co-authored-by: Adish M <44204658+adishM98@users.noreply.github.com>
Co-authored-by: adishM98 Bot <adish.madhu@gmail.com>
2025-07-07 15:11:58 +05:30

81 lines
2.7 KiB
TypeScript

import { MigrationInterface, QueryRunner, Table, TableForeignKey } from "typeorm";
export class AddArtifactsTable1750927083207 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.createTable(
new Table({
name: 'artifacts',
columns: [
{
name: 'id',
type: 'uuid',
isPrimary: true,
isGenerated: true,
generationStrategy: 'uuid',
},
{
name: 'conversation_id',
type: 'uuid',
isNullable: false,
},
{
name: 'message_id',
type: 'uuid',
isNullable: false,
},
{
name: 'content',
type: 'jsonb',
isNullable: false,
},
{
name: 'identifier',
type: 'varchar',
isNullable: false,
},
{
name: 'created_at',
type: 'timestamp',
default: 'now()',
},
{
name: 'updated_at',
type: 'timestamp',
default: 'now()',
},
],
}),
true,
);
await queryRunner.createForeignKey(
'artifacts',
new TableForeignKey({
columnNames: ['conversation_id'],
referencedColumnNames: ['id'],
referencedTableName: 'ai_conversations',
onDelete: 'CASCADE',
}),
);
await queryRunner.createForeignKey(
'artifacts',
new TableForeignKey({
columnNames: ['message_id'],
referencedColumnNames: ['id'],
referencedTableName: 'ai_conversation_messages',
onDelete: 'CASCADE',
}),
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
const table = await queryRunner.getTable('artifacts');
if (table) {
const foreignKeys = table.foreignKeys;
await Promise.all(foreignKeys.map(foreignKey => queryRunner.dropForeignKey('artifacts', foreignKey)));
}
await queryRunner.dropTable('artifacts');
}
}