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_03";
+$VERSION = "0.41_01";
$VERSION = eval $VERSION; # modperlstyle: convert the string into a number
$DEBUG = 0;
tables.
See L<DBIx::DBSchema::Table/sql_alter_table>,
-L<DBIx::DBSchema::Column/sql_add_coumn> and
+L<DBIx::DBSchema::Column/sql_add_column> and
L<DBIx::DBSchema::Column/sql_alter_column> for additional specifics and
limitations.
#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 = ();
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 {
"'". $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
).
? " 'using' => '". $index->using ."',\n"
: ''
).
- " 'unique' => ". $index->_unique .",\n".
+ " 'unique' => ". $index->unique .",\n".
" 'columns' => [ '".
join("', '", @{$index->columns} ).
"' ],\n".
=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.
Copyright (c) 2000-2007 Ivan Kohler
Copyright (c) 2000 Mail Abuse Prevention System LLC
-Copyright (c) 2007 Freeside Internet Services, Inc.
+Copyright (c) 2007-2013 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.
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