ToolJet/server/migrations/1625814801420-CreateAppVersions.ts

59 lines
1.3 KiB
TypeScript
Raw Normal View History

2021-07-22 18:12:06 +00:00
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",
2021-07-23 14:51:24 +00:00
isNullable: true
2021-07-22 18:12:06 +00:00
},
{
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> {
}
}