---
title: "Contributing To AgileFlow(MySql DBinit Sql)"
author: "hongsoft"
date: "2005-03-11T14:59:00Z"
tags: []
slug: "contributing-to-agileflow-mysql-dbinit-sql"
draft: false
lastmod: "2005-03-11T14:59:00Z"
id: 287476
url: "https://hongsoft.iteye.com/blog/287476"
---

今天,AgileFlow项目的朋友[dgpck@msn.com](mailto:dgpck@msn.com)发来了AgileFlow的Mysql  
数据库的建表脚本,他建表测试成功,我代表AgileFlow项目组向  
[dgpck@msn.com](mailto:dgpck@msn.com)表示感谢,并代表个人向他对开源精神的支持表示敬意.

\*\*\*\*\*\*\*agile.sql:\*\*\*\*\*\*\*\*\*\*\*\*\*\*\**  
use agile;  
DROP TABLE  agileActivity;  
CREATE TABLE agileActivity (  
  activityInsId varchar(100) default '' NOT NULL ,  
  processInsId  varchar(100) default '' NOT NULL ,  
  status        varchar(100) default NULL,  
  acceptedUserId varchar(100) default NULL  
) ;  
create unique index agileActivity\_key on agileActivity(activityInsId);

DROP TABLE  processInstance;  
CREATE TABLE processInstance(  
  processInsId  varchar(100) default '' NOT NULL ,  
  parentProcessInsId varchar(100) default '' NULL,  
  parentActivityInsId varchar(100) default '' NULL  
) ;  
create unique index processInstance\_key on processInstance(processInsId);

DROP TABLE  driveTypeTable;  
CREATE TABLE driveTypeTable(  
  fromActivityInsId  varchar(100) default '' NOT NULL ,  
  nextActivityDefId varchar(100) default '' NOT NULL  
) ;  
create unique index driveTypeTable\_key on driveTypeTable(fromActivityInsId,nextActivityDefId);  
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\**

\*\*\*\*\*\*\*\*\*\*\*\*\*res.sql\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\**  
use agile;  
/\*删除资源对象表\*/  
drop table res\_object\_relation;  
drop table res\_role;  
drop table res\_object\_priv;  
drop table res\_privilege\_type;  
drop table res\_user;  
drop table res\_ou;  
drop table res\_object;  
drop table res\_id;  
commit;

create table res\_id (  
     tableName            varchar(100)                   not null,  
     value                int                            default 0 not null  
);  
/\*初始化ID表\*/  
insert into res\_id values('res\_object',4);  
insert into res\_id values('res\_object\_priv',3);

create table res\_object (  
     id                   int                            not null,  
     type                 int                            null,  
     tier                 int                            null  
);  
insert into res\_object values(1,1,0);  
insert into res\_object values(2,2,0);  
insert into res\_object values(3,3,0);  
create table res\_ou (     
     id                   int                            not null,  
     name                 varchar(100)                   not null,  
     description          varchar(255)                   null,  
     is\_deleted           int                            default 0 null  
);  
/\*初始化最高组织\*/  
insert into res\_ou values(1,'AgileFlow','',0);  
create table res\_user (  
     id                   int                            not null,  
     name                 varchar(100)                   not null,  
     loginName            varchar(100)                   not null,  
     phone                varchar(20)                    null,  
     email                varchar(100)                   null,  
     password             varchar(128)                   not null  
);  
insert into res\_user values(2,'系统管理员','hongsoft','','','21232f297a57a5a743894a0e4a801fc3');  
create table res\_role (  
     id                   int                            not null,  
     name                 varchar(100)                   not null,  
     description          varchar(100)                   null  
);  
insert into res\_role values(3,'system management role','系统管理角色');

create table res\_object\_relation (  
     child\_id             int                            not null,  
     parent\_id            int                            not null,  
     is\_extend            int                            default 0 not null  
);  
/\*将系统管理员加入组织AgileFlow\*/  
insert into res\_object\_relation values(2,1,1);

create table res\_privilege\_type (  
     id                   int                            not null,  
     name                 varchar(100)                   not null,  
     description          varchar(255)                   null  
);  
insert into res\_privilege\_type values(1,'系统管理','系统管理权限');  
create table res\_object\_priv (  
     id                   int                            not null,  
     object\_id            int                            not null,  
     priv\_type\_id         int                            not null  
);  
insert into res\_object\_priv values(1,2,1);  
insert into res\_object\_priv values(2,3,1);  
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\**