mirror of
https://github.com/ToolJet/ToolJet
synced 2026-04-21 21:47:17 +00:00
58 lines
1.3 KiB
TypeScript
58 lines
1.3 KiB
TypeScript
import { MigrationInterface, QueryRunner, Table, TableForeignKey, TableIndex } from "typeorm";
|
|
|
|
export class CreateAppVersions1625814801420 implements MigrationInterface {
|
|
|
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
await queryRunner.createTable(new Table({
|
|
name: "app_versions",
|
|
columns: [
|
|
{
|
|
name: "id",
|
|
type: "uuid",
|
|
isGenerated: true,
|
|
default: "gen_random_uuid()",
|
|
isPrimary: true
|
|
},
|
|
{
|
|
name: "name",
|
|
type: "varchar",
|
|
isNullable: true
|
|
},
|
|
{
|
|
name: "definition",
|
|
type: "json",
|
|
isNullable: true
|
|
},
|
|
{
|
|
name: "app_id",
|
|
type: "uuid",
|
|
isNullable: false
|
|
},
|
|
{
|
|
name: "created_at",
|
|
type: "timestamp",
|
|
isNullable: true,
|
|
default: "now()"
|
|
},
|
|
{
|
|
name: "updated_at",
|
|
type: "timestamp",
|
|
isNullable: true,
|
|
default: "now()"
|
|
}
|
|
]
|
|
}), true)
|
|
|
|
await queryRunner.createForeignKey("app_versions", new TableForeignKey({
|
|
columnNames: ["app_id"],
|
|
referencedColumnNames: ["id"],
|
|
referencedTableName: "apps",
|
|
onDelete: "CASCADE"
|
|
}));
|
|
|
|
}
|
|
|
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
}
|
|
|
|
}
|