forked from yugabyte/yugabyte-db
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PLAT-3555]: Added an option to retain time-unit for Schedules.
Summary: Added a field to retain the scheduler's frequency and backup expiry time unit. We will be keeping Minutes as default for existing schedules and Days for backup expiry time. Also, allow users to change it while editing schedules. Test Plan: Verified manually by creating the backup and schedules using various input time unit. Added Unit test case. Reviewers: vkumar, vpatibandla Reviewed By: vpatibandla Subscribers: jenkins-bot, sanketh, yugaware Differential Revision: https://phabricator.dev.yugabyte.com/D16517
- Loading branch information
Showing
14 changed files
with
263 additions
and
11 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
41 changes: 41 additions & 0 deletions
41
managed/src/main/java/com/yugabyte/yw/models/helpers/TimeUnit.java
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,41 @@ | ||
/* | ||
* Copyright 2022 YugaByte, Inc. and Contributors | ||
* | ||
* Licensed under the Polyform Free Trial License 1.0.0 (the "License"); you | ||
* may not use this file except in compliance with the License. You | ||
* may obtain a copy of the License at | ||
* | ||
* http://github.com/YugaByte/yugabyte-db/blob/master/licenses/POLYFORM-FREE-TRIAL-LICENSE-1.0.0.txt | ||
*/ | ||
package com.yugabyte.yw.models.helpers; | ||
|
||
import io.ebean.annotation.EnumValue; | ||
|
||
public enum TimeUnit { | ||
@EnumValue("NanoSeconds") | ||
NANOSECONDS, | ||
|
||
@EnumValue("MicroSeconds") | ||
MICROSECONDS, | ||
|
||
@EnumValue("MilliSeconds") | ||
MILLISECONDS, | ||
|
||
@EnumValue("Seconds") | ||
SECONDS, | ||
|
||
@EnumValue("Minutes") | ||
MINUTES, | ||
|
||
@EnumValue("Hours") | ||
HOURS, | ||
|
||
@EnumValue("Days") | ||
DAYS, | ||
|
||
@EnumValue("Months") | ||
MONTHS, | ||
|
||
@EnumValue("Years") | ||
YEARS | ||
} |
10 changes: 10 additions & 0 deletions
10
managed/src/main/resources/db/migration/default/common/V165__Add_Time_Unit.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,10 @@ | ||
-- Copyright (c) YugaByte, Inc. | ||
|
||
ALTER TABLE backup ADD COLUMN IF NOT EXISTS expiry_time_unit varchar(50); | ||
UPDATE backup SET expiry_time_unit = 'Days' WHERE expiry IS NOT NULL; | ||
ALTER TABLE backup DROP CONSTRAINT IF EXISTS ck_expiry_time_unit; | ||
ALTER TABLE backup ADD CONSTRAINT ck_expiry_time_unit CHECK (expiry_time_unit in ('NanoSeconds','MicroSeconds','MilliSeconds','Seconds','Minutes','Hours', 'Days', 'Months', 'Years')); | ||
|
||
ALTER TABLE schedule ADD COLUMN IF NOT EXISTS frequency_time_unit varchar(50) DEFAULT 'Minutes'; | ||
ALTER TABLE schedule DROP CONSTRAINT IF EXISTS ck_frequency_time_unit; | ||
ALTER TABLE schedule ADD CONSTRAINT ck_frequency_time_unit CHECK (frequency_time_unit in ('NanoSeconds','MicroSeconds','MilliSeconds','Seconds','Minutes','Hours', 'Days', 'Months', 'Years')); |
Oops, something went wrong.