36 lines
1.0 KiB
TypeScript
36 lines
1.0 KiB
TypeScript
import { MigrationInterface, QueryRunner, TableColumn } from 'typeorm';
|
|
|
|
/**
|
|
* Discount is chosen by the salon at send time, not fixed per admin
|
|
* template — so these columns live only on campaign_runs, as a snapshot of
|
|
* what was actually used for that specific send.
|
|
*/
|
|
export class AddCampaignTemplateDiscount1722400000000
|
|
implements MigrationInterface
|
|
{
|
|
name = 'AddCampaignTemplateDiscount1722400000000';
|
|
|
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
await queryRunner.addColumns('campaign_runs', [
|
|
new TableColumn({
|
|
name: 'discountPercent',
|
|
type: 'int',
|
|
isNullable: true,
|
|
}),
|
|
new TableColumn({
|
|
name: 'discountAmount',
|
|
type: 'decimal',
|
|
precision: 14,
|
|
scale: 2,
|
|
isNullable: true,
|
|
}),
|
|
]);
|
|
}
|
|
|
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
await queryRunner.dropColumn('campaign_runs', 'discountAmount');
|
|
await queryRunner.dropColumn('campaign_runs', 'discountPercent');
|
|
}
|
|
}
|
|
|