2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-29 17:23:08 +00:00

Skit auditlog and eventlog table as auto increment key is uesd (#2066)

Close-issue: #2065
This commit is contained in:
chenglch 2016-11-02 15:20:08 +08:00 committed by yangsong
parent 71858a3ada
commit 15eeb3b2d5

View File

@ -1724,12 +1724,15 @@ sub setAttribs
my %newpairs;
# NOTE(chenglch): Just work around, set the default value to '' due to
# null value can not be allowed in composite primary keys in standard
# SQL rules.
my $descr = $xCAT::Schema::tabspec{ $self->{tabname} };
my @pkeys = @{$descr->{keys}};
for my $p (@pkeys) {
if(!defined($elems->{$p}) && !defined($pKeypairs->{$p})) {
$elems->{$p}= '';
# SQL rules. As auto increment key is uesd by 'eventlog' and 'auditlog'
# table, just skip these tables.
if ($self->{tabname} ne "eventlog" && $self->{tabname} ne "auditlog") {
my $descr = $xCAT::Schema::tabspec{ $self->{tabname} };
my @pkeys = @{$descr->{keys}};
for my $p (@pkeys) {
if(!defined($elems->{$p}) && !defined($pKeypairs->{$p})) {
$elems->{$p}= '';
}
}
}