Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to set index names #6552

Merged
merged 20 commits into from
Oct 10, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add Notes to documentation
sclubricants committed Oct 10, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit ee164e233ae80bd62d861a3b6c41ac656609662b
14 changes: 14 additions & 0 deletions user_guide_src/source/dbmgmt/forge.rst
Original file line number Diff line number Diff line change
@@ -170,6 +170,8 @@ and unique keys with specific methods:

.. literalinclude:: forge/011.php

.. note:: MySQL and SQLite will assume the name ``PRIMARY`` even if a name is provided.
sclubricants marked this conversation as resolved.
Show resolved Hide resolved

.. _adding-foreign-keys:

Adding Foreign Keys
@@ -341,6 +343,8 @@ Class Reference

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

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

.. php:method:: addKey($key[, $primary = false[, $unique = false[, $keyName = '']]])
sclubricants marked this conversation as resolved.
Show resolved Hide resolved
:param mixed $key: Name of a key field or an array of fields
@@ -352,6 +356,8 @@ Class Reference

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

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

.. php:method:: addPrimaryKey($key[, $keyName = ''])
sclubricants marked this conversation as resolved.
Show resolved Hide resolved
:param mixed $key: Name of a key field or an array of fields
@@ -361,6 +367,8 @@ Class Reference

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

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

.. php:method:: addUniqueKey($key[, $keyName = ''])
sclubricants marked this conversation as resolved.
Show resolved Hide resolved
:param mixed $key: Name of a key field or an array of fields
@@ -370,6 +378,8 @@ Class Reference

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

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

.. php:method:: createDatabase($dbName[, $ifNotExists = false])
:param string $db_name: Name of the database to create
@@ -416,6 +426,8 @@ Class Reference

Drops an index or unique index.

.. note:: ``$keyName`` and ``$prefixKeyName`` can be used since v4.3.0.

.. php:method:: dropPrimaryKey($table[, $keyName = ''])
sclubricants marked this conversation as resolved.
Show resolved Hide resolved
:param string $table: Name of table to drop primary key
@@ -425,6 +437,8 @@ Class Reference

Drops a primary key from a table.

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

.. php:method:: dropTable($table_name[, $if_exists = false])
:param string $table: Name of the table to drop
8 changes: 4 additions & 4 deletions user_guide_src/source/dbmgmt/forge/011.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

$forge->addPrimaryKey('blog_id');
// gives PRIMARY KEY `blog_id` (`blog_id`)
$forge->addPrimaryKey('blog_id', 'pd_name');
// gives PRIMARY KEY `pd_name` (`blog_id`)

$forge->addUniqueKey(['blog_id', 'uri']);
// gives UNIQUE KEY `blog_id_uri` (`blog_id`, `uri`)
$forge->addUniqueKey(['blog_id', 'uri'], 'key_name');
// gives UNIQUE KEY `key_name` (`blog_id`, `uri`)