Completed
Push — master ( fa4d5c...9734a3 )
by Nicolas
37s queued 13s
created

server/migrations/1605556978071-EventBillable.ts   A

Complexity

Total Complexity 2
Complexity/F 1

Size

Lines of Code 19
Function Count 2

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 14
dl 0
loc 19
rs 10
c 0
b 0
f 0
wmc 2
mnd 0
bc 0
fnc 2
bpm 0
cpm 1
noi 0

2 Functions

Rating   Name   Duplication   Size   Complexity  
A EventBillable1605556978071.down 0 5 1
A EventBillable1605556978071.up 0 5 1
1
import {MigrationInterface, QueryRunner} from "typeorm";
2
3
export class EventBillable1605556978071 implements MigrationInterface {
4
    name = 'EventBillable1605556978071'
5
6
    public async up(queryRunner: QueryRunner): Promise<void> {
7
        await queryRunner.query(`ALTER TABLE "event" ADD "billable" boolean NOT NULL DEFAULT true`);
8
        await queryRunner.query(`COMMENT ON COLUMN "project"."dayDuration" IS 'Stored in minutes'`);
9
        await queryRunner.query(`ALTER TABLE "project" ALTER COLUMN "dayDuration" SET DEFAULT 420`);
10
    }
11
12
    public async down(queryRunner: QueryRunner): Promise<void> {
13
        await queryRunner.query(`ALTER TABLE "project" ALTER COLUMN "dayDuration" SET DEFAULT 7`);
14
        await queryRunner.query(`COMMENT ON COLUMN "project"."dayDuration" IS ''`);
15
        await queryRunner.query(`ALTER TABLE "event" DROP COLUMN "billable"`);
16
    }
17
18
}
19