From dda9fec95e9dbe09cf11d9171be4d9dd41ccf7e2 Mon Sep 17 00:00:00 2001 From: Alexander Kochetov Date: Thu, 9 Jan 2014 06:59:22 +0400 Subject: [PATCH 01/10] ActiveRecord::tableName() hardcoded prefix fix --- framework/yii/db/ActiveRecord.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/yii/db/ActiveRecord.php b/framework/yii/db/ActiveRecord.php index cc67224..960e1fb 100644 --- a/framework/yii/db/ActiveRecord.php +++ b/framework/yii/db/ActiveRecord.php @@ -183,7 +183,7 @@ class ActiveRecord extends BaseActiveRecord */ public static function tableName() { - return 'tbl_' . Inflector::camel2id(StringHelper::basename(get_called_class()), '_'); + return static::getDb()->tablePrefix . Inflector::camel2id(StringHelper::basename(get_called_class()), '_'); } /** From d82b38531cb15b96cab7c8dd246d5dda3c13f484 Mon Sep 17 00:00:00 2001 From: Alexander Kochetov Date: Thu, 9 Jan 2014 07:36:39 +0400 Subject: [PATCH 02/10] DbConnection::tablePrefix default value added --- framework/yii/db/Connection.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/framework/yii/db/Connection.php b/framework/yii/db/Connection.php index 4a8571e..9637087 100644 --- a/framework/yii/db/Connection.php +++ b/framework/yii/db/Connection.php @@ -219,10 +219,9 @@ class Connection extends Component /** * @var string the common prefix or suffix for table names. If a table name is given * as `{{%TableName}}`, then the percentage character `%` will be replaced with this - * property value. For example, `{{%post}}` becomes `{{tbl_post}}` if this property is - * set as `"tbl_"`. + * property value. For example, `{{%post}}` becomes `{{tbl_post}}`. */ - public $tablePrefix; + public $tablePrefix = 'tbl_'; /** * @var array mapping between PDO driver names and [[Schema]] classes. * The keys of the array are PDO driver names while the values the corresponding From fba0e0436578ae24f4cbfde446eb13cf7f1a1d35 Mon Sep 17 00:00:00 2001 From: Alexander Kochetov Date: Thu, 9 Jan 2014 07:47:39 +0400 Subject: [PATCH 03/10] ActiveRecord::tableName() comment fixed --- framework/yii/db/ActiveRecord.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/framework/yii/db/ActiveRecord.php b/framework/yii/db/ActiveRecord.php index 960e1fb..aec4407 100644 --- a/framework/yii/db/ActiveRecord.php +++ b/framework/yii/db/ActiveRecord.php @@ -177,8 +177,9 @@ class ActiveRecord extends BaseActiveRecord /** * Declares the name of the database table associated with this AR class. * By default this method returns the class name as the table name by calling [[Inflector::camel2id()]] - * with prefix 'tbl_'. For example, 'Customer' becomes 'tbl_customer', and 'OrderItem' becomes - * 'tbl_order_item'. You may override this method if the table is not named after this convention. + * with prefix [[DbConnection::tablePrefix]]. For example if [[DbConnection::tablePrefix]] is 'tbl_', + * 'Customer' becomes 'tbl_customer', and 'OrderItem' becomes 'tbl_order_item'. You may override this method + * if the table is not named after this convention. * @return string the table name */ public static function tableName() From f4becf376c5d7398db5f9286552be9f4ddc01690 Mon Sep 17 00:00:00 2001 From: Alexander Kochetov Date: Thu, 9 Jan 2014 07:59:07 +0400 Subject: [PATCH 04/10] \yii\caching\DbCache updated --- framework/yii/caching/DbCache.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/yii/caching/DbCache.php b/framework/yii/caching/DbCache.php index cca2c55..76e2341 100644 --- a/framework/yii/caching/DbCache.php +++ b/framework/yii/caching/DbCache.php @@ -63,7 +63,7 @@ class DbCache extends Cache * When using DbCache in a production server, we recommend you create a DB index for the 'expire' * column in the cache table to improve the performance. */ - public $cacheTable = 'tbl_cache'; + public $cacheTable = '{{%cache}}'; /** * @var integer the probability (parts per million) that garbage collection (GC) should be performed * when storing a piece of data in the cache. Defaults to 100, meaning 0.01% chance. From a1deac81c36a4561775e05f3e30da159fae1b0e0 Mon Sep 17 00:00:00 2001 From: Alexander Kochetov Date: Thu, 9 Jan 2014 08:01:08 +0400 Subject: [PATCH 05/10] \yii\db\ActiveRecord updated --- framework/yii/db/ActiveRecord.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/yii/db/ActiveRecord.php b/framework/yii/db/ActiveRecord.php index aec4407..28454b6 100644 --- a/framework/yii/db/ActiveRecord.php +++ b/framework/yii/db/ActiveRecord.php @@ -184,7 +184,7 @@ class ActiveRecord extends BaseActiveRecord */ public static function tableName() { - return static::getDb()->tablePrefix . Inflector::camel2id(StringHelper::basename(get_called_class()), '_'); + return '{{%' . Inflector::camel2id(StringHelper::basename(get_called_class()), '_') . '}}'; } /** From 995a922b01b775e9a922ad6a9ea0fd93aeeefb12 Mon Sep 17 00:00:00 2001 From: Alexander Kochetov Date: Thu, 9 Jan 2014 08:03:02 +0400 Subject: [PATCH 06/10] \yii\console\controllers\MigrateController updated --- framework/yii/console/controllers/MigrateController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/yii/console/controllers/MigrateController.php b/framework/yii/console/controllers/MigrateController.php index 5651b9c..5730bbd 100644 --- a/framework/yii/console/controllers/MigrateController.php +++ b/framework/yii/console/controllers/MigrateController.php @@ -73,7 +73,7 @@ class MigrateController extends Controller /** * @var string the name of the table for keeping applied migration information. */ - public $migrationTable = 'tbl_migration'; + public $migrationTable = '{{%migration}}'; /** * @var string the template file for generating new migrations. * This can be either a path alias (e.g. "@app/migrations/template.php") From c198f54578fc982e7e9f2ee77f700892bbab9f70 Mon Sep 17 00:00:00 2001 From: Alexander Kochetov Date: Thu, 9 Jan 2014 08:05:00 +0400 Subject: [PATCH 07/10] \yii\i18n\DbMessageSource updated --- framework/yii/i18n/DbMessageSource.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/yii/i18n/DbMessageSource.php b/framework/yii/i18n/DbMessageSource.php index b660a86..9d43727 100644 --- a/framework/yii/i18n/DbMessageSource.php +++ b/framework/yii/i18n/DbMessageSource.php @@ -68,11 +68,11 @@ class DbMessageSource extends MessageSource /** * @var string the name of the source message table. */ - public $sourceMessageTable = 'tbl_source_message'; + public $sourceMessageTable = '{{%source_message}}'; /** * @var string the name of the translated message table. */ - public $messageTable = 'tbl_message'; + public $messageTable = '{{%message}}'; /** * @var integer the time in seconds that the messages can remain valid in cache. * Use 0 to indicate that the cached data will never expire. From 5b67c70665f2306dccb6d61c865edee3665a6ea2 Mon Sep 17 00:00:00 2001 From: Alexander Kochetov Date: Thu, 9 Jan 2014 08:06:05 +0400 Subject: [PATCH 08/10] \yii\log\DbTarget updated --- framework/yii/log/DbTarget.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/yii/log/DbTarget.php b/framework/yii/log/DbTarget.php index b649e9e..59eedc6 100644 --- a/framework/yii/log/DbTarget.php +++ b/framework/yii/log/DbTarget.php @@ -52,7 +52,7 @@ class DbTarget extends Target * of some queries about message levels and categories. Depending on your actual needs, you may * want to create additional indexes (e.g. index on `log_time`). */ - public $logTable = 'tbl_log'; + public $logTable = '{{%log}}'; /** * Initializes the DbTarget component. From 5c1a2ccbfaa96ed88420237c0f40e62397d4832e Mon Sep 17 00:00:00 2001 From: Alexander Kochetov Date: Thu, 9 Jan 2014 08:06:59 +0400 Subject: [PATCH 09/10] \yii\rbac\DbManager updated --- framework/yii/rbac/DbManager.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/framework/yii/rbac/DbManager.php b/framework/yii/rbac/DbManager.php index e9e1730..2e47e50 100644 --- a/framework/yii/rbac/DbManager.php +++ b/framework/yii/rbac/DbManager.php @@ -41,15 +41,15 @@ class DbManager extends Manager /** * @var string the name of the table storing authorization items. Defaults to 'tbl_auth_item'. */ - public $itemTable = 'tbl_auth_item'; + public $itemTable = '{{%auth_item}}'; /** * @var string the name of the table storing authorization item hierarchy. Defaults to 'tbl_auth_item_child'. */ - public $itemChildTable = 'tbl_auth_item_child'; + public $itemChildTable = '{{%auth_item_child}'; /** * @var string the name of the table storing authorization item assignments. Defaults to 'tbl_auth_assignment'. */ - public $assignmentTable = 'tbl_auth_assignment'; + public $assignmentTable = '{{%auth_assignment}}'; private $_usingSqlite; From ecf7942aa43f7c094664fb6194b402832551d5d0 Mon Sep 17 00:00:00 2001 From: Alexander Kochetov Date: Thu, 9 Jan 2014 08:07:42 +0400 Subject: [PATCH 10/10] \yii\web\DbSession updated --- framework/yii/web/DbSession.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/yii/web/DbSession.php b/framework/yii/web/DbSession.php index 48878b4..2b0b0e7 100644 --- a/framework/yii/web/DbSession.php +++ b/framework/yii/web/DbSession.php @@ -65,7 +65,7 @@ class DbSession extends Session * When using DbSession in a production server, we recommend you create a DB index for the 'expire' * column in the session table to improve the performance. */ - public $sessionTable = 'tbl_session'; + public $sessionTable = '{{%session}}'; /** * Initializes the DbSession component.