Skip to content

Commit 3b8a428

Browse files
committed
docs: add note for modifyColumn()
1 parent 118d35f commit 3b8a428

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

user_guide_src/source/dbmgmt/forge.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,12 @@ change the name, you can add a "name" key into the field defining array.
294294

295295
.. literalinclude:: forge/026.php
296296

297+
.. note:: The ``modifyColumn()`` may unexpectedly change ``NULL``/``NOT NULL``.
298+
So it is recommended to always specify ``null`` value.
299+
300+
.. note:: Due to a bug, prior v4.3.3, SQLite3 cannot set ``NOT NULL`` even if you
301+
specify ``'null' => false``.
302+
297303
.. _db-forge-adding-keys-to-a-table:
298304

299305
Adding Keys to a Table

user_guide_src/source/dbmgmt/forge/026.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
'old_name' => [
55
'name' => 'new_name',
66
'type' => 'TEXT',
7+
'null' => false,
78
],
89
];
910
$forge->modifyColumn('table_name', $fields);
10-
// gives ALTER TABLE `table_name` CHANGE `old_name` `new_name` TEXT
11+
// gives ALTER TABLE `table_name` CHANGE `old_name` `new_name` TEXT NOT NULL

0 commit comments

Comments
 (0)