[Jifty-commit] r3601 - in jifty/branches/virtual-models: .
t/TestApp-DatabaseBackedModels/t
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Mon Jul 2 11:25:48 EDT 2007
Author: sterling
Date: Mon Jul 2 11:25:48 2007
New Revision: 3601
Modified:
jifty/branches/virtual-models/ (props changed)
jifty/branches/virtual-models/lib/Jifty/Script/Database.pm
jifty/branches/virtual-models/t/TestApp-DatabaseBackedModels/t/dump_load.t
Log:
r7926 at dynpc145: andrew | 2007-07-02 10:22:02 -0500
Fixed the remaining problems in the dump_load test and fixed/cleaned up Jifty::Database::Script.
Modified: jifty/branches/virtual-models/lib/Jifty/Script/Database.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Script/Database.pm (original)
+++ jifty/branches/virtual-models/lib/Jifty/Script/Database.pm Mon Jul 2 11:25:48 2007
@@ -216,10 +216,12 @@
my $current_columns = $table->included_columns;
my $new_columns = {};
- map {
- delete $_->{id}; # the id is only important on the first system
- $new_columns->{ $_->__uuid } = $_
- } grep { $_->{model_class} = $table->{__uuid} } values %$columns;
+ while (my ($uuid, $column) = each %$columns) {
+ next unless $column->{model_class} eq $table->name;
+ delete $column->{id}; # the id is only important on the first system
+ $column->{model_class} = $table->__uuid;
+ $new_columns->{ $uuid } = $column;
+ }
while ( my $column = $current_columns->next ) {
@@ -244,7 +246,7 @@
}
foreach my $col ( keys %$new_columns ) {
- Jifty::Model::ModelClassColumn->create($new_columns->{$col}, __uuid => $col);
+ Jifty::Model::ModelClassColumn->create(%{ $new_columns->{$col} }, __uuid => $col);
}
} else {
Modified: jifty/branches/virtual-models/t/TestApp-DatabaseBackedModels/t/dump_load.t
==============================================================================
--- jifty/branches/virtual-models/t/TestApp-DatabaseBackedModels/t/dump_load.t (original)
+++ jifty/branches/virtual-models/t/TestApp-DatabaseBackedModels/t/dump_load.t Mon Jul 2 11:25:48 2007
@@ -12,7 +12,7 @@
use lib 't/lib';
use Jifty::SubTest;
-use Jifty::Test tests => 22;
+use Jifty::Test tests => 23;
@@ -33,7 +33,7 @@
my $dumped_widgets = $dumped_bootstrap->{'TestApp::DatabaseBackedModels::Model::Widget'};
is (scalar keys %$dumped_widgets, 1);
-diag('got widgets');
+#diag('got widgets');
my @values = values %$dumped_widgets;
my $widget = shift @values;
is ($widget->{'name'}, 'Weeble', "Dumped data is as expected");
@@ -85,8 +85,8 @@
{ name => 'Vendor', description => 'People we avoid paying' }
},
'Jifty::Model::ModelClassColumn' => {
- 'cb05ac8c-afa5-11db-b33d-6f303ef246ef' =>
- { name => 'name', type => 'text', model_class => 'cb05ac8c-afa5-11db-b33d-6f303ef246eb', default_value => 'Cogswell Cogs' }
+ 'd762a97e-2909-4d9a-930d-ccbcc5708aac' =>
+ { name => 'name', storage_type => 'text', model_class => 'Customer', default_value => 'Cogswell Cogs' }
}
);
$DATABASE->_load_data(\%new_tables);
More information about the Jifty-commit
mailing list