[Jifty-commit] r6331 - in jifty/trunk: lib/Jifty lib/Jifty/Script

Jifty commits jifty-commit at lists.jifty.org
Tue Feb 10 19:57:18 EST 2009


Author: alexmv
Date: Tue Feb 10 19:57:18 2009
New Revision: 6331

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/lib/Jifty/Script/Schema.pm
   jifty/trunk/lib/Jifty/Test.pm

Log:
 r41983 at kohr-ah:  chmrr | 2009-02-10 19:57:01 -0500
  * Tests try a drop and recreate, so dropping a non-existent DB can't be an error


Modified: jifty/trunk/lib/Jifty/Script/Schema.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Script/Schema.pm	(original)
+++ jifty/trunk/lib/Jifty/Script/Schema.pm	Tue Feb 10 19:57:18 2009
@@ -687,11 +687,14 @@
         $handle->create_database('print') if ( $self->{'create_database'} );
     } else {
         if ( $self->{'drop_database'} ) {
-            exit 1 unless $handle->drop_database('execute');
+            my $ret = $handle->drop_database('execute');
+            die "Error dropping database: ". $ret->error_message
+                unless $ret or $ret->error_message =~ /(database .*? does not exist|unknown database)/i;
         }
 
         if ( $self->{'create_database'} ) {        
-            exit 1 unless $handle->create_database('execute'); 
+            my $ret = $handle->create_database('execute');
+            die "Error creating database: ". $ret->error_message unless $ret;
         }
 
         $handle->disconnect;
@@ -706,7 +709,8 @@
 
 sub _exec_sql {
     my $sql = shift;
-    exit 1 unless Jifty->handle->simple_query($sql);
+    my $ret = Jifty->handle->simple_query($sql);
+    die "error updating a table: " . $ret->error_message unless $ret;
 }
 
 1;

Modified: jifty/trunk/lib/Jifty/Test.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Test.pm	(original)
+++ jifty/trunk/lib/Jifty/Test.pm	Tue Feb 10 19:57:18 2009
@@ -265,9 +265,9 @@
 
     Jifty->new( no_handle => 1, pre_init => 1 );
 
-    my $schema = Jifty::Script::Schema->new; $schema->{drop_database}     = 1;
-    $schema->{create_database}   = 1;
-    $schema->{create_all_tables} = 1;
+    my $schema = Jifty::Script::Schema->new;
+    $schema->{drop_database} = 1;
+    $schema->{setup_tables}  = 1;
     $schema->run;
 
     Jifty->new();


More information about the Jifty-commit mailing list