octicon-rss(16/)
You've already forked yii2
mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-10 02:13:17 +08:00
Merge pull request #9518 from pana1990/patch
Fix code style and delete declaration of yii\db\Schema [skip ci]
This commit is contained in:
octicon-git-branch(16/)
octicon-tag(16/)
octicon-diff(16/tw-mr-1) 1 changed files with 42 additions and 32 deletions
@@ -65,20 +65,32 @@ a migration class `m150101_185401_create_news_table` with the skeleton code:
|
||||
```php
|
||||
<?php
|
||||
|
||||
use yii\db\Schema;
|
||||
use yii\db\Migration;
|
||||
|
||||
class m150101_185401_create_news_table extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
echo "m101129_185401_create_news_table cannot be reverted.\n";
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
// Use safeUp/safeDown to run migration code within a transaction
|
||||
public function safeUp()
|
||||
{
|
||||
}
|
||||
|
||||
public function safeDown()
|
||||
{
|
||||
}
|
||||
*/
|
||||
}
|
||||
```
|
||||
|
||||
@@ -114,7 +126,6 @@ class m150101_185401_create_news_table extends Migration
|
||||
{
|
||||
$this->dropTable('news');
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
@@ -147,7 +158,6 @@ could be written like the following:
|
||||
```php
|
||||
<?php
|
||||
|
||||
use yii\db\Schema;
|
||||
use yii\db\Migration;
|
||||
|
||||
class m150101_185401_create_news_table extends Migration
|
||||
@@ -165,7 +175,6 @@ class m150101_185401_create_news_table extends Migration
|
||||
{
|
||||
$this->dropTable('news');
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
@@ -185,8 +194,8 @@ As a result, if any operation in these methods fails, all prior operations will
|
||||
In the following example, besides creating the `news` table we also insert an initial row into this table.
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
use yii\db\Schema;
|
||||
use yii\db\Migration;
|
||||
|
||||
class m150101_185401_create_news_table extends Migration
|
||||
@@ -449,7 +458,8 @@ database. To achieve this goal, when implementing a migration class you should e
|
||||
ID that the migration would use, like the following:
|
||||
|
||||
```php
|
||||
use yii\db\Schema;
|
||||
<?php
|
||||
|
||||
use yii\db\Migration;
|
||||
|
||||
class m150101_185401_create_news_table extends Migration
|
||||
|
||||
Reference in New Issue
Block a user