refactor: the user setting and change to be cateogry based

This commit is contained in:
mahyargdz
2025-02-28 16:34:11 +03:30
parent 207e0e46ea
commit 5b1b574d41
21 changed files with 242 additions and 341 deletions
@@ -1,73 +0,0 @@
import { MigrationInterface, QueryRunner, TableColumn } from "typeorm";
export class AddBusinessFieldsToUserSubscription1740574122421 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.addColumns("user_subscription", [
new TableColumn({
name: "businessName",
type: "varchar",
length: "250",
isNullable: true,
default: "'Unknown Business'",
}),
new TableColumn({
name: "businessPhone",
type: "varchar",
length: "50",
isNullable: true,
default: "''",
}),
new TableColumn({
name: "description",
type: "text",
// length: "250",
isNullable: true,
default: "''",
}),
]);
await queryRunner.query(
`UPDATE "user_subscription" SET "businessName" = 'Unknown Business', "businessPhone" = '', "description" = '' WHERE "businessName" IS NULL`,
);
await queryRunner.changeColumn(
"user_subscription",
"businessName",
new TableColumn({
name: "businessName",
type: "varchar",
length: "250",
isNullable: false,
}),
);
await queryRunner.changeColumn(
"user_subscription",
"businessPhone",
new TableColumn({
name: "businessPhone",
type: "varchar",
length: "50",
isNullable: false,
}),
);
await queryRunner.changeColumn(
"user_subscription",
"description",
new TableColumn({
name: "description",
type: "text",
isNullable: false,
}),
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.dropColumns("user_subscription", [
new TableColumn({ name: "businessName", type: "varchar" }),
new TableColumn({ name: "businessPhone", type: "varchar" }),
new TableColumn({ name: "description", type: "text" }),
]);
}
}
@@ -0,0 +1,11 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class SetInvoiceNumericIdStartValue1740742921699 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "invoice" ALTER COLUMN "numericId" RESTART WITH 1000;`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "invoice" ALTER COLUMN "numericId" RESTART WITH 1;`);
}
}