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

ALCS-2478 Add date to the single date conditions #2075

Merged
merged 1 commit into from
Jan 22, 2025
Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { MigrationInterface, QueryRunner } from "typeorm";

export class AddingDateToConditions1737579030699 implements MigrationInterface {

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
WITH conditions AS
(
SELECT c.uuid, c.type_code, t.date_type, COUNT(d.uuid) AS dates_count
FROM alcs.application_decision_condition c
INNER JOIN alcs.application_decision_condition_type t ON t.code = c.type_code
LEFT OUTER JOIN alcs.application_decision_condition_date d ON d.condition_uuid = c.uuid
WHERE
date_type = 'Single'
GROUP BY c.uuid, c.type_code, t.date_type
HAVING COUNT(d.uuid) = 0
)
INSERT INTO alcs.application_decision_condition_date
(
audit_created_at,
audit_updated_at,
audit_created_by,
date,
comment,
condition_uuid,
completed_date
)
SELECT
now(),
now(),
'migration_seed',
null,
null,
conditions.uuid,
null
FROM conditions;
`);
}

public async down(queryRunner: QueryRunner): Promise<void> {
// N/A
}

}
Loading