feat(billing): refacto billing (#14243)

… prices for metered billing

---------

Co-authored-by: Félix Malfait <felix.malfait@gmail.com>
Co-authored-by: Félix Malfait <felix@twenty.com>
This commit is contained in:
Antoine Moreaux
2025-09-19 11:25:53 +02:00
committed by GitHub
parent 163890f6c8
commit 43e0cd5d05
351 changed files with 16091 additions and 6101 deletions
@@ -0,0 +1,19 @@
import { type MigrationInterface, type QueryRunner } from 'typeorm';
export class AddPhasesToBillingSubscription1756912860000
implements MigrationInterface
{
name = 'AddPhasesToBillingSubscription1756912860000';
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "core"."billingSubscription" ADD "phases" jsonb NOT NULL DEFAULT '[]'`,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "core"."billingSubscription" DROP COLUMN "phases"`,
);
}
}
@@ -0,0 +1,26 @@
import { type MigrationInterface, type QueryRunner } from 'typeorm';
export class RemoveTiersModeFromBillingPrice1757056320000
implements MigrationInterface
{
name = 'RemoveTiersModeFromBillingPrice1757056320000';
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "core"."billingPrice" DROP COLUMN "tiersMode"`,
);
await queryRunner.query(
`DROP TYPE IF EXISTS "core"."billingPrice_tiersmode_enum"`,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`CREATE TYPE "core"."billingPrice_tiersmode_enum" AS ENUM('GRADUATED', 'VOLUME')`,
);
await queryRunner.query(
`ALTER TABLE "core"."billingPrice" ADD "tiersMode" "core"."billingPrice_tiersmode_enum"`,
);
}
}