-
Notifications
You must be signed in to change notification settings - Fork 31
CME-943: Add new table date_case_closed #2879
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
Open
SammiChong
wants to merge
4
commits into
master
Choose a base branch
from
CME-943
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
35e1219
Add new table date_case_closed
SammiChong 2e7e24f
Merge branch 'master' into CME-943
SammiChong a24bbdd
Update DateCaseClosedRepository.java
SammiChong 8ed8b29
Merge branch 'CME-943' of github.com:hmcts/ccd-data-store-api into CM…
SammiChong File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
src/main/java/uk/gov/hmcts/ccd/data/caseclosed/DateCaseClosedEntity.java
This file contains hidden or 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,39 @@ | ||
| package uk.gov.hmcts.ccd.data.caseclosed; | ||
|
|
||
| import lombok.Data; | ||
|
|
||
| import jakarta.persistence.Column; | ||
| import jakarta.persistence.Entity; | ||
| import jakarta.persistence.GeneratedValue; | ||
| import jakarta.persistence.GenerationType; | ||
| import jakarta.persistence.Id; | ||
| import jakarta.persistence.SequenceGenerator; | ||
| import jakarta.persistence.Table; | ||
| import java.time.LocalDateTime; | ||
|
|
||
| @Entity | ||
| @Data | ||
| @Table(name = "date_case_closed") | ||
| public class DateCaseClosedEntity { | ||
|
|
||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "date_case_closed_id_seq_generator") | ||
| @SequenceGenerator( | ||
| name = "date_case_closed_id_seq_generator", | ||
| sequenceName = "date_case_closed_id_seq", | ||
| allocationSize = 1 | ||
| ) | ||
| private Long id; | ||
|
|
||
| @Column(name = "ccd_case_number", nullable = false) | ||
| private Long ccdCaseNumber; | ||
|
|
||
| @Column(name = "state") | ||
| private String state; | ||
|
|
||
| @Column(name = "state_category") | ||
| private String stateCategory; | ||
|
|
||
| @Column(name = "state_changed_date") | ||
| private LocalDateTime stateChangedDate; | ||
| } |
13 changes: 13 additions & 0 deletions
13
src/main/java/uk/gov/hmcts/ccd/data/caseclosed/DateCaseClosedRepository.java
This file contains hidden or 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,13 @@ | ||
| package uk.gov.hmcts.ccd.data.caseclosed; | ||
|
|
||
| import org.springframework.data.repository.CrudRepository; | ||
| import org.springframework.stereotype.Repository; | ||
|
|
||
| import java.time.LocalDateTime; | ||
| import java.util.List; | ||
|
|
||
| @Repository | ||
| public interface DateCaseClosedRepository extends CrudRepository<DateCaseClosedEntity, Long> { | ||
|
|
||
| List<DateCaseClosedEntity> findByStateChangedDateLessThanEqual(LocalDateTime stateChangedDate); | ||
| } |
27 changes: 27 additions & 0 deletions
27
src/main/resources/db/migration/V20250508_943__CME-943_add_date_case_closed_table.sql
This file contains hidden or 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,27 @@ | ||
| CREATE TABLE public.date_case_closed ( | ||
| id bigint NOT NULL, | ||
| ccd_case_number bigint NOT NULL, | ||
| state character varying(255), | ||
| state_category character varying(500), | ||
| state_changed_date timestamp, | ||
| PRIMARY KEY(id) | ||
| ); | ||
|
|
||
| CREATE SEQUENCE public.date_case_closed_id_seq | ||
| START WITH 1 | ||
| INCREMENT BY 1 | ||
| NO MINVALUE | ||
| NO MAXVALUE | ||
| CACHE 1; | ||
|
|
||
| ALTER SEQUENCE public.date_case_closed_id_seq OWNED BY public.date_case_closed.id; | ||
|
|
||
| ALTER TABLE ONLY public.date_case_closed | ||
| ALTER COLUMN id SET DEFAULT nextval('public.date_case_closed_id_seq'::regclass); | ||
|
|
||
| ALTER TABLE public.date_case_closed | ||
| ADD CONSTRAINT fk_date_case_closed_ccd_case_number_case_data | ||
| FOREIGN KEY (ccd_case_number) REFERENCES public.case_data(reference); | ||
|
|
||
| CREATE INDEX idx_date_case_closed_state_changed_date | ||
| ON public.date_case_closed (state_changed_date); | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.