squash: combine template and protocol migrations
This commit is contained in:
parent
6e618e7531
commit
838095594e
4 changed files with 55 additions and 74 deletions
|
@ -1,20 +0,0 @@
|
||||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
||||||
import { templateUsage } from "../entity/configuration/templateUsage";
|
|
||||||
|
|
||||||
export class MemberPrintoutTemplates1742207245862 implements MigrationInterface {
|
|
||||||
name = "MemberPrintoutTemplates1742207245862";
|
|
||||||
|
|
||||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
||||||
await queryRunner.manager
|
|
||||||
.createQueryBuilder()
|
|
||||||
.insert()
|
|
||||||
.into(templateUsage)
|
|
||||||
.values([{ scope: "member" }])
|
|
||||||
.orUpdate(["headerId", "bodyId", "footerId", "headerHeight", "footerHeight"], ["scope"])
|
|
||||||
.execute();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
||||||
await queryRunner.manager.createQueryBuilder().delete().from(templateUsage).where({ scope: "member" }).execute();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,25 +0,0 @@
|
||||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
||||||
import { templateUsage } from "../entity/configuration/templateUsage";
|
|
||||||
|
|
||||||
export class Listprinting1742311486232 implements MigrationInterface {
|
|
||||||
name = "Listprinting1742311486232";
|
|
||||||
|
|
||||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
||||||
await queryRunner.manager
|
|
||||||
.createQueryBuilder()
|
|
||||||
.delete()
|
|
||||||
.from(templateUsage)
|
|
||||||
.where({ scope: "member.list" })
|
|
||||||
.execute();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
||||||
await queryRunner.manager
|
|
||||||
.createQueryBuilder()
|
|
||||||
.insert()
|
|
||||||
.into(templateUsage)
|
|
||||||
.values([{ scope: "member.list" }])
|
|
||||||
.orUpdate(["headerId", "bodyId", "footerId", "headerHeight", "footerHeight"], ["scope"])
|
|
||||||
.execute();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,29 +0,0 @@
|
||||||
import { MigrationInterface, QueryRunner, TableColumn } from "typeorm";
|
|
||||||
import { getDefaultByORM, getTypeByORM } from "./ormHelper";
|
|
||||||
|
|
||||||
export class ProtocolSort1742544887410 implements MigrationInterface {
|
|
||||||
name = "ProtocolSort1742544887410";
|
|
||||||
|
|
||||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
||||||
await queryRunner.addColumn(
|
|
||||||
"protocol_agenda",
|
|
||||||
new TableColumn({ name: "sort", ...getTypeByORM("int"), default: getDefaultByORM("number", 0) })
|
|
||||||
);
|
|
||||||
|
|
||||||
await queryRunner.addColumn(
|
|
||||||
"protocol_decision",
|
|
||||||
new TableColumn({ name: "sort", ...getTypeByORM("int"), default: getDefaultByORM("number", 0) })
|
|
||||||
);
|
|
||||||
|
|
||||||
await queryRunner.addColumn(
|
|
||||||
"protocol_voting",
|
|
||||||
new TableColumn({ name: "sort", ...getTypeByORM("int"), default: getDefaultByORM("number", 0) })
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
||||||
await queryRunner.dropColumn("protocol_agenda", "sort");
|
|
||||||
await queryRunner.dropColumn("protocol_decision", "sort");
|
|
||||||
await queryRunner.dropColumn("protocol_voting", "sort");
|
|
||||||
}
|
|
||||||
}
|
|
55
src/migrations/1742549956787-templatesAndProtocolSort.ts
Normal file
55
src/migrations/1742549956787-templatesAndProtocolSort.ts
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
import { MigrationInterface, QueryRunner, TableColumn } from "typeorm";
|
||||||
|
import { templateUsage } from "../entity/configuration/templateUsage";
|
||||||
|
import { getTypeByORM, getDefaultByORM } from "./ormHelper";
|
||||||
|
|
||||||
|
export class TemplatesAndProtocolSort1742549956787 implements MigrationInterface {
|
||||||
|
name = "TemplatesAndProtocolSort1742549956787";
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.manager
|
||||||
|
.createQueryBuilder()
|
||||||
|
.insert()
|
||||||
|
.into(templateUsage)
|
||||||
|
.values([{ scope: "member" }])
|
||||||
|
.orUpdate(["headerId", "bodyId", "footerId", "headerHeight", "footerHeight"], ["scope"])
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
await queryRunner.manager
|
||||||
|
.createQueryBuilder()
|
||||||
|
.delete()
|
||||||
|
.from(templateUsage)
|
||||||
|
.where({ scope: "member.list" })
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
await queryRunner.addColumn(
|
||||||
|
"protocol_agenda",
|
||||||
|
new TableColumn({ name: "sort", ...getTypeByORM("int"), default: getDefaultByORM("number", 0) })
|
||||||
|
);
|
||||||
|
|
||||||
|
await queryRunner.addColumn(
|
||||||
|
"protocol_decision",
|
||||||
|
new TableColumn({ name: "sort", ...getTypeByORM("int"), default: getDefaultByORM("number", 0) })
|
||||||
|
);
|
||||||
|
|
||||||
|
await queryRunner.addColumn(
|
||||||
|
"protocol_voting",
|
||||||
|
new TableColumn({ name: "sort", ...getTypeByORM("int"), default: getDefaultByORM("number", 0) })
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.dropColumn("protocol_agenda", "sort");
|
||||||
|
await queryRunner.dropColumn("protocol_decision", "sort");
|
||||||
|
await queryRunner.dropColumn("protocol_voting", "sort");
|
||||||
|
|
||||||
|
await queryRunner.manager
|
||||||
|
.createQueryBuilder()
|
||||||
|
.insert()
|
||||||
|
.into(templateUsage)
|
||||||
|
.values([{ scope: "member.list" }])
|
||||||
|
.orUpdate(["headerId", "bodyId", "footerId", "headerHeight", "footerHeight"], ["scope"])
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
await queryRunner.manager.createQueryBuilder().delete().from(templateUsage).where({ scope: "member" }).execute();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue