Index: trunk/core/kernel/utility/unit_config_reader.php =================================================================== diff -u -N -r8015 -r8029 --- trunk/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 8015) +++ trunk/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 8029) @@ -381,6 +381,7 @@ 'default_missing' => 'Default value for field %s not set in config', 'not_null_error1' => 'Field %s is NOT NULL in the database, but is not configured as not_null or required', 'not_null_error2' => 'Field %s is described as NOT NULL in config, but does not have DEFAULT value', + 'not_null_error3' => 'Field %s is described as NOT NULL in config, but is NULL in db', 'invalid_default' => 'Default value for field %s%s not sync. to db (in config = %s, in db = %s)', 'type_missing' => 'Type definition for field %s missing in config', ); @@ -413,21 +414,26 @@ } if ($field['Null'] != 'YES') { - // MySQL5 for null returns "NO", but MySQL4 returns "" + // field is NOT NULL in database (MySQL5 for null returns "NO", but MySQL4 returns "") if ( $f_name != $config['IDField'] && !isset($options['not_null']) && !isset($options['required']) ) { $config_errors[] = sprintf($error_messages['not_null_error1'], $f_name); } - if ( isset($options['not_null']) && !isset($options['default']) ) { + if (isset($options['not_null']) && $options['not_null'] && !isset($options['default']) ) { $config_errors[] = sprintf($error_messages['not_null_error2'], $f_name); } } + else { + if (isset($options['not_null']) && $options['not_null']) { + $config_errors[] = sprintf($error_messages['not_null_error3'], $f_name); + } + } if (!array_key_exists('type', $options)) { $config_errors[] = sprintf($error_messages['type_missing'], $f_name); } if (!$default_missing) { - if ($f_name == $config['IDField'] && $options['default'] !== 0) { + if ($f_name == $config['IDField'] && $options['type'] != 'string' && $options['default'] !== 0) { $config_errors[] = sprintf($error_messages['invalid_default'], 'IDField ', $f_name, $this->varDump($options['default']), $this->varDump($field['Default'])); } else if ($options['default'] != '#NOW#' && $field['Default'] !== $options['default'] && !in_array($options['type'], $float_types)) {