Created
March 25, 2021 15:26
-
-
Save pkarman/b6a55159d15f5ce1b79071499f8ba04b to your computer and use it in GitHub Desktop.
SQL generated by https://github.com/department-of-veterans-affairs/caseflow/blob/master/app/queries/appeals_updated_since_query.rb
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
SELECT "appeals".* | |
FROM "appeals" | |
WHERE "appeals"."established_at" IS NOT NULL | |
AND ( ( appeals.updated_at >= '2021/01/01' ) | |
OR ( appeals.id IN (SELECT "request_issues"."decision_review_id" | |
FROM "request_issues" | |
WHERE ( request_issues.updated_at >= | |
'2021/01/01' ) | |
AND | |
( request_issues.decision_review_type = 'Appeal' ) | |
UNION | |
SELECT "claimants"."decision_review_id" | |
FROM "claimants" | |
WHERE ( claimants.updated_at >= '2021/01/01' ) | |
AND ( | |
claimants.decision_review_type = 'Appeal' ) | |
UNION | |
SELECT "decision_issues"."decision_review_id" | |
FROM "decision_issues" | |
WHERE "decision_issues"."deleted_at" IS NULL | |
AND ( decision_issues.updated_at >= | |
'2021/01/01' ) | |
AND ( | |
decision_issues.decision_review_type = 'Appeal' ) | |
UNION | |
SELECT "tasks"."appeal_id" | |
FROM "tasks" | |
WHERE ( tasks.updated_at >= '2021/01/01' ) | |
AND ( tasks.appeal_type = 'Appeal' ) | |
UNION | |
SELECT "intakes"."detail_id" | |
FROM "intakes" | |
WHERE ( intakes.updated_at >= '2021/01/01' ) | |
AND ( detail_type = 'Appeal' ) | |
UNION | |
SELECT "hearings"."appeal_id" | |
FROM "hearings" | |
WHERE ( hearings.updated_at >= '2021/01/01' ) | |
UNION | |
SELECT "available_hearing_locations"."appeal_id" | |
FROM "available_hearing_locations" | |
WHERE ( available_hearing_locations.updated_at >= | |
'2021/01/01' | |
) | |
AND | |
( available_hearing_locations.appeal_type = 'Appeal' ) | |
UNION | |
SELECT "decision_documents"."appeal_id" | |
FROM "decision_documents" | |
WHERE ( decision_documents.updated_at >= '2021/01/01' ) | |
AND ( decision_documents.appeal_type = 'Appeal' ) | |
UNION | |
SELECT "vbms_uploaded_documents"."appeal_id" | |
FROM "vbms_uploaded_documents" | |
WHERE ( vbms_uploaded_documents.updated_at >= | |
'2021/01/01' | |
) | |
UNION | |
SELECT | |
"supplemental_claims"."decision_review_remanded_id" | |
FROM "supplemental_claims" | |
WHERE ( supplemental_claims.updated_at >= '2021/01/01' ) | |
AND ( | |
supplemental_claims.decision_review_remanded_type = 'Appeal' ) | |
UNION | |
SELECT "special_issue_lists"."appeal_id" | |
FROM "special_issue_lists" | |
WHERE ( special_issue_lists.updated_at >= '2021/01/01' ) | |
AND ( special_issue_lists.appeal_type = 'Appeal' ) | |
UNION | |
SELECT "post_decision_motions"."appeal_id" | |
FROM "post_decision_motions" | |
WHERE ( post_decision_motions.updated_at >= '2021/01/01' )) ) ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment