diff --git a/system/Database/Postgre/Forge.php b/system/Database/Postgre/Forge.php index 2a935e2393bd..47be1b063c8d 100644 --- a/system/Database/Postgre/Forge.php +++ b/system/Database/Postgre/Forge.php @@ -110,10 +110,8 @@ protected function _alterTable(string $alterType, string $table, $field) } $nullable = true; // Nullable by default. - if (isset($data['null'])) { - if ($data['null'] === false || $data['null'] === ' NOT ' . $this->null) { - $nullable = false; - } + if (isset($data['null']) && ($data['null'] === false || $data['null'] === ' NOT ' . $this->null)) { + $nullable = false; } $sqls[] = $sql . ' ALTER COLUMN ' . $this->db->escapeIdentifiers($data['name']) . ($nullable === true ? ' DROP' : ' SET') . ' NOT NULL'; diff --git a/system/Database/SQLSRV/Forge.php b/system/Database/SQLSRV/Forge.php index 837f6be49d50..e44624761850 100755 --- a/system/Database/SQLSRV/Forge.php +++ b/system/Database/SQLSRV/Forge.php @@ -204,10 +204,8 @@ protected function _alterTable(string $alterType, string $table, $field) } $nullable = true; // Nullable by default. - if (isset($data['null'])) { - if ($data['null'] === false || $data['null'] === ' NOT ' . $this->null) { - $nullable = false; - } + if (isset($data['null']) && ($data['null'] === false || $data['null'] === ' NOT ' . $this->null)) { + $nullable = false; } $sqls[] = $sql . ' ALTER COLUMN ' . $this->db->escapeIdentifiers($data['name']) . " {$data['type']}{$data['length']} " . ($nullable === true ? '' : 'NOT') . ' NULL';