[Jifty-commit] r5517 - in jifty/trunk: lib/Jifty

Jifty commits jifty-commit at lists.jifty.org
Thu Jun 19 15:59:00 EDT 2008


Author: sterling
Date: Thu Jun 19 15:58:29 2008
New Revision: 5517

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

Log:
 r5899 at shanenka-lt-osx:  shanenka | 2008-06-19 14:56:20 -0500
 Added a synospsis to Jifty::Upgrade.


Modified: jifty/trunk/lib/Jifty/Upgrade.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Upgrade.pm	(original)
+++ jifty/trunk/lib/Jifty/Upgrade.pm	Thu Jun 19 15:58:29 2008
@@ -5,6 +5,31 @@
 
 Jifty::Upgrade - Superclass for schema/data upgrades to Jifty applicaitons
 
+=head1 SYNOPSIS
+
+  package MyApp::Upgrade;
+
+  use base qw/ Jifty::Upgrade /;
+  use Jifty::Upgrade qw/ since rename /;
+
+  since '0.7.4' => sub {
+      # Rename a column
+      rename table => 'cthulus', name => 'description', 
+                                   to => 'mind_numbingly_horrible_word_picture';
+  };
+
+  since '0.6.1' => sub {
+      my @sizes       = ('Huge', 'Gigantic', 'Monstrous', 'Really Big');
+      my @appearances = ('Horrible', 'Disgusting', 'Frightening', 'Evil');
+      
+      # populate new columns with some random stuff
+      my $cthulus = MyApp::Model::CthuluCollection->new;
+      while (my $cthulu = $cthulus->next) {
+          $cthulu->set_size($sizes[ int(rand(@sizes)) ]);
+          $cthulu->set_appearance($sizes[ int(rand(@appearances)) ]);
+      }
+  };
+
 =head1 DESCRIPTION
 
 C<Jifty::Upgrade> is an abstract baseclass to use to customize schema


More information about the Jifty-commit mailing list