Fix MATCH / ON DELETE / ON UPDATE
authorIvan Kohler <ivan@freeside.biz>
Sat, 16 Nov 2013 01:52:27 +0000 (17:52 -0800)
committerIvan Kohler <ivan@freeside.biz>
Sat, 16 Nov 2013 01:52:27 +0000 (17:52 -0800)
Changes
DBSchema/ForeignKey.pm
DBSchema/Table.pm

diff --git a/Changes b/Changes
index cb1af01..953ba29 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,10 +1,11 @@
 Revision history for Perl module DBIx::DBSchema
 
-0.44_01 not released
+0.44_02 not released
     - POD fixes from Xavier Guimard <x.guimard@free.fr> and Damyan Ivanov
       <dmn@debian.org> of the Debian Perl Group, closes: CPAN#82187
     - More foreign key support
-      + table alteration (removing foreign keys)
+      + Table alteration (removing foreign keys)
+      + Fix MATCH / ON DELETE / ON UPDATE
 
 0.43 2013-11-04 14:58;32 PST
     - Incorporate CPAN::Changes::Spec-compliant Changes file from Neil Bowers
index 8be4032..bd48229 100644 (file)
@@ -2,7 +2,7 @@ package DBIx::DBSchema::ForeignKey;
 
 use strict;
 
-our $VERSION = '0.12';
+our $VERSION = '0.13';
 our $DEBUG = 0;
 
 =head1 NAME
@@ -217,7 +217,10 @@ sub sql_foreign_key {
   my $ref_sql = $self->references_sql;
 
   "FOREIGN KEY ( $col_sql ) REFERENCES $table ( $ref_sql ) ".
-    join ' ', grep $_, map $self->$_, qw( match on_delete on_update );
+    join ' ', map { (my $thing_sql = uc($_) ) =~ s/_/ /g;
+                    "$thing_sql ". $self->$_;
+                  }
+                grep $self->$_, qw( match on_delete on_update );
 }
 
 =item cmp OTHER_INDEX_OBJECT
index 9d85947..ef51928 100644 (file)
@@ -5,7 +5,7 @@ use Carp;
 use DBIx::DBSchema::_util qw(_load_driver _dbh _parse_opt);
 use DBIx::DBSchema::Column 0.14;
 use DBIx::DBSchema::Index;
-use DBIx::DBSchema::ForeignKey 0.12;
+use DBIx::DBSchema::ForeignKey 0.13;
 
 our $VERSION = '0.11';
 our $DEBUG = 0;