Index: openacs-4/packages/workflow/sql/postgresql/workflow-tables-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/sql/postgresql/workflow-tables-create.sql,v
diff -u -r1.15 -r1.16
--- openacs-4/packages/workflow/sql/postgresql/workflow-tables-create.sql	13 Nov 2003 14:22:03 -0000	1.15
+++ openacs-4/packages/workflow/sql/postgresql/workflow-tables-create.sql	18 Nov 2003 17:57:56 -0000	1.16
@@ -167,7 +167,11 @@
                           constraint wf_acns_assigned_role_fk
                           references workflow_roles(role_id)
                           on delete set null,
-  always_enabled_p        bool default 'f'
+  always_enabled_p        bool default 'f',
+  -- When the action to automatically fire.
+  -- A value of 0 means immediately, null means never.
+  -- Other values mean x amount of time after having become enabled
+  timeout                 interval
 );
 
 create sequence workflow_actions_seq;
@@ -408,6 +412,39 @@
   primary key (case_id, role_id, party_id)
 );
 
+create sequence workflow_case_enbl_act_seq;
+
+create table workflow_case_enabled_actions(
+  enabled_action_id       integer
+                          constraint wf_case_enbl_act_case_id_pk
+                          primary key,
+  case_id                 integer
+                          constraint wf_case_enbl_act_case_id_nn
+                          not null
+                          constraint wf_case_enbl_act_case_id_fk
+                          references workflow_cases(case_id)
+                          on delete cascade,
+  action_id               integer
+                          constraint wf_case_enbl_act_action_id_nn
+                          not null
+                          constraint wf_case_enbl_act_action_id_fk
+                          references workflow_actions(action_id)
+                          on delete cascade,
+  enabled_date            timestamptz 
+                          default current_timestamp,
+  executed_date           timestamptz,
+  enabled_state           char(40)
+                          constraint wf_case_enbl_act_state_ck
+                          check (enabled_state in ('enabled','completed','canceled','refused')),
+  -- the timestamp when this action will fire
+  execution_time          timestamptz
+);
+
+create index wf_case_enbl_act_case_idx on workflow_case_enabled_actions(case_id);
+create index wf_case_enbl_act_action_idx on workflow_case_enabled_actions(action_id);
+create index wf_case_enbl_act_state_idx on workflow_case_enabled_actions(enabled_state);
+
+
 ---------------------------------
 -- Deputies
 ---------------------------------
