[Rt-commit] r4215 - in Jifty-DBI/trunk: . lib/Jifty/DBI
jesse at bestpractical.com
jesse at bestpractical.com
Fri Dec 2 01:43:24 EST 2005
Author: jesse
Date: Fri Dec 2 01:43:24 2005
New Revision: 4215
Modified:
Jifty-DBI/trunk/ (props changed)
Jifty-DBI/trunk/Changes
Jifty-DBI/trunk/lib/Jifty/DBI/Column.pm
Jifty-DBI/trunk/lib/Jifty/DBI/Schema.pm
Jifty-DBI/trunk/lib/Jifty/DBI/SchemaGenerator.pm
Log:
r19683 at truegrounds: jesse | 2005-12-02 01:31:34 -0500
* named references
Modified: Jifty-DBI/trunk/Changes
==============================================================================
--- Jifty-DBI/trunk/Changes (original)
+++ Jifty-DBI/trunk/Changes Fri Dec 2 01:43:24 2005
@@ -1,5 +1,12 @@
Revision history for Perl extension Jifty::DBI.
+* Added support for "virtual" columns
+* Added support for named references between tables
+
+ column owner =>
+ refers_to MyApp::User by 'email';
+
+
* not_null deprecated in favor of mandatory
0.05_01 Tue Nov 8 16:29:02 EST 2005
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 Fri Dec 2 01:43:24 2005
@@ -15,6 +15,7 @@
readable writable
length
mandatory
+ virtual
distinct
refers_to by
alias_for_column
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 Fri Dec 2 01:43:24 2005
@@ -2,7 +2,7 @@
use Carp qw/carp/;
use Exporter::Lite;
our @EXPORT
- = qw(column type default validator immutable unreadable length distinct mandatory not_null valid_values label hints render_as since input_filters output_filters is by are on);
+ = qw(column type default validator immutable unreadable length distinct mandatory not_null valid_values label hints render_as since input_filters output_filters is by are on virtual);
our $SCHEMA;
@@ -17,6 +17,7 @@
name => $name,
readable => 1,
writable => 1,
+ virtual => 0,
@_,
);
my @original = @args;
@@ -29,7 +30,7 @@
if ( my $refclass = $column->refers_to ) {
$refclass->require();
- $column->type('integer');
+ $column->type('integer') unless ($column->type);
if ( UNIVERSAL::isa( $refclass, 'Jifty::DBI::Record' ) ) {
if ( $name =~ /(.*)_id$/ ) {
@@ -41,12 +42,13 @@
$column->refers_to(undef);
$virtual_column->alias_for_column($name);
}
- #$column->by('id') unless $column->by;
+ $column->by('id') unless $column->by;
}
elsif (
UNIVERSAL::isa( $refclass, 'Jifty::DBI::Collection' )
) {
$column->by('id') unless $column->by;
+ $column->virtual('1');
}
else {
warn "Error: $refclass neither Record nor Collection";
Modified: Jifty-DBI/trunk/lib/Jifty/DBI/SchemaGenerator.pm
==============================================================================
--- Jifty-DBI/trunk/lib/Jifty/DBI/SchemaGenerator.pm (original)
+++ Jifty-DBI/trunk/lib/Jifty/DBI/SchemaGenerator.pm Fri Dec 2 01:43:24 2005
@@ -193,8 +193,8 @@
# The sort here is to make it predictable, so that we can write tests.
for my $column ( sort { $a->name cmp $b->name } @columns ) {
- # Skip foreign keys
- next if defined $column->refers_to and defined $column->by;
+ # Skip "Virtual" columns - (foreign keys to collections)
+ next if $column->virtual;
next if defined $column->alias_for_column;
push @cols,
More information about the Rt-commit
mailing list