mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Persist forks in home db
Summary: Adds information about forks to the home db. This will be used later by the UI to list forks of documents. Test Plan: Browser and server tests. Reviewers: paulfitz Reviewed By: paulfitz Differential Revision: https://phab.getgrist.com/D3772
This commit is contained in:
42
app/gen-server/migration/1673051005072-Forks.ts
Normal file
42
app/gen-server/migration/1673051005072-Forks.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
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"]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user