1+ ####################
12Database 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
148149There is a special exception for creating id fields. A field with type
@@ -156,6 +157,9 @@ Primary Key.
156157Adding Keys
157158===========
158159
160+ $forge->addKey()
161+ ----------------
162+
159163Generally speaking, you'll want your table to have Keys. This is
160164accomplished with ``$forge->addKey('field') ``. The optional second
161165parameter 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+
172182To make code reading more objective it is also possible to add primary
173183and 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+
282294Adding 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