yii\db\Migration::up PHP Method

up() public method

Child classes may override this method to provide actual migration logic.
public up ( ) : boolean
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()
    {
        $transaction = $this->db->beginTransaction();
        try {
            if ($this->safeUp() === false) {
                $transaction->rollBack();
                return false;
            }
            $transaction->commit();
        } catch (\Exception $e) {
            echo 'Exception: ' . $e->getMessage() . ' (' . $e->getFile() . ':' . $e->getLine() . ")\n";
            echo $e->getTraceAsString() . "\n";
            $transaction->rollBack();
            return false;
        }
        return null;
    }

Usage Example

 public function up()
 {
     $this->execute('ALTER TABLE {{map}} ADD COLUMN [[area]] INTEGER');
     parent::up();
 }