MigrationInterface
API reference › yii › db › MigrationInterface
Implemented by 1 type
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.
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
down() abstract | This method contains the logic to be executed when removing this migration. | MigrationInterface |
up() abstract | This method contains the logic to be executed when applying this migration. | MigrationInterface |
Method details
Section titled “Method details”down()
Section titled “down() ”abstract public function down(): boolThis method contains the logic to be executed when removing this migration.
The default implementation throws an exception indicating the migration cannot be removed.
Returns
bool: Return a false value to indicate the migration fails and should not proceed further. All other return values mean the migration succeeds.
abstract public function up(): boolThis method contains the logic to be executed when applying this migration.
Returns
bool: Return a false value to indicate the migration fails and should not proceed further. All other return values mean the migration succeeds.