r123@klaxLaptop: klax | 2005-09-15 14:10:34 +0200
authoriklaric <iklaric@8392b6e1-25fa-0310-8288-cc32f8e212ea>
Thu, 15 Sep 2005 13:54:28 +0000 (13:54 +0000)
committeriklaric <iklaric@8392b6e1-25fa-0310-8288-cc32f8e212ea>
Thu, 15 Sep 2005 13:54:28 +0000 (13:54 +0000)
 - added workflow database schema

git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/BackupPC/trunk@120 8392b6e1-25fa-0310-8288-cc32f8e212ea

sql/workflow_schema.sql [new file with mode: 0644]

diff --git a/sql/workflow_schema.sql b/sql/workflow_schema.sql
new file mode 100644 (file)
index 0000000..8ed7886
--- /dev/null
@@ -0,0 +1,73 @@
+create table archive
+(
+       id                      int not null,
+       dvd_nr          int not null,
+       note            text,
+       username        varchar(20) not null,
+       date            timestamp,
+       primary key(id)
+);
+
+create table archive_backup
+(
+       archive_id      int not null,
+       backup_id       int not null,
+       status          text,
+       primary key(archive_id, backup_id)
+);
+
+create table workflows(
+       id                      int not null,
+       step_id         int not null,
+       start           timestamp,
+       stop            timestamp,
+       username        varchar(20),
+       archive_id      int not null,
+       running         boolean default true,
+       primary key(id)
+);
+
+create table workflow_step
+(
+       step_id         int not null,
+       code            text,
+       next_step       int,
+       stop            boolean default false,
+       primary key(step_id)
+);
+
+alter table workflow_step
+       add constraint fk_workflow_next_step
+       foreign key(next_step)
+       references workflow_step(step_id);
+
+alter table workflows
+       add constraint fk_workflows_step_id
+       foreign key(step_id)
+       references workflow_step(step_id);
+       
+alter table workflows
+       add constraint fk_workflows_archive_id
+       foreign key(archive_id)
+       references archive(id); 
+
+
+
+create table workflow_log
+(
+       workflow_id             int not null,
+       step_id                 int not null,
+       date                    timestamp not null,
+       status                  text,
+       primary key(workflow_id, step_id)
+);
+
+alter table workflow_log
+       add constraint fk_workflow_log_workflow_id
+       foreign key (workflow_id)
+       references workflows(id);
+       
+alter table workflow_log
+       add constraint fk_workflow_log_step_id
+       foreign key (step_id)
+       references      workflow_step(step_id);