From: Rafael Kitover Date: Thu, 10 Jun 2010 07:41:02 +0000 (-0400) Subject: always mark pk columns is_nullable=0 X-Git-Tag: 0.07001~27 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=10c0c4f39b689b79ffc1305766f18a24f505148f;p=dbsrgits%2FDBIx-Class-Schema-Loader.git always mark pk columns is_nullable=0 --- diff --git a/Changes b/Changes index 15b6311..96c606f 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,6 @@ Revision history for Perl extension DBIx::Class::Schema::Loader + - always mark pk columns is_nullable=0 - fix unique constraint names for SQLite (actual names break ->deploy) - fix bug in qualify_objects that would add schema to relnames - better type info for Informix, except for DATETIME precision and diff --git a/lib/DBIx/Class/Schema/Loader/Base.pm b/lib/DBIx/Class/Schema/Loader/Base.pm index a3eb7d8..df95117 100644 --- a/lib/DBIx/Class/Schema/Loader/Base.pm +++ b/lib/DBIx/Class/Schema/Loader/Base.pm @@ -1560,11 +1560,18 @@ sub _setup_src_meta { my $fks = $self->_table_fk_info($table); - for my $fkdef (@$fks) { + foreach my $fkdef (@$fks) { for my $col (@{ $fkdef->{local_columns} }) { $col_info->{$col}{is_foreign_key} = 1; } } + + my $pks = $self->_table_pk_info($table) || []; + + foreach my $pkcol (@$pks) { + $col_info->{$pkcol}{is_nullable} = 0; + } + $self->_dbic_stmt( $table_class, 'add_columns', @@ -1573,7 +1580,6 @@ sub _setup_src_meta { my %uniq_tag; # used to eliminate duplicate uniqs - my $pks = $self->_table_pk_info($table) || []; @$pks ? $self->_dbic_stmt($table_class,'set_primary_key',@$pks) : carp("$table has no primary key"); $uniq_tag{ join("\0", @$pks) }++ if @$pks; # pk is a uniq