[Jifty-commit] jifty-dbi branch, master, updated. 0.74-7-g3922e87

Jifty commits jifty-commit at lists.jifty.org
Tue Jan 29 15:11:10 EST 2013


The branch, master has been updated
       via  3922e874acd5516d55ffe85dca9c23b5f5a23751 (commit)
      from  1f52a9de918bdabfe65668e0238c04c2f5587315 (commit)

Summary of changes:
 lib/Jifty/DBI/SchemaGenerator.pm | 4 +++-
 t/10schema.t                     | 4 ++--
 2 files changed, 5 insertions(+), 3 deletions(-)

- Log -----------------------------------------------------------------
commit 3922e874acd5516d55ffe85dca9c23b5f5a23751
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Tue Jan 29 12:08:25 2013 -0800

    Consistent order of tables in generated SQL schema
    
    Resolves [rt.cpan.org #82978] by working around [rt.cpan.org #83085] in
    DBIx::DBSchema.
    
    Instead of using DBIx::DBSchema->sql, we build the schema for each
    table ourselves.

diff --git a/lib/Jifty/DBI/SchemaGenerator.pm b/lib/Jifty/DBI/SchemaGenerator.pm
index 016b97a..577bfa5 100644
--- a/lib/Jifty/DBI/SchemaGenerator.pm
+++ b/lib/Jifty/DBI/SchemaGenerator.pm
@@ -219,7 +219,9 @@ the models added to the SchemaGenerator.
 sub create_table_sql_statements {
     my $self = shift;
 
-    return $self->_db_schema->sql( $self->handle->dbh );
+    return  map { $self->_db_schema->table($_)->sql_create_table($self->handle->dbh) }
+           sort { $a cmp $b }
+                $self->_db_schema->tables;
 }
 
 =head2 create_table_sql_text
diff --git a/t/10schema.t b/t/10schema.t
index eb5efaf..7ff7cfa 100644
--- a/t/10schema.t
+++ b/t/10schema.t
@@ -98,8 +98,8 @@ foreach my $d ( @available_drivers ) {
     ok($ret != 0, "added model from an instantiated object");
 
     is_ignoring_space($SG->create_table_sql_text, 
-                      Sample::Address->$address_schema. Sample::Employee->$employee_schema . Sample::Corporation->$corporation_schema, 
-                      "got the right Address+Employee+Corporation schema for $d");
+                      Sample::Address->$address_schema. Sample::Corporation->$corporation_schema . Sample::Employee->$employee_schema, 
+                      "got the right Address+Corporation+Employee schema for $d");
     
     my $manually_make_text = join ' ', map { "$_;" } $SG->create_table_sql_statements;
      is_ignoring_space($SG->create_table_sql_text, 

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


More information about the Jifty-commit mailing list