Skip to content

Commit bd47bd0

Browse files
author
igor-chepurnoi
committed
rename table from 'Cms' to 'cms'
1 parent b599b62 commit bd47bd0

File tree

3 files changed

+31
-4
lines changed

3 files changed

+31
-4
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_105445_rename_cms_table extends Migration
6+
{
7+
public function up()
8+
{
9+
$this->renameTable('{{%Cms}}', '{{%cms}}');
10+
}
11+
12+
public function down()
13+
{
14+
$this->renameTable('{{%cms}}', '{{%Cms}}');
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/CmsModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class CmsModel extends ActiveRecord
2929
*/
3030
public static function tableName()
3131
{
32-
return '{{%Cms}}';
32+
return '{{%cms}}';
3333
}
3434

3535
/**

tests/TestCase.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ protected function setupTestDbData()
9898

9999
// Structure :
100100

101-
$db->createCommand()->createTable('Cms', [
101+
$db->createCommand()->createTable('cms', [
102102
'id' => 'pk',
103103
'url' => 'string not null',
104104
'title' => 'string not null',
@@ -114,7 +114,7 @@ protected function setupTestDbData()
114114

115115
// Data :
116116

117-
$db->createCommand()->insert('Cms', [
117+
$db->createCommand()->insert('cms', [
118118
'url' => 'about-us',
119119
'title' => 'about',
120120
'content' => 'test content',
@@ -125,7 +125,7 @@ protected function setupTestDbData()
125125
'updatedAt' => time(),
126126
])->execute();
127127

128-
$db->createCommand()->insert('Cms', [
128+
$db->createCommand()->insert('cms', [
129129
'url' => 'some-url',
130130
'title' => 'some title',
131131
'content' => 'My site name is {siteName}',

0 commit comments

Comments
 (0)