CodeIgniter Forums

Full Version: DBforge NOT NULL
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

/system/database/drivers/mysqli/mysqli_forge.php and

both have a bug in creating a field. According to the manual:
Quote:null/true : to generate "NULL" in the field definition. Without this, the field will default to "NOT NULL".

However if the null key is not specified, it won't default to "NOT NULL". All other db drivers are correct.

if (array_key_exists('NULL', $attributes))
    $sql .= ($attributes['NULL'] === TRUE) ? ' NULL' : ' NOT NULL';

if (array_key_exists('NULL', $attributes) && $attributes['NULL'] === TRUE)
    $sql .= ' NULL';
    $sql .= ' NOT NULL';            
(copied from postgre_forge.php)

This fixes the problem and fields wil default to "NOT NULL".
Please correct me if I didn't understand the manual correctly or this problem isn't reproducible.