/[BackupPC]/trunk/bin/BackupPC_updatedb
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/bin/BackupPC_updatedb

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 129 by dpavlin, Wed Sep 14 13:20:03 2005 UTC revision 130 by dpavlin, Fri Sep 23 08:54:10 2005 UTC
# Line 116  sub hest_update { Line 116  sub hest_update {
116          my $offset = 0;          my $offset = 0;
117          my $added = 0;          my $added = 0;
118    
119          print " opening index";          print " opening index $use_hest";
120          if ($index_path) {          if ($index_path) {
121                  $hest_db = HyperEstraier::Database->new();                  $hest_db = HyperEstraier::Database->new();
122                  $hest_db->open($TopDir . $index_path, $HyperEstraier::Database::DBWRITER | $HyperEstraier::Database::DBCREAT);                  $hest_db->open($TopDir . $index_path, $HyperEstraier::Database::DBWRITER | $HyperEstraier::Database::DBCREAT);
123                  print "$index_path directly";                  print " directly";
124          } elsif ($index_node_url) {          } elsif ($index_node_url) {
125                  $hest_node ||= HyperEstraier::Node->new($index_node_url);                  $hest_node ||= HyperEstraier::Node->new($index_node_url);
126                  $hest_node->set_auth('admin', 'admin');                  $hest_node->set_auth('admin', 'admin');
127                  print "$index_node_url via node URL";                  print " via node URL";
128          } else {          } else {
129                  die "don't know how to use HyperEstraier Index $use_hest";                  die "don't know how to use HyperEstraier Index $use_hest";
130          }          }
# Line 285  if ($opt{c}) { Line 285  if ($opt{c}) {
285                          localpath VARCHAR(200)                                localpath VARCHAR(200)      
286                  );                              );            
287          });          });
288    
289            $dbh->do(qq{
290                    create table dvds (
291                            ID      SERIAL          PRIMARY KEY,
292                            num     INTEGER         NOT NULL,
293                            name    VARCHAR(255)    NOT NULL,
294                            mjesto  VARCHAR(255)
295                    );
296            });
297                    
298          $dbh->do(qq{          $dbh->do(qq{
299                  create table backups (                  create table backups (
# Line 300  if ($opt{c}) { Line 309  if ($opt{c}) {
309    
310          #do_index('backups_hostid,num_unique');          #do_index('backups_hostid,num_unique');
311    
         $dbh->do(qq{  
                 create table dvds (  
                         ID      SERIAL          PRIMARY KEY,  
                         num     INTEGER         NOT NULL,  
                         name    VARCHAR(255)    NOT NULL,  
                         mjesto  VARCHAR(255)  
                 );  
         });  
312    
313          $dbh->do(qq{              $dbh->do(qq{    
314                  create table files (                  create table files (
# Line 318  if ($opt{c}) { Line 319  if ($opt{c}) {
319                          path       VARCHAR(255) NOT NULL,                          path       VARCHAR(255) NOT NULL,
320                          date       integer      NOT NULL,                          date       integer      NOT NULL,
321                          type       INTEGER      NOT NULL,                          type       INTEGER      NOT NULL,
322                          size       INTEGER      NOT NULL,                          size       INTEGER      NOT NULL
                         dvdid      INTEGER      references dvds(id)      
323                  );                  );
324          });          });
325    
326    
327            $dbh->do( qq{
328                    create table archive
329                    (
330                            id                      int not null,
331                            dvd_nr          int not null,
332                            note            text,
333                            username        varchar(20) not null,
334                            date            timestamp,
335                            primary key(id)
336                    );      
337            }
338            );
339    
340            $dbh->do( qq{
341                    create table archive_backup
342                    (
343                            archive_id      int not null,
344                            backup_id       int not null,
345                            status          text,
346                            primary key(archive_id, backup_id)
347                    );
348            });
349    
350            $dbh->do( qq{
351                    create table workflows(
352                            id                      int not null,
353                            step_id         int not null,
354                            start           timestamp,
355                            stop            timestamp,
356                            username        varchar(20),
357                            archive_id      int not null,
358                            running         boolean default true,
359                            primary key(id)
360                    );
361            });
362    
363            $dbh->do( qq{
364                    create table workflow_step
365                    (
366                            step_id         int not null,
367                            code            text,
368                            next_step       int,
369                            stop            boolean default false,
370                            primary key(step_id)
371                    );
372            });
373    
374            $dbh->do( qq{
375                            alter table workflow_step
376                                    add constraint fk_workflow_next_step
377                                    foreign key(next_step)
378                                    references workflow_step(step_id);
379            });
380    
381            $dbh->do( qq{
382                    alter table workflows
383                            add constraint fk_workflows_step_id
384                            foreign key(step_id)
385                            references workflow_step(step_id);
386            });
387            
388            $dbh->do( qq{
389                    alter table workflows
390                            add constraint fk_workflows_archive_id
391                            foreign key(archive_id)
392                            references archive(id);
393            });
394    
395            $dbh->do( qq{
396                    create table workflow_log
397                    (
398                            workflow_id             int not null,
399                            step_id                 int not null,
400                            date                    timestamp not null,
401                            status                  text,
402                            primary key(workflow_id, step_id)
403                    );
404            });
405    
406            $dbh->do( qq{
407                    alter table workflow_log
408                            add constraint fk_workflow_log_workflow_id
409                            foreign key (workflow_id)
410                            references workflows(id);
411                    });
412            
413            $dbh->do( qq{
414                    alter table workflow_log
415                            add constraint fk_workflow_log_step_id
416                            foreign key (step_id)
417                            references      workflow_step(step_id);
418                    });
419    
420          print "creating indexes:";          print "creating indexes:";
421    
422          foreach my $index (qw(          foreach my $index (qw(
# Line 455  foreach my $host_key (keys %{$hosts}) { Line 549  foreach my $host_key (keys %{$hosts}) {
549                                  $hostID,                                  $hostID,
550                                  $backupNum,                                  $backupNum,
551                                  $backup->{'endTime'},                                  $backup->{'endTime'},
552                                  $backup->{'type'},                                  substr($backup->{'type'},0,4),
553                                  $shareID,                                  $shareID,
554                                  $size,                                  $size,
555                          );                          );

Legend:
Removed from v.129  
changed lines
  Added in v.130

  ViewVC Help
Powered by ViewVC 1.1.26