-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
temp solution to add valid data to the quarter table (otherwise the s…
…erver will not work properly)
- Loading branch information
1 parent
2583101
commit 53c557d
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
backend/src/main/resources/db/data-migration/V3_0_100__update_quarter_labels_if_needed.sql
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,31 @@ | ||
DO | ||
$$ | ||
DECLARE | ||
last_date date; | ||
BEGIN | ||
select max(start_date) from quarter INTO last_date; | ||
|
||
if (last_date < TO_DATE('2024-07-01', 'YY-MM-DD')) then | ||
raise notice 'update all quarters%', ''; | ||
|
||
UPDATE quarter SET start_date = null; | ||
UPDATE quarter SET end_date = null; | ||
UPDATE quarter q SET label = 'label-' || q.id WHERE id < 999; | ||
|
||
UPDATE quarter SET label = 'GJ 24/25-Q1', start_date = '2024-07-01', end_date = '2024-09-30' WHERE id = 1; | ||
UPDATE quarter SET label = 'GJ 23/24-Q4', start_date = '2024-04-01', end_date = '2024-06-30' WHERE id = 2; | ||
UPDATE quarter SET label = 'GJ 23/24-Q3', start_date = '2024-01-01', end_date = '2024-03-31' WHERE id = 3; | ||
UPDATE quarter SET label = 'GJ 23/24-Q2', start_date = '2023-10-01', end_date = '2023-12-31' WHERE id = 4; | ||
UPDATE quarter SET label = 'GJ 23/24-Q1', start_date = '2023-07-01', end_date = '2023-09-30' WHERE id = 5; | ||
UPDATE quarter SET label = 'GJ 22/23-Q4', start_date = '2023-04-01', end_date = '2023-06-30' WHERE id = 6; | ||
UPDATE quarter SET label = 'GJ 22/23-Q3', start_date = '2023-01-01', end_date = '2023-03-31' WHERE id = 7; | ||
UPDATE quarter SET label = 'GJ 22/23-Q2', start_date = '2022-10-01', end_date = '2022-12-31' WHERE id = 8; | ||
else | ||
raise notice 'quarters are up to date'; | ||
end if; | ||
END | ||
$$; | ||
|
||
|
||
|
||
|