You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gristlabs_grist-core/app/gen-server/migration/1673051005072-Forks.ts

43 lines
1.1 KiB

import {MigrationInterface, QueryRunner, TableColumn, TableForeignKey} from "typeorm";
export class Forks1673051005072 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.addColumns("docs", [
new TableColumn({
name: "created_by",
type: "integer",
isNullable: true,
}),
new TableColumn({
name: "trunk_id",
type: "text",
isNullable: true,
}),
new TableColumn({
name: "type",
type: "text",
isNullable: true,
}),
]);
await queryRunner.createForeignKeys("docs", [
new TableForeignKey({
columnNames: ["created_by"],
referencedTableName: "users",
referencedColumnNames: ["id"],
onDelete: "CASCADE",
}),
new TableForeignKey({
columnNames: ["trunk_id"],
referencedTableName: "docs",
referencedColumnNames: ["id"],
onDelete: "CASCADE",
}),
]);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.dropColumns("docs", ["created_by", "trunk_id", "type"]);
}
}