template storing
This commit is contained in:
parent
98477eafde
commit
160d82459d
12 changed files with 386 additions and 1 deletions
30
src/migrations/1734854680201-template.ts
Normal file
30
src/migrations/1734854680201-template.ts
Normal file
|
@ -0,0 +1,30 @@
|
|||
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<void> {
|
||||
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<void> {
|
||||
await queryRunner.dropTable("template");
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue