Skip to content

Commit d60a0f7

Browse files
committed
docs: improve docs
1 parent 12883f0 commit d60a0f7

2 files changed

Lines changed: 19 additions & 3 deletions

File tree

user_guide_src/source/changelogs/v4.3.0.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ Query Builder
240240
Forge
241241
-----
242242

243-
- Added ``Forge::processIndexes()`` allowing the creation of indexes on an existing table. See :ref:`adding-keys` for the details.
243+
- Added ``Forge::processIndexes()`` allowing the creation of indexes on an existing table. See :ref:`db-forge-adding-keys-to-a-table` for the details.
244244
- Added the ability to manually set index names. These methods include: ``Forge::addKey()``, ``Forge::addPrimaryKey()``, and ``Forge::addUniqueKey()``
245245
- The new method ``Forge::dropPrimaryKey()`` allows dropping the primary key on a table. See :ref:`dropping-a-primary-key`.
246246
- Fixed ``Forge::dropKey()`` to allow dropping unique indexes. This required the ``DROP CONSTRAINT`` SQL command.

user_guide_src/source/dbmgmt/forge.rst

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
####################
12
Database Forge Class
23
####################
34

@@ -142,7 +143,7 @@ string into the field definitions with ``addField()``:
142143

143144
.. note:: Multiple calls to ``addField()`` are cumulative.
144145

145-
Creating an id field
146+
Creating an id Field
146147
--------------------
147148

148149
There is a special exception for creating id fields. A field with type
@@ -156,6 +157,9 @@ Primary Key.
156157
Adding Keys
157158
===========
158159

160+
$forge->addKey()
161+
----------------
162+
159163
Generally speaking, you'll want your table to have Keys. This is
160164
accomplished with ``$forge->addKey('field')``. The optional second
161165
parameter set to true will make it a primary key and the third
@@ -169,6 +173,12 @@ below is for MySQL.
169173

170174
.. literalinclude:: forge/010.php
171175

176+
$forge->addPrimaryKey()
177+
-----------------------
178+
179+
$forge->addUniqueKey()
180+
----------------------
181+
172182
To make code reading more objective it is also possible to add primary
173183
and unique keys with specific methods:
174184

@@ -279,12 +289,15 @@ change the name, you can add a "name" key into the field defining array.
279289

280290
.. literalinclude:: forge/026.php
281291

292+
.. _db-forge-adding-keys-to-a-table:
293+
282294
Adding Keys to a Table
283295
======================
284296

285297
.. versionadded:: 4.3.0
286298

287-
You may add keys to an existing table by using ``processIndexes()``:
299+
You may add keys to an existing table by using ``addKey()``, ``addPrimaryKey()``,
300+
``addUniqueKey()`` or ``addForeignKey()`` and ``processIndexes()``:
288301

289302
.. literalinclude:: forge/029.php
290303

@@ -467,12 +480,15 @@ Class Reference
467480

468481
.. php:method:: processIndexes($table)
469482
483+
.. versionadded:: 4.3.0
484+
470485
:param string $table: Name of the table to add indexes to
471486
:returns: true on success, false on failure
472487
:rtype: bool
473488

474489
Used following ``addKey()``, ``addPrimaryKey()``, ``addUniqueKey()``,
475490
and ``addForeignKey()`` to add indexes to an existing table.
491+
See `Adding Keys to a Table`_.
476492

477493
.. php:method:: modifyColumn($table, $field)
478494

0 commit comments

Comments
 (0)