Skip to content

Commit 406fac5

Browse files
author
igor-chepurnoi
committed
rename table 'User' to 'user'
1 parent 3e842e2 commit 406fac5

File tree

4 files changed

+30
-5
lines changed

4 files changed

+30
-5
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
use app\components\Migration;
4+
5+
class m161109_112016_rename_user_table extends Migration
6+
{
7+
public function up()
8+
{
9+
$this->renameTable('{{%User}}', '{{%user}}');
10+
}
11+
12+
public function down()
13+
{
14+
$this->renameTable('{{%user}}', '{{%User}}');
15+
}
16+
17+
/*
18+
// Use safeUp/safeDown to run migration code within a transaction
19+
public function safeUp()
20+
{
21+
}
22+
23+
public function safeDown()
24+
{
25+
}
26+
*/
27+
}

models/BaseUserModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class BaseUserModel extends ActiveRecord implements IdentityInterface
4040
*/
4141
public static function tableName()
4242
{
43-
return '{{%User}}';
43+
return '{{%user}}';
4444
}
4545

4646
/**

tests/TestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ protected function setupTestDbData()
106106

107107
// Structure :
108108

109-
$db->createCommand()->createTable('User', [
109+
$db->createCommand()->createTable('user', [
110110
'id' => 'pk',
111111
'username' => 'string not null unique',
112112
'authKey' => 'string(32) not null',
@@ -121,7 +121,7 @@ protected function setupTestDbData()
121121

122122
// Data :
123123

124-
$db->createCommand()->insert('User', [
124+
$db->createCommand()->insert('user', [
125125
'username' => 'demo',
126126
'authKey' => Yii::$app->getSecurity()->generateRandomString(),
127127
'passwordHash' => Yii::$app->getSecurity()->generatePasswordHash('password'),

tests/forms/SignupFormTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
namespace yii2mod\user\tests\forms;
44

5-
use Yii;
65
use yii2mod\user\models\BaseUserModel;
7-
use yii2mod\user\models\LoginForm;
86
use yii2mod\user\models\SignupForm;
97
use yii2mod\user\tests\TestCase;
108

0 commit comments

Comments
 (0)