-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: Forge::modifyColumn() and null #7302
Conversation
5d49dff
to
f9c953c
Compare
@codeigniter4/database-team |
Looks like nullable is the default. What is the matter with this? |
I did not look into all drivers, but Postgre changes to Another issue is these behaviors are not consistent. As you see all tests pass If a dev changes DB driver, e.g. MySQLi to Postgres, |
f9c953c
to
a5fc127
Compare
$this->forge->addField([
'col1' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'col2' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'col3' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
]);
$this->forge->createTable('forge_test_modify');
$this->forge->modifyColumn('forge_test_modify', [
'col1' => ['type' => 'VARCHAR', 'constraint' => 1],
'col2' => ['type' => 'VARCHAR', 'constraint' => 1, 'null' => true],
'col3' => ['type' => 'VARCHAR', 'constraint' => 1, 'null' => false],
]);
$this->db->resetDataCache();
$fields = $this->db->getFieldData('forge_test_modify');
dd($fields); Postgres:
SQLSRV:
SQLite3:
Not directly related, but the all |
a5fc127
to
cedb583
Compare
Seems like a bug to me. |
cedb583
to
140ad48
Compare
140ad48
to
5232285
Compare
5232285
to
0e86d4c
Compare
Rebased and now this PR removes only unneeded test code. |
Looks good, thanks! |
Needs #7301Description
From https://zenn.dev/naente/articles/50935eb55c14ea (CodeIgniter4 PostgreSQL always adds NOT NULL constraints when running
modifyColumn()
)See the current behavior: #7302 (comment)
Forge::modifyColumn()
and nullThis bug was fixed in v4.3.4:
Related #7235
Checklist: