Skip to content

Commit

Permalink
#1470 Delete entry after metadata removal
Browse files Browse the repository at this point in the history
  • Loading branch information
ramyaragupathy authored and arunasank committed May 30, 2019
1 parent 00a6a28 commit 9af91a1
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions devops/database-scripts/proj-geom-cleanup.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ SELECT
projects.id
INTO TEMPORARY TABLE
invalid_geom
FROM
FROM
projects
WHERE
WHERE
ST_XMin(geometry) < -180
or ST_XMax(geometry) > 180
or ST_YMin(geometry) < -90
Expand All @@ -16,12 +16,12 @@ WHERE
-- Filter out projects with low mappig rates
-- Stores results in a temporary table `stale_projects`
-- Last updated in 2016 and < 10% mapped tasks
SELECT
projects.id
SELECT
projects.id
INTO TEMPORARY TABLE
stale_projects
FROM
projects
FROM
projects
WHERE
extract(year FROM last_updated) < 2017
AND tasks_mapped/total_tasks < 0.1;
Expand All @@ -45,6 +45,7 @@ BEGIN
DELETE FROM public.task_history WHERE project_id = proj;
DELETE FROM public.task_invalidation_history WHERE project_id = proj;
DELETE FROM public.tasks WHERE project_id = proj;
DELETE FROM public.projects WHERE id = proj;
RETURN NEXT proj;
-- RAISE NOTICE 'Project: %', proj;
END LOOP;
Expand Down

0 comments on commit 9af91a1

Please sign in to comment.