From 27f798b9d64025fecaaecbd80a8cba41d455940f Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 20 Jan 2014 18:19:13 +0200 Subject: Add support for optional table attributes to CI_DB_forge::create_table() Supersedes PRs #989, #2776 Related issue: #41 --- user_guide_src/source/database/forge.rst | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'user_guide_src/source/database') diff --git a/user_guide_src/source/database/forge.rst b/user_guide_src/source/database/forge.rst index ca904ed00..48642ad7e 100644 --- a/user_guide_src/source/database/forge.rst +++ b/user_guide_src/source/database/forge.rst @@ -201,6 +201,15 @@ into the definition $this->dbforge->create_table('table_name', TRUE); // gives CREATE TABLE IF NOT EXISTS table_name +You could also pass optional table attributes, such as MySQL's ``ENGINE``:: + + $attributes = array('ENGINE' => 'InnoDB'); + $this->dbforge->create_table('table_name', FALSE, $attributes); + // produces: CREATE TABLE `table_name` (...) ENGINE = InnoDB DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci + +.. note:: Unless you specify the ``CHARACTER SET`` and/or ``COLLATE`` attributes, + ``create_table()`` will always add them with your configured *char_set* + and *dbcollat* values, as long as they are not empty (MySQL only). Dropping a table ================ -- cgit v1.2.3-24-g4f1b