IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 29049


Ignore:
Timestamp:
Aug 25, 2010, 9:35:17 AM (16 years ago)
Author:
rhenders
Message:

New revision that includes burntool table

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/czartool/CzarDb.pm

    r29038 r29049  
    1 #!/usr/bin/perl i-w
     1#!/usr/bin/perl -w
    22
    33package czartool::CzarDb;
     
    66use strict;
    77
    8 my @stages = ("chip", "cam", "fake", "warp", "stack", "diff", "magic", "magicDS", "dist"); # TODO put elsewhere
     8my @stages = ("burntool", "chip", "cam", "fake", "warp", "stack", "diff", "magic", "magicDS", "dist"); # TODO put elsewhere
    99
    1010use base 'czartool::MySQLDb';
     
    613613
    614614    my $currentRevision = -1;
    615     my $latestRevision = 10;
    616 
    617     while ($currentRevision != $latestRevision) {
     615
     616    while (1) {
    618617
    619618        $currentRevision = $self->getRevision();
     
    630629        elsif ($currentRevision == 8) {$self->createRevision_9();}
    631630        elsif ($currentRevision == 9) {$self->createRevision_10();}
     631        elsif ($currentRevision == 10) {$self->createRevision_11();}
     632        else {last;}
    632633    }
    633634}
     
    954955}
    955956
     957#######################################################################################
     958#
     959# Create revision 11 of the database
     960#
     961#######################################################################################
     962sub createRevision_11 {
     963    my ($self) = @_;
     964
     965    print "* Creating revision 11 of '$self->{_dbName}'\n";
     966
     967    # same shape as other stage tables to enable easy update
     968    my $query = $self->{_db}->prepare(<<SQL);
     969    CREATE TABLE burntool (
     970            timestamp TIMESTAMP DEFAULT NOW(),
     971            label VARCHAR(128) DEFAULT "NONE",
     972            pending BIGINT NOT NULL,
     973            processed BIGINT NOT NULL,
     974            faults BIGINT NOT NULL);
     975SQL
     976
     977      $query->execute;
     978        $query = $self->{_db}->prepare(<<SQL);
     979        CREATE INDEX burntoolIndex ON burntool (timestamp, label);
     980SQL
     981
     982      $query->execute;
     983
     984    $self->setRevision(11);
     985}
     986
    956987
    957988
Note: See TracChangeset for help on using the changeset viewer.