
USE [VINCI]

create table [wf].[connectortemplate] (
[id] int primary key identity,
[name] varchar(64) not null,
[createdon] datetime not null,
[classname] varchar(512) not null,
[eventname] varchar(64) not null,
[throwsexception] bit not null default 0,
[taskid] int not null
)

create table [wf].[job] (
[id] int primary key identity,
[name] varchar(64) not null,
[createdon] datetime not null,
[jobtemplateid] int not null,
[state] int not null default 0,
[roottaskid] int,
[completedon] datetime
)

create table [wf].[jobtemplate] (
[id] int primary key identity,
[name] varchar(64) not null,
[createdon] datetime not null,
[roottaskid] int
)

create table [wf].[task] (
[id] int primary key identity,
[name] varchar(64) not null,
[createdon] datetime not null,
[jobid] int not null,
[templateid] int not null,
[acquiredby] int,
[acquiredon] datetime,
[completedon] datetime,
[state] int not null default 0
)

create table [wf].[tasktemplate] (
[id] int primary key identity,
[name] varchar(64) not null,
[createdon] datetime not null,
[jobtemplateid] int not null,
[parentid] int,
[roleid] int,
[joinmode] int not null default 0,
[splitmode] int not null default 0,
[automatic] bit not null default 0,
[subflow] bit not null default 0
)

create table [wf].[transitiontemplate] (
[id] int primary key identity,
[name] varchar(64) not null,
[createdon] datetime not null,
[sourceid] int not null,
[destid] int not null,
[condition] varchar(2048),
[default] bit not null default 0
)

create table [wf].[parameter] (
[id] int primary key identity,
[name] varchar(64) not null,
[value] varchar(2048),
)

create table [wf].[connectortemplateparameter] (
[connectortemplateid] int not null,
[parameterid] int not null
)

create table [wf].[jobtemplateparameter] (
[jobtemplateid] int not null,
[parameterid] int not null
)

create table [wf].[jobtemplaterole] (
[jobtemplateid] int not null,
[roleid] int not null
)

create table [wf].[tasktemplateparameter] (
[tasktemplateid] int not null,
[parameterid] int not null
)

create table [wf].[role] (
[id] int primary key identity,
[name] varchar(64) not null,
[createdon] datetime not null
[jobtemplateid] int not null
)

create table [wf].[user] (
[id] int primary key identity,
[name] varchar(64) not null,
[createdon] datetime not null,
[externaluserid] int
)

