ToolJet/server/migrations/1691007037021-CreateLayoutTable.ts
Arpit b91029a008
[hotfix] CE fixes (#8395)
* events should be synced for multi-edit

* remove console

* removes db constrainsts for layouts and handles corrupeted apps created from prev migrations

* Revert "removes db constrainsts for layouts and handles corrupeted apps created from prev migrations"

This reverts commit 10a307118b.

* removing constrainsts fro CE

* bumped the patched version ~ 2.26.3

* fixes: import/export general styles for components

* fixes: viewer crash on adding plugin as gds due to accessing camalised data

* fixes: plugin queries gds

* preserve duplicate search params on restapi

* preserve duplicate params in query manager params fields

* fixes: edge cases where undo of some components crashes thew widget

---------

Co-authored-by: Akshay Sasidharan <akshaysasidharan93@gmail.com>
2023-12-28 15:16:50 +05:30

66 lines
1.7 KiB
TypeScript

import { MigrationInterface, QueryRunner, Table, TableForeignKey } from 'typeorm';
export class CreateLayoutTable1691007037021 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.createTable(
new Table({
name: 'layouts',
columns: [
{
name: 'id',
type: 'uuid',
isPrimary: true,
default: 'gen_random_uuid()',
},
{
name: 'type',
type: 'enum',
enumName: 'layput_type',
enum: ['desktop', 'mobile'],
isNullable: false,
},
{
name: 'top',
type: 'double precision',
isNullable: true,
},
{
name: 'left',
type: 'double precision',
isNullable: true,
},
{
name: 'width',
type: 'double precision',
isNullable: true,
},
{
name: 'height',
type: 'double precision',
isNullable: true,
},
{
name: 'component_id',
type: 'uuid',
isNullable: false,
},
],
})
);
// Add foreign key to relate Layout with Component
await queryRunner.createForeignKey(
'layouts',
new TableForeignKey({
columnNames: ['component_id'],
referencedColumnNames: ['id'],
referencedTableName: 'components',
onDelete: 'CASCADE',
})
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.dropTable('layouts');
}
}