Skip to content

Commit 6526113

Browse files
authored
Merge pull request #7236 from kenjis/docs-improve-forge.rst
docs: improve forge.rst
2 parents 5ffe732 + 4b15314 commit 6526113

File tree

1 file changed

+28
-26
lines changed

1 file changed

+28
-26
lines changed

user_guide_src/source/dbmgmt/forge.rst

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ There are several things you may wish to do when creating tables. Add
8686
fields, add keys to the table, alter columns. CodeIgniter provides a
8787
mechanism for this.
8888

89+
.. _adding-fields:
90+
8991
Adding Fields
9092
=============
9193

@@ -116,7 +118,7 @@ After the fields have been defined, they can be added using
116118
$forge->addField()
117119
------------------
118120

119-
The add fields method will accept the above array.
121+
The ``addField()`` method will accept the above array.
120122

121123
.. _forge-addfield-default-value-rawsql:
122124

@@ -249,8 +251,8 @@ $forge->addColumn()
249251
-------------------
250252

251253
The ``addColumn()`` method is used to modify an existing table. It
252-
accepts the same field array as above, and can be used for an unlimited
253-
number of additional fields.
254+
accepts the same field array as :ref:`Creating Tables <adding-fields>`, and can
255+
be used to add additional fields.
254256

255257
.. literalinclude:: forge/022.php
256258

@@ -348,15 +350,15 @@ Class Reference
348350
:returns: true on success, false on failure
349351
:rtype: bool
350352

351-
Adds a column to a table. Usage: See `Adding a Field to a Table`_.
353+
Adds a column to an existing table. Usage: See `Adding a Field to a Table`_.
352354

353355
.. php:method:: addField($field)
354356
355357
:param array $field: Field definition to add
356-
:returns: \CodeIgniter\Database\Forge instance (method chaining)
357-
:rtype: \CodeIgniter\Database\Forge
358+
:returns: ``\CodeIgniter\Database\Forge`` instance (method chaining)
359+
:rtype: ``\CodeIgniter\Database\Forge``
358360

359-
Adds a field to the set that will be used to create a table. Usage: See `Adding Fields`_.
361+
Adds a field to the set that will be used to create a table. Usage: See `Adding Fields`_.
360362

361363
.. php:method:: addForeignKey($fieldName, $tableName, $tableField[, $onUpdate = '', $onDelete = '', $fkName = ''])
362364
@@ -366,10 +368,10 @@ Class Reference
366368
:param string $onUpdate: Desired action for the "on update"
367369
:param string $onDelete: Desired action for the "on delete"
368370
:param string $fkName: Name of foreign key. This does not work with SQLite3
369-
:returns: \CodeIgniter\Database\Forge instance (method chaining)
370-
:rtype: \CodeIgniter\Database\Forge
371+
:returns: ``\CodeIgniter\Database\Forge`` instance (method chaining)
372+
:rtype: ``\CodeIgniter\Database\Forge``
371373

372-
Adds a foreign key to the set that will be used to create a table. Usage: See `Adding Foreign Keys`_.
374+
Adds a foreign key to the set that will be used to create a table. Usage: See `Adding Foreign Keys`_.
373375

374376
.. note:: ``$fkName`` can be used since v4.3.0.
375377

@@ -379,32 +381,32 @@ Class Reference
379381
:param bool $primary: Set to true if it should be a primary key or a regular one
380382
:param bool $unique: Set to true if it should be a unique key or a regular one
381383
:param string $keyName: Name of key to be added
382-
:returns: \CodeIgniter\Database\Forge instance (method chaining)
383-
:rtype: \CodeIgniter\Database\Forge
384+
:returns: ``\CodeIgniter\Database\Forge`` instance (method chaining)
385+
:rtype: ``\CodeIgniter\Database\Forge``
384386

385-
Adds a key to the set that will be used to create a table. Usage: See `Adding Keys`_.
387+
Adds a key to the set that will be used to create a table. Usage: See `Adding Keys`_.
386388

387389
.. note:: ``$keyName`` can be used since v4.3.0.
388390

389391
.. php:method:: addPrimaryKey($key[, $keyName = ''])
390392
391393
:param mixed $key: Name of a key field or an array of fields
392394
:param string $keyName: Name of key to be added
393-
:returns: \CodeIgniter\Database\Forge instance (method chaining)
394-
:rtype: \CodeIgniter\Database\Forge
395+
:returns: ``\CodeIgniter\Database\Forge`` instance (method chaining)
396+
:rtype: ``\CodeIgniter\Database\Forge``
395397

396-
Adds a primary key to the set that will be used to create a table. Usage: See `Adding Keys`_.
398+
Adds a primary key to the set that will be used to create a table. Usage: See `Adding Keys`_.
397399

398400
.. note:: ``$keyName`` can be used since v4.3.0.
399401

400402
.. php:method:: addUniqueKey($key[, $keyName = ''])
401403
402404
:param mixed $key: Name of a key field or an array of fields
403405
:param string $keyName: Name of key to be added
404-
:returns: \CodeIgniter\Database\Forge instance (method chaining)
405-
:rtype: \CodeIgniter\Database\Forge
406+
:returns: ``\CodeIgniter\Database\Forge`` instance (method chaining)
407+
:rtype: ``\CodeIgniter\Database\Forge``
406408

407-
Adds a unique key to the set that will be used to create a table. Usage: See `Adding Keys`_.
409+
Adds a unique key to the set that will be used to create a table. Usage: See `Adding Keys`_.
408410

409411
.. note:: ``$keyName`` can be used since v4.3.0.
410412

@@ -415,7 +417,7 @@ Class Reference
415417
:returns: true on success, false on failure
416418
:rtype: bool
417419

418-
Creates a new database. Usage: See `Creating and Dropping Databases`_.
420+
Creates a new database. Usage: See `Creating and Dropping Databases`_.
419421

420422
.. php:method:: createTable($table[, $if_not_exists = false[, array $attributes = []]])
421423
@@ -425,7 +427,7 @@ Class Reference
425427
:returns: Query object on success, false on failure
426428
:rtype: mixed
427429

428-
Creates a new table. Usage: See `Creating a Table`_.
430+
Creates a new table. Usage: See `Creating a Table`_.
429431

430432
.. php:method:: dropColumn($table, $column_name)
431433
@@ -434,15 +436,15 @@ Class Reference
434436
:returns: true on success, false on failure
435437
:rtype: bool
436438

437-
Drops single or multiple columns from a table. Usage: See `Dropping Fields From a Table`_.
439+
Drops single or multiple columns from a table. Usage: See `Dropping Fields From a Table`_.
438440

439441
.. php:method:: dropDatabase($dbName)
440442
441443
:param string $dbName: Name of the database to drop
442444
:returns: true on success, false on failure
443445
:rtype: bool
444446

445-
Drops a database. Usage: See `Creating and Dropping Databases`_.
447+
Drops a database. Usage: See `Creating and Dropping Databases`_.
446448

447449
.. php:method:: dropKey($table, $keyName[, $prefixKeyName = true])
448450
@@ -474,7 +476,7 @@ Class Reference
474476
:returns: true on success, false on failure
475477
:rtype: bool
476478

477-
Drops a table. Usage: See `Dropping a Table`_.
479+
Drops a table. Usage: See `Dropping a Table`_.
478480

479481
.. php:method:: processIndexes($table)
480482
@@ -495,7 +497,7 @@ Class Reference
495497
:returns: true on success, false on failure
496498
:rtype: bool
497499

498-
Modifies a table column. Usage: See `Modifying a Field in a Table`_.
500+
Modifies a table column. Usage: See `Modifying a Field in a Table`_.
499501

500502
.. php:method:: renameTable($table_name, $new_table_name)
501503
@@ -504,4 +506,4 @@ Class Reference
504506
:returns: Query object on success, false on failure
505507
:rtype: mixed
506508

507-
Renames a table. Usage: See `Renaming a Table`_.
509+
Renames a table. Usage: See `Renaming a Table`_.

0 commit comments

Comments
 (0)