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

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Fri Feb 23 10:29:32 EST 2007


Author: sterling
Date: Fri Feb 23 10:29:31 2007
New Revision: 2825

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

Log:
tidied a couple of spots and fixed a typo

Modified: jifty/trunk/lib/Jifty/Record.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Record.pm	(original)
+++ jifty/trunk/lib/Jifty/Record.pm	Fri Feb 23 10:29:31 2007
@@ -404,7 +404,7 @@
 
 =head2 since
  
-By default, all models exist since C<undef>, the ur-time when the application was created. Please override it for your midel class.
+By default, all models exist since C<undef>, the ur-time when the application was created. Please override it for your model class.
  
 =cut
  
@@ -446,14 +446,14 @@
 }
 
 sub _make_schema { 
-        my $class = shift;
+    my $class = shift;
 
     my $schema_gen = Jifty::DBI::SchemaGenerator->new( Jifty->handle )
         or die "Can't make Jifty::DBI::SchemaGenerator";
     my $ret = $schema_gen->add_model( $class->new );
     $ret or die "couldn't add model $class: " . $ret->error_message;
 
-        return $schema_gen;
+    return $schema_gen;
 }
 
 =head2 add_column_sql column_name

Modified: jifty/trunk/lib/Jifty/Script/Schema.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Script/Schema.pm	(original)
+++ jifty/trunk/lib/Jifty/Script/Schema.pm	Fri Feb 23 10:29:31 2007
@@ -353,7 +353,7 @@
     eval {
         $UPGRADES{$_} = [ $upgradeclass->upgrade_to($_) ]
             for grep { $appv >= version->new($_) and $dbv < version->new($_) }
-            $upgradeclass->versions();
+                     $upgradeclass->versions();
     };
 
     for my $model_class ( grep {/^\Q$baseclass\E::Model::/} __PACKAGE__->models ) {
@@ -365,7 +365,7 @@
         my $model = $model_class->new;
 
         # If this whole table is new Create it
-        if (defined $model->since and  $appv >= $model->since and $model->since >$dbv ) {
+        if ($model->can( 'since' ) and defined $model->since and  $appv >= $model->since and $model->since >$dbv ) {
             unshift @{ $UPGRADES{ $model->since } }, $model->printable_table_schema();
         } else {
             # Go through the columns
@@ -377,7 +377,7 @@
                 }
 
                 # If they're new, add them
-                if (defined $col->since and $appv >= $col->since and $col->since >$dbv ) {
+                if ($model->can( 'since' ) and defined $col->since and $appv >= $col->since and $col->since >$dbv ) {
                     unshift @{ $UPGRADES{ $col->since } }, $model->add_column_sql($col->name);
                 }
             }
@@ -388,9 +388,11 @@
         $self->_print_upgrades(%UPGRADES);
 
     } else {
-       eval { $self->_execute_upgrades(%UPGRADES);
-        $log->info("Upgraded to version $appv");
-    }; die $@ if $@;
+        eval { 
+            $self->_execute_upgrades(%UPGRADES);
+            $log->info("Upgraded to version $appv");
+        }; 
+        die $@ if $@;
     }
     return 1;
 }


More information about the Jifty-commit mailing list