mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
39 lines
900 B
TypeScript
39 lines
900 B
TypeScript
|
import {MigrationInterface, QueryRunner, Table} from "typeorm";
|
||
|
|
||
|
export class Secret1631286208009 implements MigrationInterface {
|
||
|
|
||
|
public async up(queryRunner: QueryRunner): Promise<any> {
|
||
|
await queryRunner.createTable(new Table({
|
||
|
name: "secrets",
|
||
|
columns: [
|
||
|
{
|
||
|
name: "id",
|
||
|
type: "varchar",
|
||
|
isPrimary: true
|
||
|
},
|
||
|
{
|
||
|
name: "value",
|
||
|
type: "varchar",
|
||
|
},
|
||
|
{
|
||
|
name: "doc_id",
|
||
|
type: "varchar",
|
||
|
}
|
||
|
],
|
||
|
foreignKeys: [
|
||
|
{
|
||
|
columnNames: ["doc_id"],
|
||
|
referencedColumnNames: ["id"],
|
||
|
referencedTableName: "docs",
|
||
|
onDelete: 'CASCADE' // delete secret if linked to doc that is deleted
|
||
|
}
|
||
|
]
|
||
|
}));
|
||
|
}
|
||
|
|
||
|
public async down(queryRunner: QueryRunner): Promise<any> {
|
||
|
await queryRunner.dropTable('secrets');
|
||
|
}
|
||
|
|
||
|
}
|