Skip to content

Commit

Permalink
Change project maturity field type to text (#1428)
Browse files Browse the repository at this point in the history
Signed-off-by: Sergio Castaño Arteaga <[email protected]>
  • Loading branch information
tegioz authored Feb 8, 2024
1 parent edaf845 commit 63256d0
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion clomonitor-tracker/src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ impl DB for PgDB {
r.updated_at,
p.name as project_name,
p.accepted_at as project_accepted_at,
p.maturity::text as project_maturity,
p.maturity as project_maturity,
f.foundation_id,
f.landscape_url as foundation_landscape_url
from repository r
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ begin
p_project->>'logo_dark_url',
p_project->>'devstats_url',
(p_project->>'accepted_at')::date,
(p_project->>'maturity')::maturity,
(p_project->>'maturity'),
p_project->>'digest',
p_foundation_id
)
Expand Down
2 changes: 1 addition & 1 deletion database/migrations/functions/projects/search_projects.sql
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ begin
p.foundation_id = any(v_foundation) else true end
and
case when cardinality(v_maturity) > 0 then
p.maturity::text = any(v_maturity) else true end
p.maturity = any(v_maturity) else true end
and
case when cardinality(v_rating) > 0 then
p.rating = any(v_rating) else true end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ returns real as $$
p.foundation_id = p_foundation else true end
and
case when p_maturity is not null then
p.maturity::text = p_maturity
p.maturity = p_maturity
else true end;
$$ language sql;
11 changes: 11 additions & 0 deletions database/migrations/schema/010_drop_maturity_type.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
alter table project
alter column maturity type text using maturity::text,
add constraint maturity_not_empty_check check (maturity <> '');;
drop type if exists maturity;

---- create above / drop below ----

create type maturity as enum ('graduated', 'incubating', 'sandbox');
alter table project
drop constraint maturity_not_empty_check,
alter column maturity type maturity using maturity::maturity;

0 comments on commit 63256d0

Please sign in to comment.