- Alexander Hartmaier <abraxxa@cpan.org>
- Allen Day <allenday@users.sourceforge.net>
- Anders Nor Berle <berle@cpan.org>
+- Andrew Moore <amoore@cpan.org>
- Ben Faga <faga@cshl.edu>
- Chris Hilton <chilton@alterpoint.com>
- Chris Mungall <cjm@fruitfly.org>
+* Fix Parser::DBI::Oracle reading too many tables (RT#49413)
+* Fix Parser::MySQL tripping up on PRIMARY KEY ... USING (currently value is ignored) (RT#50468)
+* Fix runaway debug trace (RT#52276)
+* Fix Parser::PostgreSQL choking on commit; statements in DDL (#RT52277)
+
+# ----------------------------------------------------------
+# 0.11004 2010-02-14
+# ----------------------------------------------------------
* Fix PG producer numeric precision regression (RT#49301)
* Add DB2 producer numeric/decimal precision output
* Fix Oracle producer creating numeric precision statements that the test case expects (no whitespace)
* Add Oracle producer creating drop view statements like PG producer does
+* Fix SQL::Translator::Diff to use producer_args instead of producer_options
# ----------------------------------------------------------
# 0.11003 2009-09-28
require 5.005;
-$VERSION = '0.11003';
+$VERSION = '0.11004';
$DEBUG = 0 unless defined $DEBUG;
$ERROR = "";
use warnings;
use Data::Dumper;
+use Carp::Clan qw/^SQL::Translator/;
use SQL::Translator::Schema::Constants;
use base 'Class::Accessor::Fast';
__PACKAGE__->mk_accessors(qw/
ignore_index_names ignore_constraint_names ignore_view_sql
ignore_proc_sql output_db source_schema target_schema
- case_insensitive no_batch_alters ignore_missing_methods producer_options
+ case_insensitive no_batch_alters ignore_missing_methods producer_args
/);
my @diff_arrays = qw/
$values->{$_} ||= [] foreach @diff_arrays;
$values->{table_diff_hash} = {};
- $values->{producer_options} ||= {};
+ $values->{producer_args} ||= {};
+ if ($values->{producer_options}) {
+ carp 'producer_options is deprecated. Please use producer_args';
+ $values->{producer_args} = { %{$values->{producer_options}}, %{$values->{producer_args}} };
+ }
$values->{output_db} ||= $values->{source_db};
return $class->SUPER::new($values);
}
$self->table_diff_hash->{$tar_table_name}{table_renamed_from} = [ [$src_table, $tar_table] ];
} else {
delete $tar_table->extra->{renamed_from};
- warn qq#Renamed table can't find old table "$old_name" for renamed table\n#;
+ carp qq#Renamed table can't find old table "$old_name" for renamed table\n#;
}
} else {
$src_table = $source_schema->get_table( $tar_table_name, $self->case_insensitive );
$func_map{$_} => $self->table_diff_hash->{$table}{$_}
} keys %func_map
},
- $self->producer_options
+ $self->producer_args
);
}
} else {
my $meth = $producer_class->can($_);
$meth ? map {
- my $sql = $meth->( (ref $_ eq 'ARRAY' ? @$_ : $_), $self->producer_options );
+ my $sql = $meth->( (ref $_ eq 'ARRAY' ? @$_ : $_), $self->producer_args );
$sql ? ("$sql") : ();
} @{ $flattened_diffs{$_} }
: $self->ignore_missing_methods
add_drop_table => 0,
no_comments => 1,
# TODO: sort out options
- %{ $self->producer_options }
+ %{ $self->producer_args }
);
$translator->producer_args->{no_transaction} = 1;
my $schema = $translator->schema;
if (my @tables_to_drop = @{ $self->{tables_to_drop} || []} ) {
my $meth = $producer_class->can('drop_table');
- push @diffs, $meth ? ( map { $meth->($_, $self->producer_options) } @tables_to_drop)
+ push @diffs, $meth ? ( map { $meth->($_, $self->producer_args) } @tables_to_drop)
: $self->ignore_missing_methods
? "-- $producer_class cant drop_table"
: die "$producer_class cant drop_table";
if (my $old_name = $tar_table_field->extra->{renamed_from}) {
my $src_table_field = $src_table->get_field( $old_name, $self->case_insensitive );
unless ($src_table_field) {
- warn qq#Renamed column can't find old column "@{[$src_table->name]}.$old_name" for renamed column\n#;
+ carp qq#Renamed column can't find old column "@{[$src_table->name]}.$old_name" for renamed column\n#;
delete $tar_table_field->extra->{renamed_from};
} else {
push @{$self->table_diff_hash->{$tar_table}{fields_to_rename} }, [ $src_table_field, $tar_table_field ];
unless $src_table->_compare_objects( \@src_opts, \@tar_opts );
}
+# support producer_options as an alias for producer_args for legacy code.
+sub producer_options {
+ my $self = shift;
+
+ return $self->producer_args( @_ );
+}
+
1;
__END__
my $schema = $tr->schema;
- my $sth = $dbh->table_info();
+ my $db_user = uc $tr->parser_args()->{db_user};
+ my $sth = $dbh->table_info(undef, $db_user, '%', 'TABLE');
while(my $table_info = $sth->fetchrow_hashref('NAME_uc')) {
- next unless ($table_info->{TABLE_TYPE} eq 'TABLE');
next if ($table_info->{TABLE_NAME} =~ /\$/);
# create the table
$fk_select->execute('public',$table_name) or die "Can't execute: $@";
my $fkeys = $fk_select->fetchall_arrayref({});
- print Dumper $fkeys;
+ $DEBUG and print Dumper $fkeys;
for my $con (@$fkeys){
my $con_name = $con->{conname};
my $fields = $con->{fields};
/foreign key/i
{ $return = '' }
-primary_key_def : primary_key index_name(?) '(' name_with_opt_paren(s /,/) ')'
+primary_key_def : primary_key index_name(?) '(' name_with_opt_paren(s /,/) ')' index_type(?)
{
$return = {
supertype => 'constraint',
name => $item{'index_name(?)'}[0],
type => 'primary_key',
fields => $item[4],
+ options => $item[6][0],
};
}
| select
| copy
| readin_symbol
+ | commit
| <error>
+commit : /commit/i ';'
+
connect : /^\s*\\\connect.*\n/
set : /set/i /[^;]*/ ';'
tax decimal(8,2),
shipping_charge decimal(8,2),
price_paid decimal(8,2),
- PRIMARY KEY (order_id),
+ PRIMARY KEY (order_id) USING BTREE,
KEY (status),
KEY (billing_address_id),
KEY (shipping_address_id),
alter table only t_test1 drop constraint foo cascade;
alter table t_test1 owner to foo;
+
+ commit;
];
$| = 1;
$target_schema, 'MySQL',
{
no_batch_alters => 1,
- producer_options => { quote_table_names => 0 }
+ producer_args => { quote_table_names => 0 }
}
);
$out = SQL::Translator::Diff::schema_diff($source_schema, 'MySQL', $target_schema, 'MySQL',
{ ignore_index_names => 1,
ignore_constraint_names => 1,
- producer_options => { quote_table_names => 0 },
+ producer_args => { quote_table_names => 0 },
});
eq_or_diff($out, <<'## END OF DIFF', "Diff as expected");
my $field = $target_schema->get_table('employee')->get_field('employee_id');
$field->data_type('integer');
$field->size(0);
- $out = SQL::Translator::Diff::schema_diff($schema, 'MySQL', $target_schema, 'MySQL', { producer_options => { quote_table_names => 0 } } );
+ $out = SQL::Translator::Diff::schema_diff($schema, 'MySQL', $target_schema, 'MySQL', { producer_args => { quote_table_names => 0 } } );
eq_or_diff($out, <<'## END OF DIFF', "No differences found");
-- Convert schema 'create.sql' to 'create2.yml':;
# Test quoting works too.
$out = SQL::Translator::Diff::schema_diff($s1, 'MySQL', $s2, 'MySQL',
- { producer_options => { quote_table_names => '`' } }
+ { producer_args => { quote_table_names => '`' } }
);
eq_or_diff($out, <<'## END OF DIFF', "Quoting can be turned on");
-- Convert schema 'Schema 3' to 'Schema 4':;
$target_schema,
'PostgreSQL',
{
- producer_options => {
+ producer_args => {
quote_table_names => 0,
}
}
$source_schema, 'PostgreSQL', $target_schema, 'PostgreSQL',
{ ignore_index_names => 1,
ignore_constraint_names => 1,
- producer_options => {
+ producer_args => {
quote_table_names => 0,
quote_field_names => 0,
}
employee_id integer,
job_title varchar(255),
CONSTRAINT FK5302D47D93FE702E FOREIGN KEY (employee_id) REFERENCES person (person_id),
- PRIMARY KEY (position, employee_id)
+ PRIMARY KEY (position, employee_id) USING BTREE
) ENGINE=InnoDB;
create table deleted (