Skip to content

Commit

Permalink
docs: add note for modifyColumn()
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Mar 23, 2023
1 parent 118d35f commit 3b8a428
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions user_guide_src/source/dbmgmt/forge.rst
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,12 @@ change the name, you can add a "name" key into the field defining array.

.. literalinclude:: forge/026.php

.. note:: The ``modifyColumn()`` may unexpectedly change ``NULL``/``NOT NULL``.
So it is recommended to always specify ``null`` value.

.. note:: Due to a bug, prior v4.3.3, SQLite3 cannot set ``NOT NULL`` even if you
specify ``'null' => false``.

.. _db-forge-adding-keys-to-a-table:

Adding Keys to a Table
Expand Down
3 changes: 2 additions & 1 deletion user_guide_src/source/dbmgmt/forge/026.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
'old_name' => [
'name' => 'new_name',
'type' => 'TEXT',
'null' => false,
],
];
$forge->modifyColumn('table_name', $fields);
// gives ALTER TABLE `table_name` CHANGE `old_name` `new_name` TEXT
// gives ALTER TABLE `table_name` CHANGE `old_name` `new_name` TEXT NOT NULL

0 comments on commit 3b8a428

Please sign in to comment.