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.
39 lines
900 B
39 lines
900 B
3 years ago
|
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');
|
||
|
}
|
||
|
|
||
|
}
|