| Lines 1-10
          
      
      
        Link Here | 
          
            
              | 1 | use C4::Installer; | 1 | $DBversion = 'XXX';  # will be replaced by the RM | 
            
              | 2 | my $dbh = C4::Context->dbh; | 2 | if( CheckVersion( $DBversion ) ) { | 
            
              | 3 | $DBversion = '16.06.00.XXX'; | 3 |     # you can use $dbh here like: | 
            
              | 4 | if (C4::Context->preference("Version") < TransformToNum($DBversion)) { | 4 |     # $dbh->do( "ALTER TABLE biblio ADD COLUMN badtaste int" ); | 
            
              | 5 |     unless( column_exists( 'biblio', 'biblionumber' ) ) { # or constraint_exists( $table_name, $key_name ) | 5 |  | 
            
              | 6 |         warn "There is something wrong"; | 6 |     # or perform some test and warn | 
            
              | 7 |     } | 7 |     # if( !column_exists( 'biblio', 'biblionumber' ) ) { | 
            
              | 8 |     SetVersion ($DBversion); | 8 |     #    warn "There is something wrong"; | 
            
              |  |  | 9 |     # } | 
            
              | 10 |  | 
            
              | 11 |     # Always end with this (adjust the bug info) | 
            
              | 12 |     SetVersion( $DBversion ); | 
        
          | 9 |     print "Upgrade to $DBversion done (Bug XXXXX - description)\n"; | 13 |     print "Upgrade to $DBversion done (Bug XXXXX - description)\n"; | 
        
          | 10 | } | 14 | } | 
            
              | 11 | -  |  |  |