Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Steur <thomas.steur@googlemail.com>2014-02-05 01:10:24 +0400
committerThomas Steur <thomas.steur@googlemail.com>2014-02-05 01:10:24 +0400
commitf85b6f0dc4633cd7f1d4b048d8246464357e897a (patch)
tree27cb9ca97c2a84f5cde6b8f160a2a887ab088cbf /core/DbHelper.php
parent63f1ce69c474824e897ae421be68d057b8b5da14 (diff)
refs #4611 use InnoDB by default, added config option to change to different storage engine, introduced new API method to create tables which will automatically use configured engine, run optimize table only for InnoDB tables
Diffstat (limited to 'core/DbHelper.php')
-rw-r--r--core/DbHelper.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/core/DbHelper.php b/core/DbHelper.php
index 56dab6de98..01237cc02a 100644
--- a/core/DbHelper.php
+++ b/core/DbHelper.php
@@ -12,6 +12,9 @@ use Exception;
use Piwik\Db\Adapter;
use Piwik\Db\Schema;
+/**
+ * Contains database related helper functions.
+ */
class DbHelper
{
/**
@@ -26,6 +29,27 @@ class DbHelper
}
/**
+ * Creates a new table in the database.
+ *
+ * Example:
+ * ```
+ * $tableDefinition = "`age` INT(11) NOT NULL AUTO_INCREMENT,
+ * `name` VARCHAR(255) NOT NULL";
+ *
+ * DbHelper::createTable('tablename', $tableDefinition);
+ * ``
+ *
+ * @param string $nameWithoutPrefix The name of the table without any piwik prefix.
+ * @param string $createDefinition The table create definition
+ *
+ * @api
+ */
+ public static function createTable($nameWithoutPrefix, $createDefinition)
+ {
+ Schema::getInstance()->createTable($nameWithoutPrefix, $createDefinition);
+ }
+
+ /**
* Drop specific tables
*
* @param array $doNotDelete Names of tables to not delete
@@ -146,4 +170,5 @@ class DbHelper
{
return Schema::getInstance()->getTableCreateSql($tableName);
}
+
}