-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
40 additions
and
0 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
38 changes: 38 additions & 0 deletions
38
database/src/migrations/release.0.11/api_delete_project.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,38 @@ | ||
-- api_delete_project.sql | ||
drop procedure if exists api_delete_project; | ||
|
||
create or replace procedure api_delete_project(__project_id project.id%type) | ||
language plpgsql | ||
security definer | ||
as | ||
$$ | ||
-- ******************************************************************* | ||
-- Procedure: api_delete_project | ||
-- Purpose: deletes a project and dependencies | ||
-- | ||
-- MODIFICATION HISTORY | ||
-- Person Date Comments | ||
-- ---------------- ----------- -------------------------------------- | ||
-- [email protected] | ||
-- 2021-04-19 initial release | ||
-- ******************************************************************* | ||
declare | ||
|
||
begin | ||
delete from focal_species where p_id = __project_id; | ||
delete from ancillary_species where p_id = __project_id; | ||
delete from stakeholder_partnership where p_id = __project_id; | ||
delete from project_activity where p_id = __project_id; | ||
delete from project_climate_initiative where p_id = __project_id; | ||
delete from project_region where p_id = __project_id; | ||
delete from project_permit where p_id = __project_id; | ||
delete from project_management_actions where p_id = __project_id; | ||
delete from project_funding_source where p_id = __project_id; | ||
delete from project_iucn_action_classification where p_id = __project_id; | ||
delete from project_attachment where p_id = __project_id; | ||
delete from project_first_nation where p_id = __project_id; | ||
delete from project_participation where p_id = __project_id; | ||
delete from project where id = __project_id; | ||
|
||
end; | ||
$$; |