generated from broadinstitute/golang-project-template
-
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.
Browse files
Browse the repository at this point in the history
* environment sql migrations * fixes * environment sql migrations * fixes * delete after logic * didnt add idk * whered all my changes go * environment sql migrations * fixes * delete after logic * environment sql migrations * fixes * didnt add idk * whered all my changes go * remove fc ref * merge conflict * delete prevent deletion lifecycle constraint from sql and v2 * merge main * tests * fall through :/
- Loading branch information
1 parent
dd5fb7d
commit 81ad492
Showing
5 changed files
with
237 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
alter table environments | ||
drop constraint if exists name_valid; | ||
|
||
alter table environments | ||
drop constraint if exists owner_id_present; | ||
|
||
alter table environments | ||
drop constraint if exists lifecycle_valid; | ||
|
||
alter table environments | ||
drop constraint if exists default_namespace_present; | ||
|
||
alter table environments | ||
drop constraint if exists helmfile_ref_present; | ||
|
||
alter table environments | ||
drop constraint if exists unique_resource_prefix_present; | ||
|
||
alter table environments | ||
drop constraint if exists delete_after_valid; | ||
|
||
alter table environments | ||
drop constraint if exists offline_valid; | ||
|
||
alter table environments | ||
drop constraint if exists offline_schedule_begin_time_present; | ||
|
||
alter table environments | ||
drop constraint if exists offline_schedule_end_time_present; |
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,58 @@ | ||
alter table environments | ||
add constraint name_valid | ||
check (name is not null and name != '' and name similar to '[a-z0-9]([-a-z0-9]*[a-z0-9])?'); | ||
|
||
alter table environments | ||
add constraint owner_id_present | ||
check (owner_id is not null or | ||
(legacy_owner is not null and legacy_owner != '')); | ||
|
||
alter table environments | ||
add constraint lifecycle_valid | ||
check ((lifecycle = 'template' and template_environment_id is null) or | ||
(lifecycle = 'dynamic' and | ||
template_environment_id is not null and | ||
base is not null and base != '' and | ||
default_cluster_id is not null and | ||
requires_suitability is not null) or | ||
(lifecycle = 'static' and | ||
base is not null and base != '' and | ||
default_cluster_id is not null and | ||
requires_suitability is not null)); | ||
|
||
alter table environments | ||
add constraint default_namespace_present | ||
check (default_namespace is not null and default_namespace != ''); | ||
|
||
alter table environments | ||
add constraint helmfile_ref_present | ||
check (helmfile_ref is not null and helmfile_ref != ''); | ||
|
||
alter table environments | ||
add constraint unique_resource_prefix_present | ||
check (unique_resource_prefix is not null and unique_resource_prefix != ''); | ||
|
||
alter table environments | ||
add constraint delete_after_valid | ||
check (delete_after is null or | ||
(lifecycle = 'dynamic' and | ||
(prevent_deletion is null or prevent_deletion is false))); | ||
|
||
alter table environments | ||
add constraint offline_valid | ||
check (lifecycle = 'dynamic' or | ||
((offline is null or offline is false) and | ||
(offline_schedule_begin_enabled is null or offline_schedule_begin_enabled is false) and | ||
(offline_schedule_end_enabled is null or offline_schedule_end_enabled is false))); | ||
|
||
alter table environments | ||
add constraint offline_schedule_begin_time_present | ||
check (offline_schedule_begin_enabled is null or | ||
offline_schedule_begin_enabled is false or | ||
offline_schedule_begin_time is not null); | ||
|
||
alter table environments | ||
add constraint offline_schedule_end_time_present | ||
check (offline_schedule_end_enabled is null or | ||
offline_schedule_end_enabled is false or | ||
offline_schedule_end_time is not null); |
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