my $offset = 0;
my $added = 0;
- print " opening index";
+ print " opening index $use_hest";
if ($index_path) {
$hest_db = HyperEstraier::Database->new();
$hest_db->open($TopDir . $index_path, $HyperEstraier::Database::DBWRITER | $HyperEstraier::Database::DBCREAT);
- print "$index_path directly";
+ print " directly";
} elsif ($index_node_url) {
$hest_node ||= HyperEstraier::Node->new($index_node_url);
$hest_node->set_auth('admin', 'admin');
- print "$index_node_url via node URL";
+ print " via node URL";
} else {
die "don't know how to use HyperEstraier Index $use_hest";
}
localpath VARCHAR(200)
);
});
+
+ $dbh->do(qq{
+ create table dvds (
+ ID SERIAL PRIMARY KEY,
+ num INTEGER NOT NULL,
+ name VARCHAR(255) NOT NULL,
+ mjesto VARCHAR(255)
+ );
+ });
$dbh->do(qq{
create table backups (
#do_index('backups_hostid,num_unique');
- $dbh->do(qq{
- create table dvds (
- ID SERIAL PRIMARY KEY,
- num INTEGER NOT NULL,
- name VARCHAR(255) NOT NULL,
- mjesto VARCHAR(255)
- );
- });
$dbh->do(qq{
create table files (
path VARCHAR(255) NOT NULL,
date integer NOT NULL,
type INTEGER NOT NULL,
- size INTEGER NOT NULL,
- dvdid INTEGER references dvds(id)
+ size INTEGER NOT NULL
);
});
+
+ $dbh->do( qq{
+ create table archive
+ (
+ id int not null,
+ dvd_nr int not null,
+ note text,
+ username varchar(20) not null,
+ date timestamp,
+ primary key(id)
+ );
+ }
+ );
+
+ $dbh->do( qq{
+ create table archive_backup
+ (
+ archive_id int not null,
+ backup_id int not null,
+ status text,
+ primary key(archive_id, backup_id)
+ );
+ });
+
+ $dbh->do( qq{
+ 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)
+ );
+ });
+
+ $dbh->do( qq{
+ create table workflow_step
+ (
+ step_id int not null,
+ code text,
+ next_step int,
+ stop boolean default false,
+ primary key(step_id)
+ );
+ });
+
+ $dbh->do( qq{
+ alter table workflow_step
+ add constraint fk_workflow_next_step
+ foreign key(next_step)
+ references workflow_step(step_id);
+ });
+
+ $dbh->do( qq{
+ alter table workflows
+ add constraint fk_workflows_step_id
+ foreign key(step_id)
+ references workflow_step(step_id);
+ });
+
+ $dbh->do( qq{
+ alter table workflows
+ add constraint fk_workflows_archive_id
+ foreign key(archive_id)
+ references archive(id);
+ });
+
+ $dbh->do( qq{
+ 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)
+ );
+ });
+
+ $dbh->do( qq{
+ alter table workflow_log
+ add constraint fk_workflow_log_workflow_id
+ foreign key (workflow_id)
+ references workflows(id);
+ });
+
+ $dbh->do( qq{
+ alter table workflow_log
+ add constraint fk_workflow_log_step_id
+ foreign key (step_id)
+ references workflow_step(step_id);
+ });
+
print "creating indexes:";
foreach my $index (qw(
$hostID,
$backupNum,
$backup->{'endTime'},
- $backup->{'type'},
+ substr($backup->{'type'},0,4),
$shareID,
$size,
);