Strange error with migrations

I built a DB using yii’s migration classes, which worked fine. Then I dropped the tables, and when i re-ran the migrations I got the following error for migration class m170728_170811_colony:

*** applying m170728_170811_colony

Exception ‘yii\base\UnknownMethodException’ with message ‘Calling unknown method: m170728_170811_colony::int()’

in C:\xampp\htdocs\jrweb\vendor\yiisoft\yii2\base\Component.php:290

The Stack trace is:

#0 C:\xampp\htdocs\jrweb\migrations\m170728_170811_colony.php(11): yii\base\Component->__call(‘int’, Array)

#1 C:\xampp\htdocs\jrweb\vendor\yiisoft\yii2\console\controllers\BaseMigrateController.php(671): m170728_170811_colony->Up()

#2 C:\xampp\htdocs\jrweb\vendor\yiisoft\yii2\console\controllers\BaseMigrateController.php(183): yii\console\controllers\BaseMigrateController->migrateUp(‘m170728_170811_…’)

#3 [internal function]: yii\console\controllers\BaseMigrateController->actionUp(0)

#4 C:\xampp\htdocs\jrweb\vendor\yiisoft\yii2\base\InlineAction.php(57): call_user_func_array(Array, Array)

#5 C:\xampp\htdocs\jrweb\vendor\yiisoft\yii2\base\Controller.php(156): yii\base\InlineAction->runWithParams(Array)

#6 C:\xampp\htdocs\jrweb\vendor\yiisoft\yii2\console\Controller.php(128): yii\base\Controller->runAction(’’, Array)

#7 C:\xampp\htdocs\jrweb\vendor\yiisoft\yii2\base\Module.php(523): yii\console\Controller->runAction(’’, Array)

#8 C:\xampp\htdocs\jrweb\vendor\yiisoft\yii2\console\Application.php(180): yii\base\Module->runAction(‘migrate’, Array)

#9 C:\xampp\htdocs\jrweb\vendor\yiisoft\yii2\console\Application.php(147): yii\console\Application->runAction(‘migrate’, Array)

#10 C:\xampp\htdocs\jrweb\vendor\yiisoft\yii2\base\Application.php(380): yii\console\Application->handleRequest(Object(yii\console\Request))

#11 C:\xampp\htdocs\jrweb\yii(20): yii\base\Application->run()

#12 {main}


When I tried to run one of the other previously working migration classes, I also got the same error for that class- does anyone have any idea why it would suddenly throw this error?


yii is complaining about a unknown method as it says in the exception, can you post your migration file here?

here is one of the migration files- again, they were all working and then the error just showed up after i dumped the tables and then tried to re-migrate them. I also did a pull to the test server and it is throwing the same error. I checked my version control log and since the migration file was last working, i don’t see any accidental file change with yii’s api, etc. … Thanks!

use yii\db\Migration;

class m170728_170811_colony extends Migration


public function Up()


 $this->createTable('colony', [

        'id' => $this->primaryKey(),

        'owner' => $this->int(11),

        'date_inserted' => $this->dateTime(),

        'date_expired' => $this->dateTime(),

        'note' => $this->string(2000),

        'source_company' => $this->smallInteger(3), 

        'source_hive' => $this->smallInteger(3), 

        'source_hive_type' => $this->smallInteger(3), // split/ swarm, mix, etc.

        'queen_breed' => $this->smallInteger(3),



public function Down()



    return false;



I see maybe you changed something or updated yii, make the following changes and it should work

'owner' => $this->int(11), 

// to

'owner' => $this->integer(11), 

You nailed it!! Now that i see the problem it is obvious, but I was so convinced that it was some major yii api issue that i just could not see it. Thanks again, you really helped me!!!!

no worries glad could help