import { MigrationInterface, QueryRunner, Table } from "typeorm"; import { DB_TYPE } from "../env.defaults"; export class Template1734854680201 implements MigrationInterface { name = "Template1734854680201"; public async up(queryRunner: QueryRunner): Promise { const variableType_int = DB_TYPE == "mysql" ? "int" : "integer"; await queryRunner.createTable( new Table({ name: "template", columns: [ { name: "id", type: variableType_int, isPrimary: true, isGenerated: true, generationStrategy: "increment" }, { name: "template", type: "varchar", length: "255", isNullable: false }, { name: "description", type: "varchar", length: "255", isNullable: true }, { name: "design", type: "text", isNullable: false, default: "'{}'" }, { name: "headerHTML", type: "text", isNullable: false, default: "''" }, { name: "bodyHTML", type: "text", isNullable: false, default: "''" }, { name: "footerHTML", type: "text", isNullable: false, default: "''" }, ], }), true ); } public async down(queryRunner: QueryRunner): Promise { await queryRunner.dropTable("template"); } }