0.38
[DBIx-DBSchema.git] / DBSchema.pm
index 6b6b1c2..60ac8f3 100644 (file)
@@ -4,13 +4,13 @@ use strict;
 use vars qw($VERSION $DEBUG $errstr);
 use Storable;
 use DBIx::DBSchema::_util qw(_load_driver _dbh _parse_opt);
-use DBIx::DBSchema::Table 0.05;
+use DBIx::DBSchema::Table 0.08;
 use DBIx::DBSchema::Index;
 use DBIx::DBSchema::Column;
 use DBIx::DBSchema::ColGroup::Unique;
 use DBIx::DBSchema::ColGroup::Index;
 
-$VERSION = "0.34_02";
+$VERSION = "0.38";
 $VERSION = eval $VERSION; # modperlstyle: convert the string into a number
 
 $DEBUG = 0;
@@ -276,7 +276,6 @@ specified database, will attempt to use generic SQL syntax.
 #gosh, false laziness w/DBSchema::Table::sql_alter_schema
 
 sub sql_update_schema {
-  #my($self, $new, $dbh) = ( shift, shift, _dbh(@_) );
   my($self, $opt, $new, $dbh) = ( shift, _parse_opt(\@_), shift, _dbh(@_) );
 
   my @r = ();
@@ -287,8 +286,10 @@ sub sql_update_schema {
   
       warn "$table exists\n" if $DEBUG > 1;
 
-      push @r,
-        $self->table($table)->sql_alter_table( $new->table($table), $dbh );
+      push @r, $self->table($table)->sql_alter_table( $new->table($table),
+                                                      $dbh,
+                                                      $opt
+                                                    );
 
     } else {
   
@@ -370,7 +371,12 @@ sub pretty_print {
                          "'". $table->column($_)->type. "', ".
                          "'". $table->column($_)->null. "', ". 
                          "'". $table->column($_)->length. "', ".
-                         "'". $table->column($_)->default. "', ".
+
+                         ( ref($table->column($_)->default)
+                             ? "\\'". ${ $table->column($_)->default }. "'"
+                             : "'". $table->column($_)->default. "'"
+                         ).', '.
+
                          "'". $table->column($_)->local. "',\n"
                        } $table->columns
           ).
@@ -406,7 +412,7 @@ sub pretty_print {
                       ? "              'using'  => '". $index->using ."',\n"
                       : ''
                   ).
-                  "                   'unique'  => ". $index->_unique .",\n".
+                  "                   'unique'  => ". $index->unique .",\n".
                   "                   'columns' => [ '".
                                               join("', '", @{$index->columns} ).
                                               "' ],\n".
@@ -424,6 +430,9 @@ sub pretty_print {
 
 =item pretty_read HASHREF
 
+This method is B<not> recommended.  If you need to load and save your schema
+to a file, see the L</load|load> and L</save|save> methods.
+
 Creates a schema as specified by a data structure such as that created by
 B<pretty_print> method.
 
@@ -498,7 +507,11 @@ Charles Shapiro <charles.shapiro@numethods.com> and Mitchell Friedman
 
 Daniel Hanks <hanksdc@about-inc.com> contributed the Oracle driver.
 
-Jesse Vincent contributed the SQLite driver.
+Jesse Vincent contributed the SQLite driver and fixes to quiet down
+internal usage of the old API.
+
+Slaven Rezic <srezic@cpan.org> contributed column and table dropping, Pg
+bugfixes and more.
 
 =head1 CONTRIBUTIONS
 
@@ -509,7 +522,7 @@ items/projects below under BUGS.
 
 Copyright (c) 2000-2007 Ivan Kohler
 Copyright (c) 2000 Mail Abuse Prevention System LLC
-Copyright (c) 2007 Freeside Internet Services, Inc.
+Copyright (c) 2007-2010 Freeside Internet Services, Inc.
 All rights reserved.
 This program is free software; you can redistribute it and/or modify it under
 the same terms as Perl itself.
@@ -520,9 +533,7 @@ Multiple primary keys are not yet supported.
 
 Foreign keys and other constraints are not yet supported.
 
-Eventually it would be nice to have additional transformations (deleted,
-modified columns).  sql_update_schema doesn't deal with deleted or modified
-columns yet.
+sql_update_schema doesn't deal with deleted columns yet.
 
 Need to port and test with additional databases