X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=bin%2Fsqlt-diff;h=3a5a6a586dbfd858421d41f1fbc3f1137c0c675f;hb=969049bac34339de63ddb893e94aed228e3a5de9;hp=1cd80ca02a706738a38b9948bba7d3005ff48aa5;hpb=da5a1bae10b18456fedc2707f0361274e6c68a17;p=dbsrgits%2FSQL-Translator.git diff --git a/bin/sqlt-diff b/bin/sqlt-diff index 1cd80ca..3a5a6a5 100755 --- a/bin/sqlt-diff +++ b/bin/sqlt-diff @@ -1,10 +1,8 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl # vim: set ft=perl: # ------------------------------------------------------------------- -# $Id: sqlt-diff,v 1.19 2007-10-24 10:55:44 schiffbruechige Exp $ -# ------------------------------------------------------------------- -# Copyright (C) 2002-4 The SQLFairy Authors +# Copyright (C) 2002-2009 The SQLFairy Authors # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as @@ -53,6 +51,8 @@ Options: for new tables --ignore-view-sql Ignore view SQL differences --ignore-proc-sql Ignore procedure SQL differences + --no-batch-alters Do not clump multile alters to the same table into a + single ALTER TABLE statement where possible. =head1 DESCRIPTION @@ -103,6 +103,7 @@ Currently (v0.0900), only MySQL is supported by this code. # ------------------------------------------------------------------- use strict; +use warnings; use Pod::Usage; use Data::Dumper; use SQL::Translator; @@ -110,11 +111,11 @@ use SQL::Translator::Diff; use SQL::Translator::Schema::Constants; use vars qw( $VERSION ); -$VERSION = sprintf "%d.%02d", q$Revision: 1.19 $ =~ /(\d+)\.(\d+)/; +$VERSION = '1.59'; my ( @input, $list, $help, $debug, $trace, $caseopt, $ignore_index_names, $ignore_constraint_names, $output_db, $mysql_parser_version, - $ignore_view_sql, $ignore_proc_sql ); + $ignore_view_sql, $ignore_proc_sql, $no_batch_alters ); for my $arg ( @ARGV ) { if ( $arg =~ m/^-?-l(ist)?$/ ) { $list = 1; @@ -152,12 +153,21 @@ for my $arg ( @ARGV ) { elsif ( $arg =~ m/^([^=]+)=(.+)$/ ) { push @input, { file => $1, parser => $2 }; } + elsif ( $arg =~ m/^--no-batch-alters$/ ) { + $no_batch_alters = 1; + } else { pod2usage( msg => "Unknown argument '$arg'" ); } } -print STDERR "This code is experimental, currently the new code only supports MySQL diffing.\n To add support for other databases, please patch the relevant SQL::Translator::Producer:: module.\n If you need compatibility with the old sqlt-diff, please use sqlt-diff-old, and look into helping us make this one work for you.\n"; +print STDERR <<'EOM'; +This code is experimental, currently the new code only supports MySQL or +SQLite diffing. To add support for other databases, please patch the relevant +SQL::Translator::Producer:: module. If you need compatibility with the old +sqlt-diff, please use sqlt-diff-old, and look into helping us make this one +work for you +EOM pod2usage(1) if $help || !@ARGV; pod2usage('Please specify only two schemas to diff') if scalar @input > 2; @@ -202,6 +212,7 @@ my $result = SQL::Translator::Diff::schema_diff($source_schema, $source_db, ignore_view_sql => $ignore_view_sql, ignore_proc_sql => $ignore_proc_sql, output_db => $output_db, + no_batch_alters => $no_batch_alters, debug => $debug, trace => $trace }); if($result) @@ -222,7 +233,7 @@ else =head1 AUTHOR -Ken Y. Clark Ekclark@cpan.orgE. +Ken Youens-Clark Ekclark@cpan.orgE. =head1 SEE ALSO