[Jifty-commit] jifty branch, master, updated. jifty-1.01209-27-gd8f2b99

Jifty commits jifty-commit at lists.jifty.org
Thu Feb 10 12:48:12 EST 2011


The branch, master has been updated
       via  d8f2b993e41194b699ffd6834792f908d5a38be8 (commit)
      from  36c5abc55ddbd12bfc454deb96e4737a7064ef29 (commit)

Summary of changes:
 lib/Jifty/Script/Schema.pm |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

- Log -----------------------------------------------------------------
commit d8f2b993e41194b699ffd6834792f908d5a38be8
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Thu Feb 10 10:29:27 2011 -0500

    Revert "Remove the unused drop-column logic from jifty schema --setup, since ->columns returns only active cols"
    
    Rather than continuing to just silently drop functionality that's
    documented in many places and advertised to work, fix it by using
    ->all_columns rather than ->columns.  all_columns _did_ exist when the
    original commit was made.
    
    This reverts commit f90290e6ecae31a0591b0aaa5c4efa7c96364fed.
    
    Conflicts:
    
    	lib/Jifty/Script/Schema.pm
            - the grep grew a "not computed" check in the meantime

diff --git a/lib/Jifty/Script/Schema.pm b/lib/Jifty/Script/Schema.pm
index 6ee0791..ae1ce13 100755
--- a/lib/Jifty/Script/Schema.pm
+++ b/lib/Jifty/Script/Schema.pm
@@ -591,9 +591,19 @@ sub upgrade_tables {
             unshift @{ $UPGRADES{ $model->since } },
                 $model->table_schema_statements();
         } else {
+            # Go through the columns
+            for my $col ( grep { not $_->virtual and not $_->computed } $model->all_columns ) {
 
-            # Go through the currently-active columns
-            for my $col ( grep { not $_->virtual and not $_->computed } $model->columns ) {
+                # If they're old, drop them
+                if ( defined $col->till and $appv >= $col->till and $col->till > $dbv ) {
+                    push @{ $UPGRADES{ $col->till } }, sub {
+                        my $renamed = $upgradeclass->just_renamed || {};
+
+                        # skip it if this was dropped by a rename
+                        $model->drop_column_in_db($col->name)
+                            unless defined $renamed->{ $model->table }->{'drop'}->{ $col->name };
+                    };
+                }
 
                 # If they're new, add them
                 if (    $col->can('since')

-----------------------------------------------------------------------


More information about the Jifty-commit mailing list