Skip to content

Commit

Permalink
Merge pull request #1141 from bcgov/feature/ALCS-1271-2
Browse files Browse the repository at this point in the history
Increase Precision to allow for the extra decimals
  • Loading branch information
dhaselhan authored Nov 7, 2023
2 parents f413397 + 43e48e9 commit 4ff5c72
Show file tree
Hide file tree
Showing 9 changed files with 178 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class ApplicationDecisionComponentLot extends Base {
@Column({
type: 'decimal',
nullable: true,
precision: 12,
precision: 15,
scale: 5,
transformer: new ColumnNumericTransformer(),
})
Expand All @@ -48,7 +48,7 @@ export class ApplicationDecisionComponentLot extends Base {
@Column({
type: 'decimal',
nullable: true,
precision: 12,
precision: 15,
scale: 5,
transformer: new ColumnNumericTransformer(),
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class ApplicationDecisionComponent extends Base {
@Column({
type: 'decimal',
nullable: true,
precision: 12,
precision: 15,
scale: 5,
transformer: new ColumnNumericTransformer(),
comment: 'Area in hectares of ALR impacted by the decision component',
Expand Down Expand Up @@ -127,7 +127,7 @@ export class ApplicationDecisionComponent extends Base {
@Column({
type: 'decimal',
nullable: true,
precision: 12,
precision: 15,
scale: 5,
transformer: new ColumnNumericTransformer(),
})
Expand Down Expand Up @@ -171,7 +171,7 @@ export class ApplicationDecisionComponent extends Base {
@Column({
type: 'decimal',
nullable: true,
precision: 12,
precision: 15,
scale: 5,
transformer: new ColumnNumericTransformer(),
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export class NoticeOfIntent extends Base {
@Column({
type: 'decimal',
nullable: true,
precision: 12,
precision: 15,
scale: 5,
transformer: new ColumnNumericTransformer(),
comment: 'Area in hectares of ALR impacted by the proposal',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export class ApplicationParcel extends Base {
@Column({
type: 'decimal',
nullable: true,
precision: 12,
precision: 15,
scale: 5,
transformer: new ColumnNumericTransformer(),
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ export class ApplicationSubmission extends Base {
@Column({
type: 'decimal',
nullable: true,
precision: 12,
precision: 15,
scale: 5,
transformer: new ColumnNumericTransformer(),
})
Expand All @@ -234,7 +234,7 @@ export class ApplicationSubmission extends Base {
@Column({
type: 'decimal',
nullable: true,
precision: 12,
precision: 15,
scale: 5,
transformer: new ColumnNumericTransformer(),
})
Expand Down Expand Up @@ -309,7 +309,7 @@ export class ApplicationSubmission extends Base {
@Column({
type: 'decimal',
nullable: true,
precision: 12,
precision: 15,
scale: 5,
transformer: new ColumnNumericTransformer(),
})
Expand Down Expand Up @@ -375,7 +375,7 @@ export class ApplicationSubmission extends Base {
@Column({
type: 'decimal',
nullable: true,
precision: 12,
precision: 15,
scale: 5,
transformer: new ColumnNumericTransformer(),
})
Expand Down Expand Up @@ -415,7 +415,7 @@ export class ApplicationSubmission extends Base {
@Column({
type: 'decimal',
nullable: true,
precision: 12,
precision: 15,
scale: 5,
transformer: new ColumnNumericTransformer(),
})
Expand Down Expand Up @@ -455,7 +455,7 @@ export class ApplicationSubmission extends Base {
@Column({
type: 'decimal',
nullable: true,
precision: 12,
precision: 15,
scale: 5,
transformer: new ColumnNumericTransformer(),
})
Expand Down Expand Up @@ -495,7 +495,7 @@ export class ApplicationSubmission extends Base {
@Column({
type: 'decimal',
nullable: true,
precision: 12,
precision: 15,
scale: 5,
transformer: new ColumnNumericTransformer(),
})
Expand Down Expand Up @@ -578,7 +578,7 @@ export class ApplicationSubmission extends Base {
@Column({
type: 'decimal',
nullable: true,
precision: 12,
precision: 15,
scale: 5,
transformer: new ColumnNumericTransformer(),
})
Expand Down Expand Up @@ -640,7 +640,7 @@ export class ApplicationSubmission extends Base {
@Column({
type: 'decimal',
nullable: true,
precision: 12,
precision: 15,
scale: 5,
transformer: new ColumnNumericTransformer(),
})
Expand Down Expand Up @@ -690,7 +690,7 @@ export class ApplicationSubmission extends Base {
@Column({
type: 'decimal',
nullable: true,
precision: 12,
precision: 15,
scale: 5,
transformer: new ColumnNumericTransformer(),
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export class NoticeOfIntentParcel extends Base {
@Column({
type: 'decimal',
nullable: true,
precision: 12,
precision: 15,
scale: 5,
transformer: new ColumnNumericTransformer(),
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ export class NoticeOfIntentSubmission extends Base {
@Column({
type: 'decimal',
nullable: true,
precision: 12,
precision: 15,
scale: 5,
transformer: new ColumnNumericTransformer(),
})
Expand Down Expand Up @@ -261,7 +261,7 @@ export class NoticeOfIntentSubmission extends Base {
@Column({
type: 'decimal',
nullable: true,
precision: 12,
precision: 15,
scale: 5,
transformer: new ColumnNumericTransformer(),
})
Expand Down Expand Up @@ -301,7 +301,7 @@ export class NoticeOfIntentSubmission extends Base {
@Column({
type: 'decimal',
nullable: true,
precision: 12,
precision: 15,
scale: 5,
transformer: new ColumnNumericTransformer(),
})
Expand Down Expand Up @@ -341,7 +341,7 @@ export class NoticeOfIntentSubmission extends Base {
@Column({
type: 'decimal',
nullable: true,
precision: 12,
precision: 15,
scale: 5,
transformer: new ColumnNumericTransformer(),
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export class NotificationSubmission extends Base {
@Column({
type: 'decimal',
nullable: true,
precision: 12,
precision: 15,
scale: 5,
transformer: new ColumnNumericTransformer(),
})
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
import { MigrationInterface, QueryRunner } from 'typeorm';

export class IncreasePrecision1699380056668 implements MigrationInterface {
name = 'IncreasePrecision1699380056668';

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "alcs"."application_decision_component_lot" ALTER COLUMN "alr_area" TYPE numeric(15,5)`,
);
await queryRunner.query(
`ALTER TABLE "alcs"."application_decision_component_lot" ALTER COLUMN "size" TYPE numeric(15,5)`,
);
await queryRunner.query(
`ALTER TABLE "alcs"."application_decision_component" ALTER COLUMN "alr_area" TYPE numeric(15,5)`,
);
await queryRunner.query(
`ALTER TABLE "alcs"."application_decision_component" ALTER COLUMN "soil_to_place_area" TYPE numeric(15,5)`,
);
await queryRunner.query(
`ALTER TABLE "alcs"."application_decision_component" ALTER COLUMN "soil_to_remove_area" TYPE numeric(15,5)`,
);
await queryRunner.query(
`ALTER TABLE "alcs"."application" ALTER COLUMN "alr_area" TYPE numeric(15,5)`,
);
await queryRunner.query(
`ALTER TABLE "alcs"."notice_of_intent" ALTER COLUMN "alr_area" TYPE numeric(15,5)`,
);
await queryRunner.query(
`ALTER TABLE "alcs"."application_parcel" ALTER COLUMN "alr_area" TYPE numeric(15,5)`,
);
await queryRunner.query(
`ALTER TABLE "alcs"."application_submission" ALTER COLUMN "nfu_hectares" TYPE numeric(15,5)`,
);
await queryRunner.query(
`ALTER TABLE "alcs"."application_submission" ALTER COLUMN "nfu_total_fill_area" TYPE numeric(15,5)`,
);
await queryRunner.query(
`ALTER TABLE "alcs"."application_submission" ALTER COLUMN "tur_total_corridor_area" TYPE numeric(15,5)`,
);
await queryRunner.query(
`ALTER TABLE "alcs"."application_submission" ALTER COLUMN "soil_to_remove_area" TYPE numeric(15,5)`,
);
await queryRunner.query(
`ALTER TABLE "alcs"."application_submission" ALTER COLUMN "soil_already_removed_area" TYPE numeric(15,5)`,
);
await queryRunner.query(
`ALTER TABLE "alcs"."application_submission" ALTER COLUMN "soil_to_place_area" TYPE numeric(15,5)`,
);
await queryRunner.query(
`ALTER TABLE "alcs"."application_submission" ALTER COLUMN "soil_already_placed_area" TYPE numeric(15,5)`,
);
await queryRunner.query(
`ALTER TABLE "alcs"."application_submission" ALTER COLUMN "naru_floor_area" TYPE numeric(15,5)`,
);
await queryRunner.query(
`ALTER TABLE "alcs"."application_submission" ALTER COLUMN "naru_to_place_area" TYPE numeric(15,5)`,
);
await queryRunner.query(
`ALTER TABLE "alcs"."application_submission" ALTER COLUMN "incl_excl_hectares" TYPE numeric(15,5)`,
);
await queryRunner.query(
`ALTER TABLE "alcs"."notification_submission" ALTER COLUMN "total_area" TYPE numeric(15,5)`,
);
await queryRunner.query(
`ALTER TABLE "alcs"."notice_of_intent_parcel" ALTER COLUMN "alr_area" TYPE numeric(15,5)`,
);
await queryRunner.query(
`ALTER TABLE "alcs"."notice_of_intent_submission" ALTER COLUMN "soil_to_remove_area" TYPE numeric(15,5)`,
);
await queryRunner.query(
`ALTER TABLE "alcs"."notice_of_intent_submission" ALTER COLUMN "soil_already_removed_area" TYPE numeric(15,5)`,
);
await queryRunner.query(
`ALTER TABLE "alcs"."notice_of_intent_submission" ALTER COLUMN "soil_to_place_area" TYPE numeric(15,5)`,
);
await queryRunner.query(
`ALTER TABLE "alcs"."notice_of_intent_submission" ALTER COLUMN "soil_already_placed_area" TYPE numeric(15,5)`,
);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "alcs"."notice_of_intent_submission" ALTER COLUMN "soil_already_placed_area" TYPE numeric(12,5)`,
);
await queryRunner.query(
`ALTER TABLE "alcs"."notice_of_intent_submission" ALTER COLUMN "soil_to_place_area" TYPE numeric(12,5)`,
);
await queryRunner.query(
`ALTER TABLE "alcs"."notice_of_intent_submission" ALTER COLUMN "soil_already_removed_area" TYPE numeric(12,5)`,
);
await queryRunner.query(
`ALTER TABLE "alcs"."notice_of_intent_submission" ALTER COLUMN "soil_to_remove_area" TYPE numeric(12,5)`,
);
await queryRunner.query(
`ALTER TABLE "alcs"."notice_of_intent_parcel" ALTER COLUMN "alr_area" TYPE numeric(12,5)`,
);
await queryRunner.query(
`ALTER TABLE "alcs"."notification_submission" ALTER COLUMN "total_area" TYPE numeric(12,5)`,
);
await queryRunner.query(
`ALTER TABLE "alcs"."application_submission" ALTER COLUMN "incl_excl_hectares" TYPE numeric(12,5)`,
);
await queryRunner.query(
`ALTER TABLE "alcs"."application_submission" ALTER COLUMN "naru_to_place_area" TYPE numeric(12,5)`,
);
await queryRunner.query(
`ALTER TABLE "alcs"."application_submission" ALTER COLUMN "naru_floor_area" TYPE numeric(12,5)`,
);
await queryRunner.query(
`ALTER TABLE "alcs"."application_submission" ALTER COLUMN "soil_already_placed_area" TYPE numeric(12,5)`,
);
await queryRunner.query(
`ALTER TABLE "alcs"."application_submission" ALTER COLUMN "soil_to_place_area" TYPE numeric(12,5)`,
);
await queryRunner.query(
`ALTER TABLE "alcs"."application_submission" ALTER COLUMN "soil_already_removed_area" TYPE numeric(12,5)`,
);
await queryRunner.query(
`ALTER TABLE "alcs"."application_submission" ALTER COLUMN "soil_to_remove_area" TYPE numeric(12,5)`,
);
await queryRunner.query(
`ALTER TABLE "alcs"."application_submission" ALTER COLUMN "tur_total_corridor_area" TYPE numeric(12,5)`,
);
await queryRunner.query(
`ALTER TABLE "alcs"."application_submission" ALTER COLUMN "nfu_total_fill_area" TYPE numeric(12,5)`,
);
await queryRunner.query(
`ALTER TABLE "alcs"."application_submission" ALTER COLUMN "nfu_hectares" TYPE numeric(12,5)`,
);
await queryRunner.query(
`ALTER TABLE "alcs"."application_parcel" ALTER COLUMN "alr_area" TYPE numeric(12,5)`,
);
await queryRunner.query(
`ALTER TABLE "alcs"."notice_of_intent" ALTER COLUMN "alr_area" TYPE numeric(12,5)`,
);
await queryRunner.query(
`ALTER TABLE "alcs"."application" ALTER COLUMN "alr_area" TYPE numeric(12,5)`,
);
await queryRunner.query(
`ALTER TABLE "alcs"."application_decision_component" ALTER COLUMN "soil_to_remove_area" TYPE numeric(12,5)`,
);
await queryRunner.query(
`ALTER TABLE "alcs"."application_decision_component" ALTER COLUMN "soil_to_place_area" TYPE numeric(12,5)`,
);
await queryRunner.query(
`ALTER TABLE "alcs"."application_decision_component" ALTER COLUMN "alr_area" TYPE numeric(12,5)`,
);
await queryRunner.query(
`ALTER TABLE "alcs"."application_decision_component_lot" ALTER COLUMN "size" TYPE numeric(12,5)`,
);
await queryRunner.query(
`ALTER TABLE "alcs"."application_decision_component_lot" ALTER COLUMN "alr_area" TYPE numeric(12,5)`,
);
}
}

0 comments on commit 4ff5c72

Please sign in to comment.