Skip to content

Commit

Permalink
default 値の設定で、auto_increment かつ値が未設定ならカラムごと消す (PostgreSQL 対応)
Browse files Browse the repository at this point in the history
  • Loading branch information
fujiwara committed Jul 3, 2009
1 parent 26a9487 commit 02b5e41
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/Data/Model/Schema/Properties.pm
Expand Up @@ -377,6 +377,14 @@ sub set_default {
my($self, $columns) = @_;

while (my($name, $conf) = each %{ $self->{column} }) {
if ( exists $conf->{options}
&& $conf->{options}->{auto_increment}
&& !defined $columns->{$name}
) {
# auto_increment で null の場合はカラム自体を消す
delete $columns->{$name};
next;
}
next if exists $columns->{$name};
next unless exists $conf->{options};
next unless exists $conf->{options}->{default};
Expand Down

0 comments on commit 02b5e41

Please sign in to comment.