Add IF EXISTS to DROP INDEX (except under MySQL)
authorIvan Kohler <ivan@freeside.biz>
Thu, 4 Feb 2016 00:36:10 +0000 (16:36 -0800)
committerIvan Kohler <ivan@freeside.biz>
Thu, 4 Feb 2016 00:36:10 +0000 (16:36 -0800)
Changes
DBSchema.pm
DBSchema/Table.pm

diff --git a/Changes b/Changes
index 6177c17..8d02b37 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,5 +1,8 @@
 Revision history for Perl module DBIx::DBSchema
 
+0.46 unreleased
+    - Add IF EXISTS to DROP INDEX (except under MySQL)
+
 0.45 Wed May  6 22:17:33 PDT 2015
     - MySQL does not support DEFAULT for TEXT/BLOB columns, closes: CPAN#58505
     - doc: Add repository information
index bb523b7..af5cfd0 100644 (file)
@@ -3,12 +3,12 @@ package DBIx::DBSchema;
 use strict;
 use Storable;
 use DBIx::DBSchema::_util qw(_load_driver _dbh _parse_opt);
-use DBIx::DBSchema::Table 0.08;
+use DBIx::DBSchema::Table 0.12;
 use DBIx::DBSchema::Index;
 use DBIx::DBSchema::Column;
 use DBIx::DBSchema::ForeignKey;
 
-our $VERSION = '0.45';
+our $VERSION = '0.46_01';
 $VERSION = eval $VERSION; # modperlstyle: convert the string into a number
 
 our $DEBUG = 0;
index ef51928..67e2eea 100644 (file)
@@ -7,7 +7,7 @@ use DBIx::DBSchema::Column 0.14;
 use DBIx::DBSchema::Index;
 use DBIx::DBSchema::ForeignKey 0.13;
 
-our $VERSION = '0.11';
+our $VERSION = '0.12';
 our $DEBUG = 0;
 
 =head1 NAME
@@ -631,8 +631,8 @@ sub sql_alter_table {
     warn "removing obsolete index $table.$old ON ( ".
          $old_indices{$old}->columns_sql. " )\n"
       if $DEBUG > 1;
-    push @r, "DROP INDEX $old".
-             ( $driver eq 'mysql' ? " ON $table" : '');
+    push @r, "DROP INDEX $old ".
+             ( $driver eq 'mysql' ? " ON $table" : ' IF EXISTS');
   }
 
   foreach my $new ( keys %new_indices ) {