3 create sequence backupsseq;
4 select setval('backupsseq', 1, false);
5 update backups set id=nextVal('backupsseq');
12 username varchar(20) not null,
17 create sequence archive_id_seq;
18 create sequence dvd_nr;
20 create table archive_backup
22 archive_id int not null,
23 backup_id int not null,
25 primary key(archive_id, backup_id)
28 create table workflows(
34 archive_id int not null,
35 running boolean default true,
39 create table workflow_step
44 stop boolean default false,
48 alter table workflow_step
49 add constraint fk_workflow_next_step
50 foreign key(next_step)
51 references workflow_step(step_id);
54 add constraint fk_workflows_step_id
56 references workflow_step(step_id);
59 add constraint fk_workflows_archive_id
60 foreign key(archive_id)
61 references archive(id);
65 create table workflow_log
67 workflow_id int not null,
69 date timestamp not null,
71 primary key(workflow_id, step_id)
74 alter table workflow_log
75 add constraint fk_workflow_log_workflow_id
76 foreign key (workflow_id)
77 references workflows(id);
79 alter table workflow_log
80 add constraint fk_workflow_log_step_id
82 references workflow_step(step_id);