-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1838 from bcgov/feature/ALCS-2041-QA
Fix document upload date
- Loading branch information
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
...ps/alcs/src/providers/typeorm/migrations/1725902876425-fix_chase_document_upload_dates.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm'; | ||
|
||
export class FixChaseDocumentUploadDates1725902876425 | ||
implements MigrationInterface | ||
{ | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
queryRunner.query(` | ||
DO $$ | ||
BEGIN | ||
IF EXISTS (SELECT schema_name FROM information_schema.schemata WHERE schema_name = 'oats') THEN | ||
update alcs."document" d | ||
set uploaded_at = od.uploaded_date at time zone 'America/Vancouver' | ||
from alcs.inquiry_document id | ||
join oats.oats_documents od on od.document_id::text = id.oats_document_id | ||
where id.document_uuid = d."uuid" | ||
and id.oats_issue_id in ('50879', '51298', '52731'); | ||
END IF; | ||
END $$; | ||
`); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
// N/A | ||
} | ||
} |