Refactored DB Forge
- PDO subdrivers are isolated from each other now.
- Added compatibility for pretty much all of the features, for every DB platform.
- Unified the way that stuff works in general.
- Fixes issue #1005.
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index cbc6295..717d7f6 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -154,6 +154,8 @@
- Added MySQL client compression support.
- Added encrypted connections support (for *mysql*, *sqlsrv* and PDO with *sqlsrv*).
- Removed :doc:`Loader Class <libraries/loader>` from Database error tracing to better find the likely culprit.
+ - Added an optional second parameter to ``drop_table()`` in :doc:`Database Forge <database/forge>` that allows adding the IF EXISTS condition.
+ - Removed the optional AFTER clause from :doc:`Database Forge <database/forge>` method ``add_column()``.
- Libraries
diff --git a/user_guide_src/source/database/forge.rst b/user_guide_src/source/database/forge.rst
index bf17e29..1d6b847 100644
--- a/user_guide_src/source/database/forge.rst
+++ b/user_guide_src/source/database/forge.rst
@@ -193,13 +193,15 @@
Dropping a table
================
-Executes a DROP TABLE sql
+Execute a DROP TABLE statement and optionally add an IF EXISTS clause.
::
+ // Produces: DROP TABLE table_name
$this->dbforge->drop_table('table_name');
- // gives DROP TABLE IF EXISTS table_name
+ // Produces: DROP TABLE IF EXISTS table_name
+ $this->dbforge->drop_table('table_name');
Renaming a table
================
@@ -231,14 +233,6 @@
$this->dbforge->add_column('table_name', $fields);
// gives ALTER TABLE table_name ADD preferences TEXT
-An optional third parameter can be used to specify which existing column
-to add the new column after.
-
-::
-
- $this->dbforge->add_column('table_name', $fields, 'after_field');
-
-
$this->dbforge->drop_column()
==============================
diff --git a/user_guide_src/source/installation/upgrade_300.rst b/user_guide_src/source/installation/upgrade_300.rst
index fd5eea4..4e0b952 100644
--- a/user_guide_src/source/installation/upgrade_300.rst
+++ b/user_guide_src/source/installation/upgrade_300.rst
@@ -93,9 +93,31 @@
The default return value of these functions, when the required elements
don't exist, has been changed from FALSE to NULL.
-**********************************************************
-Step 9: Change usage of Email library with multiple emails
-**********************************************************
+************************************************************
+Step 9: Update usage of Database Forge's drop_table() method
+************************************************************
+
+Up until now, ``drop_table()`` added an IF EXISTS clause by default or it didn't work
+at all with some drivers. In CodeIgniter 3.0, the IF EXISTS condition is no longer added
+by deafault and has an optional second parameter that allows that instead and is set to
+FALSE by default.
+
+If your application relies on IF EXISTS, you'll have to change its usage.
+
+::
+
+ // Now produces just DROP TABLE `table_name`
+ $this->dbforge->drop_table('table_name');
+
+ // Produces DROP TABLE IF EXISTS `table_name`
+ $this->dbforge->drop_table('table_name', TRUE);
+
+.. note:: The given example users MySQL-specific syntax, but it should work across
+ all drivers with the exception of ODBC.
+
+***********************************************************
+Step 10: Change usage of Email library with multiple emails
+***********************************************************
The :doc:`Email library <../libraries/email>` will automatically clear the
set parameters after successfully sending emails. To override this behaviour,
@@ -110,7 +132,7 @@
****************************************************************
-Step 10: Remove usage of (previously) deprecated functionalities
+Step 11: Remove usage of (previously) deprecated functionalities
****************************************************************
In addition to the ``$autoload['core']`` configuration setting, there's a number of other functionalities