Index: openacs-4/packages/bug-tracker/sql/postgresql/bug-tracker-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/sql/postgresql/bug-tracker-create.sql,v
diff -u -r1.15 -r1.16
--- openacs-4/packages/bug-tracker/sql/postgresql/bug-tracker-create.sql	30 Mar 2005 18:18:18 -0000	1.15
+++ openacs-4/packages/bug-tracker/sql/postgresql/bug-tracker-create.sql	26 Jun 2008 22:09:10 -0000	1.16
@@ -9,6 +9,10 @@
                                 on delete cascade
                                 constraint bt_projects_pk 
                                 primary key,
+  workflow_id                   integer 
+                                constraint bt_projects_workflow_id_fk
+                                references workflows(workflow_id) 
+                                on delete cascade,
   description                   text,
   -- short string will be included in the subject line of emails                                                                
   email_subject_name            text,
@@ -111,14 +115,19 @@
     p_project_id          alias for $1;
     v_folder_id           integer;
     v_root_keyword_id     integer;
+    v_workflow_id         integer;
     rec                   record;
 begin
-    -- get the content folder for this instance
-    select folder_id, root_keyword_id
-    into   v_folder_id, v_root_keyword_id
+    -- get the content folder and workflow_id for this instance
+    select folder_id, root_keyword_id, workflow_id
+    into   v_folder_id, v_root_keyword_id, v_workflow_id
     from   bt_projects
     where  project_id = p_project_id;
 
+    if v_workflow_id not null then
+      perform workflow__delete(v_workflow_id);
+    end if;
+
     -- This gets done in tcl before we are called ... for now
     --  Delete the bugs
     -- for rec in select item_id from cr_items where parent_id = v_folder_id
