Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LUCY-338][FEATURE] - updated db to add station_information column in observer_workflow table #1204

Merged
merged 1 commit into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions api/api_sources/schema-files/observerWorkflow.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ schemas:
comment: 'This column will store user comment on end of the day'
definition: VARCHAR(300) NULL
required: false
stationInformation:
name: 'station_information'
comment: 'This column will store additional information about the station'
definition: VARCHAR(300) NULL
required: false
# Counter
motorizedBlowBys:
name: 'motorized_blow_bys_counter'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
-- ## Changing table: observer_workflow
-- ## Version: stationInformation
-- ## Info: Adding new column station_information
-- ## Removing Columns ## --

-- ## Removing Column station_information from table observer_workflow
ALTER TABLE observer_workflow DROP COLUMN IF EXISTS station_information;
-- ## --
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- ## Changing table: observer_workflow
-- ## Version: stationInformation
-- ## Info: Adding new column station_information
-- ## Adding New Columns ## --

-- ## Adding Column station_information on table observer_workflow
ALTER TABLE observer_workflow ADD COLUMN station_information VARCHAR(300) NULL;
COMMENT ON COLUMN observer_workflow.station_information IS 'Additional information about the station';
-- ## --
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import {MigrationInterface, QueryRunner} from 'typeorm';
import { AppDBMigrator } from '../applicationSchemaInterface';
import { ObserverWorkflowSchema } from '../database-schema';

export class UpdateObserverWorkflowSchema1734739767016 extends AppDBMigrator implements MigrationInterface {
observerWorkflowSchema: ObserverWorkflowSchema;

setup() {
this.observerWorkflowSchema = new ObserverWorkflowSchema();
this.addSchemaVersion(this.observerWorkflowSchema, 'stationInformation');
}
public upMigrations(): [string, string][] {
return [
['ObserverWorkflowSchema-stationInformation-20241220.up.sql', 'ObserverWorkflowSchema']
];
}
public downMigrations(): [string, string][] {
return [
['ObserverWorkflowSchema-stationInformation-20241220.down.sql', 'ObserverWorkflowSchema']
];
}
public async up(queryRunner: QueryRunner): Promise<any> {
this.log('[START]', 'UP');
await this.runQuerySqlFiles(this.upMigrations(), queryRunner);
this.log('[END]', 'UP');
}

public async down(queryRunner: QueryRunner): Promise<any> {
this.log('[START]', 'DOWN');
await this.runQuerySqlFiles(this.downMigrations(), queryRunner);
this.log('[END]', 'DOWN');
}
}
10 changes: 9 additions & 1 deletion api/api_sources/sources/database/models/observerWorkflow.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

// ** Model: ObserverWorkflow from schema ObserverWorkflowSchema **

import { Column, Entity, PrimaryGeneratedColumn} from 'typeorm';
Expand All @@ -17,6 +16,7 @@ export interface ObserverWorkflowSpec {
startTime: string;
endTime: string;
station: string;
stationInformation: string;
location: string;
shiftStartComment: string;
shiftEndComment: string;
Expand All @@ -37,6 +37,7 @@ export interface ObserverWorkflowUpdateSpec {
startTime?: string;
endTime?: string;
station?: string;
stationInformation?: string;
location?: string;
shiftStartComment?: string;
shiftEndComment?: string;
Expand Down Expand Up @@ -118,6 +119,13 @@ export class ObserverWorkflow extends Record implements ObserverWorkflowSpec {
@ModelProperty({type: PropertyType.string})
shiftEndComment: string;

/**
* @description Getter/Setter property for column {station_information}
*/
@Column({ name: ObserverWorkflowSchema.columns.stationInformation})
@ModelProperty({type: PropertyType.string})
stationInformation: string;

/**
* @description Getter/Setter property for column {motorized_blow_bys_counter}
*/
Expand Down
Loading