   foreign key fk_workflowtyperesource_wid (workflowid) references workflow(workflowid)
 ) ENGINE=InnoDB charset=utf8;
 
-create table workflowresource (
-  workflowresourceid int(10)  primary key auto_increment, 
+create table workflowresourcecategory (
+  workflowresourcecategoryid int(10)  primary key auto_increment, 
   workflowid int(10) ,
-  resourceid int(10) ,
-
-  constraint unique index u_workflowresource_wid_rid (workflowid, resourceid),
-
-  foreign key fk_workflowresource_rid (resourceid) references resource(resourceid),
-  foreign key fk_workflowresource_wid (workflowid) references workflow(workflowid)
-) ENGINE=InnoDB charset=utf8;
-
-create table workflowresourcemeta (
-  workflowresourcemetaid int(10)  primary key auto_increment, 
-  workflowresourceid int(10) ,
+  resourcecategoryid int(10) ,
+
+  constraint unique index u_workflowresource_wid_rcid (workflowid, resourcecategoryid),
+
+  foreign key fk_workflowresourcecategory_rcid (resourcecategoryid) references resourcecategory(resourcecategoryid),
+  foreign key fk_workflowresourcecategory_wid (workflowid) references workflow(workflowid)
+) ENGINE=InnoDB charset=utf8;
+
+create table workflowresourcecategorymeta (
+  workflowresourcecategorymetaid int(10)  primary key auto_increment, 
+  workflowresourcecategoryid int(10) ,
   k varchar(250) , 
   v text,
   position int(10)  default 0,

  constraint unique index u_jobresource_rid_jdid (resourceid, jobid)
) ENGINE=InnoDB charset=utf8;

--
-- job draft
--

  lastupdts timestamp  default current_timestamp,
  lastupduser int(10)  default 0,

  foreign key fk_wrometa_workflowresourcecategoryid (workflowresourcecategoryid) references workflowresourcecategory(workflowresourcecategoryid),

  constraint unique index u_wro_wrcid_k (workflowresourcecategoryid, k)
) ENGINE=InnoDB charset=utf8;

create table workflowsoftware (
  workflowsoftwareid int(10)  primary key auto_increment, 
  workflowid int(10) ,
  softwareid int(10) ,

  constraint unique index u_workflowsoftware_wid_sid (workflowid, softwareid),

  foreign key fk_workflowsoftware_sid (softwareid) references software(softwareid),
  foreign key fk_workflowsoftware_wid (workflowid) references workflow(workflowid)
) ENGINE=InnoDB charset=utf8;

create table workflowsoftwaremeta (
  workflowsoftwaremetaid int(10)  primary key auto_increment, 
  workflowsoftwareid int(10) ,
  k varchar(250) , 
  v text,
  position int(10)  default 0,

  lastupdts timestamp  default current_timestamp,
  lastupduser int(10)  default 0,

  foreign key fk_wrometa_workflowsoftwareid (workflowsoftwareid) references workflowsoftware(workflowsoftwareid),

  constraint unique index u_wro_wrcid_k (workflowsoftwareid, k)
) ENGINE=InnoDB charset=utf8;


