feat(analytics): add persistence for revenue modifications
This commit is contained in:
parent
0103233d4a
commit
4928685198
2 changed files with 21 additions and 1 deletions
|
@ -0,0 +1,17 @@
|
|||
import { MigrationInterface, QueryRunner } from 'typeorm'
|
||||
|
||||
export class addRevenueModifications1667912580964 implements MigrationInterface {
|
||||
name = 'addRevenueModifications1667912580964'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
'CREATE TABLE `revenue_modifications` (`uuid` varchar(36) NOT NULL, `subscription_id` int NOT NULL, `user_email` varchar(255) NOT NULL, `user_uuid` varchar(36) NOT NULL, `event_type` varchar(255) NOT NULL, `subscription_plan` varchar(255) NOT NULL, `billing_frequency` int NOT NULL, `new_customer` tinyint NOT NULL, `previous_mrr` int NOT NULL, `new_mrr` int NOT NULL, INDEX `email` (`user_email`), INDEX `user_uuid` (`user_uuid`), PRIMARY KEY (`uuid`)) ENGINE=InnoDB',
|
||||
)
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query('DROP INDEX `user_uuid` ON `revenue_modifications`')
|
||||
await queryRunner.query('DROP INDEX `email` ON `revenue_modifications`')
|
||||
await queryRunner.query('DROP TABLE `revenue_modifications`')
|
||||
}
|
||||
}
|
|
@ -2,7 +2,10 @@ import { Column, Entity, Index, PrimaryColumn } from 'typeorm'
|
|||
|
||||
@Entity({ name: 'revenue_modifications' })
|
||||
export class TypeORMRevenueModification {
|
||||
@PrimaryColumn()
|
||||
@PrimaryColumn({
|
||||
type: 'uuid',
|
||||
length: 36,
|
||||
})
|
||||
declare uuid: string
|
||||
|
||||
@Column({
|
||||
|
|
Loading…
Reference in a new issue