bcgov / bcgov/entity

Consumed and Expired Names clean up

Open
#8,929 0 comments 0 reactions 0 assignees View on GitHub
ENTITY - DO NOT USE Name Request
Dominant language
JavaScript
Stars
23
Forks
62
Avg merge
24m
Merged PRs (30d)
1

Description

As a result of #8721, we need to do some cleanup on expired names

Queries to update historical data (post deployment) @thorwolpert @Sienna-Blumstengel

> -- CONSUMED
> UPDATE public.requests AS nr SET state_cd = 'CONSUMED'
> FROM public.requests AS r
> INNER JOIN public.names AS n ON r.id = n.nr_id AND n.state in ('APPROVED', 'CONDITION')
> WHERE
> nr.id = r.id AND
> r.state_cd IN ('APPROVED', 'CONDITIONAL') AND
> n.consumption_date IS NOT null;
>
> -- EXPIRED
> UPDATE public.requests AS nr SET state_cd = 'EXPIRED'
> FROM public.requests AS r
> INNER JOIN public.names AS n ON r.id = n.nr_id AND n.state in ('APPROVED', 'CONDITION')
> WHERE
> nr.id = r.id AND
> r.state_cd IN ('APPROVED', 'CONDITIONAL') AND
> n.consumption_date IS null AND r.expiration_date < CURRENT_DATE;

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.