[jifty-devel] Re: [Jifty-commit] r3016 - in Jifty-DBI/trunk: .
lib/Jifty/DBI
Jesse Vincent
jesse at bestpractical.com
Sun Mar 18 11:16:01 EDT 2007
The diffs in here feel...not quite right. Was this an intentional
commit or a mismerge?
On Mar 18, 2007, at 6:05 AM, jifty-commit at lists.jifty.org wrote:
> Author: sterling
> Date: Sun Mar 18 06:04:30 2007
> New Revision: 3016
>
> Modified:
> Jifty-DBI/trunk/ (props changed)
> Jifty-DBI/trunk/Makefile.PL
> Jifty-DBI/trunk/lib/Jifty/DBI/Column.pm
> Jifty-DBI/trunk/lib/Jifty/DBI/Record.pm
> Jifty-DBI/trunk/lib/Jifty/DBI/Schema.pm
> Jifty-DBI/trunk/t/testmodels.pl
>
> Log:
> r2956 at riddle: andrew | 2007-02-23 14:22:11 -0600
> * Added better handling of schema versioning
> * Added _init_methods_for_columns to explicitly handle accessor/
> mutator
> creation for all columns attached to a record
> * Applications employing JDBI can specify schema_version() in a
> sub-class of
> record to add better handling of "since" and "till" in both
> schema and code
> generation
> * Modified columns() on records to only return active columns
> * Added all_columns() to retrieve all columns on a record, even
> inactive ones
> * Added the active() method to columns to test to see if a column
> is active for
> the current schema version
> * Added/updated tests for the above
>
>
> Modified: Jifty-DBI/trunk/Makefile.PL
> ======================================================================
> ========
> --- Jifty-DBI/trunk/Makefile.PL (original)
> +++ Jifty-DBI/trunk/Makefile.PL Sun Mar 18 06:04:30 2007
> @@ -19,9 +19,7 @@
> requires('Lingua::EN::Inflect');
> requires('Object::Declare' => 0.22);
> requires('UNIVERSAL::require');
> -requires('Scalar::Defer' => 0.10);
> requires('version');
> -#requires('Class::Trigger');
> build_requires('Test::More' => 0.52);
> build_requires('DBD::SQLite');
> no_index directory => 'ex';
>
> Modified: Jifty-DBI/trunk/lib/Jifty/DBI/Column.pm
> ======================================================================
> ========
> --- Jifty-DBI/trunk/lib/Jifty/DBI/Column.pm (original)
> +++ Jifty-DBI/trunk/lib/Jifty/DBI/Column.pm Sun Mar 18 06:04:30 2007
> @@ -123,4 +123,47 @@
> return 1;
> }
>
> +=head2 active
> +
> +Returns the a true value if the column method exists for the
> current application
> +version. The current application version is determined by checking
> the L<Jifty::DBI::Record/schema_version> of the column's L</
> record_class>. This method returns a false value if the column is
> not yet been added or has been dropped.
> +
> +This method returns a false value under these circumstances:
> +
> +=over
> +
> +=item *
> +
> +Both the C<since> trait and C<schema_version> method are defined
> and C<schema_version> is less than the version set on C<since>.
> +
> +=item *
> +
> +Both the C<till> trait and C<schema_version> method are defined
> and C<schema_version> is greater than or equal to the version set
> on C<till>.
> +
> +=back
> +
> +Otherwise, this method returns true.
> +
> +=cut
> +
> +sub active {
> + my $self = shift;
> +
> + return 1 unless $self->record_class->can('schema_version');
> + return 1 unless defined $self->record_class->schema_version;
> +
> + my $version = version->new($self->record_class->schema_version);
> +
> + # The application hasn't yet started using this column
> + return 0 if defined $self->since
> + and $version < version->new($self->since);
> +
> + # The application stopped using this column
> + return 0 if defined $self->till
> + and $version >= version->new($self->till);
> +
> + # The application currently uses this column
> + return 1;
> +}
> +
> 1;
>
> Modified: Jifty-DBI/trunk/lib/Jifty/DBI/Record.pm
> ======================================================================
> ========
> --- Jifty-DBI/trunk/lib/Jifty/DBI/Record.pm (original)
> +++ Jifty-DBI/trunk/lib/Jifty/DBI/Record.pm Sun Mar 18 06:04:30 2007
> @@ -468,7 +468,7 @@
> <=> ( ( $a->type || '' ) eq 'serial' ) )
> or ( ($a->sort_order || 0) <=> ($b->sort_order || 0))
> or ( $a->name cmp $b->name )
> - } grep { $_->active } values %{ $self->_columns_hashref }
> + } grep { $_->active } values %{ $self->COLUMNS || {} }
> ])}
> }
>
> @@ -490,7 +490,7 @@
> <=> ( ( $a->type || '' ) eq 'serial' ) )
> or ( ($a->sort_order || 0) <=> ($b->sort_order || 0))
> or ( $a->name cmp $b->name )
> - } values %{ $self->_columns_hashref || {} }
> + } values %{ $self->COLUMNS || {} }
> }
>
> sub _columns_hashref {
>
> Modified: Jifty-DBI/trunk/lib/Jifty/DBI/Schema.pm
> ======================================================================
> ========
> --- Jifty-DBI/trunk/lib/Jifty/DBI/Schema.pm (original)
> +++ Jifty-DBI/trunk/lib/Jifty/DBI/Schema.pm Sun Mar 18 06:04:30 2007
> @@ -200,21 +200,6 @@
>
> my @columns = &declare($code);
>
> - # Unimport all our symbols from the calling package,
> - # except for "lazy" and "defer".
> - foreach my $sym (@EXPORT) {
> - next if $sym eq 'lazy' or $sym eq 'defer';
> -
> - no strict 'refs';
> - undef *{"$from\::$sym"}
> - if \&{"$from\::$sym"} == \&$sym;
> - }
> -
> - foreach my $column (@columns) {
> - next if !ref($column);
> - _init_column($column);
> - }
> -
> $from->_init_methods_for_columns;
> };
>
>
> Modified: Jifty-DBI/trunk/t/testmodels.pl
> ======================================================================
> ========
> _______________________________________________
> Jifty-commit mailing list
> Jifty-commit at lists.jifty.org
> http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-commit
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
Url : http://lists.bestpractical.com/pipermail/jifty-devel/attachments/20070318/dd20367b/PGP.pgp
More information about the jifty-devel
mailing list