diff --git a/api/api_sources/schema-files/watercraftRiskAssessment.schema.yaml b/api/api_sources/schema-files/watercraftRiskAssessment.schema.yaml index 71dbba07..61a0affa 100644 --- a/api/api_sources/schema-files/watercraftRiskAssessment.schema.yaml +++ b/api/api_sources/schema-files/watercraftRiskAssessment.schema.yaml @@ -270,6 +270,18 @@ schemas: required: false meta: {} ## -- end: inspectionTime + ## -- version: officerInspection + - name: "officerInspection" + id: "20260203" + info: "Adding new column officerInspection (officer_inspection_ind)" + columns: + officerInspection: + name: officer_inspection_ind + comment: "Indicator to show that inspection was directed by an officer after a blow by was returned to station" + definition: BOOLEAN NOT NULL DEFAULT FALSE + required: false + meta: {} + ## -- end: officerInspection ## -- version: k9InspectionResults - name: "k9InspectionResults" id: "20230330" diff --git a/api/api_sources/schema-migration-sql/WatercraftRiskAssessmentSchema/WatercraftRiskAssessmentSchema-officerInspection-20260203.down.sql b/api/api_sources/schema-migration-sql/WatercraftRiskAssessmentSchema/WatercraftRiskAssessmentSchema-officerInspection-20260203.down.sql new file mode 100644 index 00000000..631e96e6 --- /dev/null +++ b/api/api_sources/schema-migration-sql/WatercraftRiskAssessmentSchema/WatercraftRiskAssessmentSchema-officerInspection-20260203.down.sql @@ -0,0 +1,7 @@ +-- ## Reverting table: watercraft_risk_assessment +-- ## Version: officerInspection +-- ## Info: Adding new column officerInspection +-- ## Removing New Columns ## -- +ALTER TABLE watercraft_risk_assessment DROP COLUMN IF EXISTS officer_inspection_ind; + +-- ## Updating watercraft_risk_assessment ## -- diff --git a/api/api_sources/schema-migration-sql/WatercraftRiskAssessmentSchema/WatercraftRiskAssessmentSchema-officerInspection-20260203.up.sql b/api/api_sources/schema-migration-sql/WatercraftRiskAssessmentSchema/WatercraftRiskAssessmentSchema-officerInspection-20260203.up.sql new file mode 100644 index 00000000..81515e94 --- /dev/null +++ b/api/api_sources/schema-migration-sql/WatercraftRiskAssessmentSchema/WatercraftRiskAssessmentSchema-officerInspection-20260203.up.sql @@ -0,0 +1,12 @@ +-- ## Changing table: watercraft_risk_assessment +-- ## Version: officerInspection +-- ## Info: Adding new column officerInspection +-- ## Adding New Columns ## -- + +-- ## Adding Column officer_inspection_ind on table watercraft_risk_assessment +ALTER TABLE watercraft_risk_assessment ADD COLUMN officer_inspection_ind BOOLEAN NULL DEFAULT FALSE; +COMMENT ON COLUMN watercraft_risk_assessment.officer_inspection_ind IS 'Indicator to show that inspection was directed by an officer after a blow by was returned to station'; +-- ## -- + + +-- ## Updating watercraft_risk_assessment ## -- diff --git a/api/api_sources/sources/database/migrations/1770145227143-OfficerInspectionInd.ts b/api/api_sources/sources/database/migrations/1770145227143-OfficerInspectionInd.ts new file mode 100644 index 00000000..7fdd61ff --- /dev/null +++ b/api/api_sources/sources/database/migrations/1770145227143-OfficerInspectionInd.ts @@ -0,0 +1,27 @@ +import { MigrationInterface, QueryRunner } from 'typeorm'; +import { AppDBMigrator } from '../applicationSchemaInterface'; +import { WatercraftRiskAssessmentSchema } from '../database-schema'; + +export class OfficerInspectionInd1770145227143 extends AppDBMigrator implements MigrationInterface { + watercraftRiskAssessment: WatercraftRiskAssessmentSchema; + + setup() { + this.watercraftRiskAssessment = new WatercraftRiskAssessmentSchema(); + this.addSchemaVersion(this.watercraftRiskAssessment, 'officerInspection'); + } + + public async up(queryRunner: QueryRunner): Promise { + // Start Log + this.log('[START]', 'UP'); + // Running all up migration files + await this.runQuerySqlFiles(this.upMigrations(), queryRunner); + this.log('[END]', 'UP'); + } + + public async down(queryRunner: QueryRunner): Promise { + this.log('[STAR]', 'DOWN'); + await this.runQuerySqlFiles(this.downMigrations(), queryRunner); + this.log('[END]', 'DOWN'); + } + +} diff --git a/api/api_sources/sources/database/models/controllers/watercraftRiskAssessment.controller.ts b/api/api_sources/sources/database/models/controllers/watercraftRiskAssessment.controller.ts index 24269a7a..7c18c37b 100644 --- a/api/api_sources/sources/database/models/controllers/watercraftRiskAssessment.controller.ts +++ b/api/api_sources/sources/database/models/controllers/watercraftRiskAssessment.controller.ts @@ -48,6 +48,7 @@ export class WatercraftRiskAssessmentController extends RecordController