add auto_nextval => 1 to uniqueidentifier columns on MSSQL and to uniqueidentifier...
[dbsrgits/DBIx-Class-Schema-Loader.git] / lib / DBIx / Class / Schema / Loader / DBI / SQLAnywhere.pm
index fb73578..6fc5769 100644 (file)
@@ -2,14 +2,14 @@ package DBIx::Class::Schema::Loader::DBI::SQLAnywhere;
 
 use strict;
 use warnings;
-use Class::C3;
+use mro 'c3';
 use base qw/
     DBIx::Class::Schema::Loader::DBI::Component::QuotedDefault
     DBIx::Class::Schema::Loader::DBI
 /;
 use Carp::Clan qw/^DBIx::Class/;
 
-our $VERSION = '0.07000';
+our $VERSION = '0.07002';
 
 =head1 NAME
 
@@ -102,11 +102,17 @@ EOF
         elsif ($info->{data_type} eq 'float') {
             $info->{data_type} = 'real';
         }
+        elsif ($info->{data_type} =~ /^uniqueidentifier(?:str)?\z/) {
+            $info->{auto_nextval} = 1;
+        }
 
         delete $info->{default_value} if ref($info->{default_value}) eq 'SCALAR' && ${ $info->{default_value} } eq 'NULL';
 
-        if (eval { lc ${ $info->{default_value} } }||'' eq 'current timestamp') {
+        if ((eval { lc ${ $info->{default_value} } }||'') eq 'current timestamp') {
             ${ $info->{default_value} } = 'current_timestamp';
+
+            my $orig_deflt = 'current timestamp';
+            $info->{original}{default_value} = \$orig_deflt;
         }
     }