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

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Thu May 24 00:29:57 EDT 2007


Author: jesse
Date: Thu May 24 00:29:57 2007
New Revision: 3296

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

Log:
 r57079 at pinglin:  jesse | 2007-05-24 00:26:24 -0400
 reformatting.


Modified: jifty/trunk/lib/Jifty/Script/Schema.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Script/Schema.pm	(original)
+++ jifty/trunk/lib/Jifty/Script/Schema.pm	Thu May 24 00:29:57 2007
@@ -218,7 +218,6 @@
 
 
     for my $model ( @models) {
-
        # TODO XXX FIXME:
        #   This *will* try to generate SQL for abstract base classes you might
        #   stick in $AC::Model::.
@@ -253,9 +252,7 @@
         # Backwards combatibility -- it usd to be 'key' not 'data_key';
         eval {
             local $SIG{__WARN__} = sub { };
-            $dbv = Jifty->handle->fetch_result(
-                "SELECT value FROM _jifty_metadata WHERE key = 'jifty_db_version'"
-            );
+            $dbv = Jifty->handle->fetch_result( "SELECT value FROM _jifty_metadata WHERE key = 'jifty_db_version'");
         };
     }
 
@@ -347,10 +344,7 @@
 
                         # skip it if this was dropped by a rename
                         $model->drop_column_in_db($col->name)
-                            unless defined $renamed
-                                ->{ $model->table }
-                                ->{'drop'}
-                                ->{ $col->name };
+                            unless defined $renamed->{ $model->table }->{'drop'}->{ $col->name };
                     };
                 }
 
@@ -361,10 +355,7 @@
 
                         # skip it if this was added by a rename
                         $model->add_column_in_db($col->name)
-                            unless defined $renamed
-                                ->{ $model->table }
-                                ->{'add'}
-                                ->{ $col->name };
+                            unless defined $renamed->{ $model->table }->{'add'}->{ $col->name };
                     };
                 }
             }
@@ -440,32 +431,13 @@
     my $handle = Jifty::Schema->connect_to_db_for_management();
 
     if ( $self->{print} ) {
-
-        if ( $self->{'drop_database'} ) {
-            $handle->drop_database('print');
-        }
-        if ( $self->{'create_database'} ) {
-            $handle->create_database('print');
-        }
-        return;
+         $handle->drop_database('print') if ( $self->{'drop_database'} ) ;
+        $handle->create_database('print') if ( $self->{'create_database'} ) ;
     } else {
-
-        if ( $self->{'drop_database'} ) {
-            $handle->drop_database('execute');
-        }
-
-        if ( $self->{'create_database'} ) {
-            $handle->create_database('execute');
-        }
-
+        $handle->drop_database('execute') if ( $self->{'drop_database'} ) ;
+        $handle->create_database('execute') if ( $self->{'create_database'} ) ;
         $handle->disconnect;
-
-        # If we drop and didn't re-create, then don't reconnect
-        if ( $self->{'drop_database'} and not $self->{'create_database'} ) {
-            return;
-        }
-
-        $self->_reinit_handle();
+        $self->_reinit_handle() if ($self->{'create_database'} ) ;
     }
 }
 


More information about the Jifty-commit mailing list