Commit 769b53c2 by Paul Klimov

Merge pull request #3925 from klimov-paul/3801-base-migrate-command

Enh #3801: Base class for `MigrateController`
parents 3aaffa1c d1781b59
......@@ -89,6 +89,7 @@ Yii Framework 2 Change Log
- Enh #3643: Improved Mime-Type detection by using the `mime.types` file from apache http project to dected mime types by file extension (cebe, pavel-voronin, trejder)
- Enh #3773: Added `FileValidator::mimeTypes` to support validating MIME types of files (Ragazzo)
- Enh #3774: Added `FileValidator::checkExtensionByMimeType` to support validating file types against file mime-types (Ragazzo)
- Enh #3801: Base migration controller `yii\console\controllers\BaseMigrateController` extracted (klimov-paul)
- Enh: Added support for using sub-queries when building a DB query with `IN` condition (qiangxue)
- Enh: Supported adding a new response formatter without the need to reconfigure existing formatters (qiangxue)
- Enh: Added `yii\web\UrlManager::addRules()` to simplify adding new URL rules (qiangxue)
......
......@@ -8,6 +8,7 @@
namespace yii\db;
use yii\di\Instance;
use \yii\base\Component;
/**
* Migration is the base class for representing a database migration.
......@@ -35,7 +36,7 @@ use yii\di\Instance;
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class Migration extends \yii\base\Component
class Migration extends Component implements MigrationInterface
{
/**
* @var Connection|string the DB connection object or the application component ID of the DB connection
......
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace yii\db;
/**
* The MigrationInterface defines the minimum set of methods to be implemented by a database migration.
*
* Each migration class should provide the [[up()]] method containing the logic for "upgrading" the database
* and the [[down()]] method for the "downgrading" logic.
*
* @author Klimov Paul <klimov@zfort.com>
* @since 2.0
*/
interface MigrationInterface
{
/**
* This method contains the logic to be executed when applying this migration.
* @return boolean return a false value to indicate the migration fails
* and should not proceed further. All other return values mean the migration succeeds.
*/
public function up();
/**
* This method contains the logic to be executed when removing this migration.
* The default implementation throws an exception indicating the migration cannot be removed.
* @return boolean return a false value to indicate the migration fails
* and should not proceed further. All other return values mean the migration succeeds.
*/
public function down();
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment