php yii migrate
unclrd opened this issue · 1 comments
hi!
trying to setup ig-monitoring on my server… after running: php yii migrate
i am getting an error:
*** applying m180628_113634_add_user_id_column_to_account_tag_table
> drop primary key PRIMARY ... done (time: 0.351s)
> add column user_id integer to table account_tag ... done (time: 0.201s)
> add foreign key fk_account_tag_user: account_tag (user_id) references user (id) ... done (time: 0.299s)
> execute SQL: INSERT INTO account_tag (user_id
, account_id
, tag_id
, created_at
) SELECT user
.id, account_id
, tag_id
, account_tag
.created_at
FROM user
, account_tag
... done (time: 0.001s)
> delete from account_tag ... done (time: 0.000s)
> add primary key idx_primary on account_tag (account_id,tag_id,user_id) ...Exception: SQLSTATE[HY000]: General error: 1832 Cannot change column 'user_id': used in a foreign key constraint 'fk_account_tag_user'
The SQL being executed was: ALTER TABLE account_tag
ADD CONSTRAINT idx_primary
PRIMARY KEY (account_id
, tag_id
, user_id
) (/home/../ig-monitoring/vendor/yiisoft/yii2/db/Schema.php:664)
#0 /home/../ig-monitoring/vendor/yiisoft/yii2/db/Command.php(1295): yii\db\Schema->convertException(Object(PDOException), 'ALTER TABLE ac...') #1 /home/../ig-monitoring/vendor/yiisoft/yii2/db/Command.php(1091): yii\db\Command->internalExecute('ALTER TABLE
ac...')
#2 /home/../ig-monitoring/vendor/yiisoft/yii2/db/Migration.php(437): yii\db\Command->execute()
#3 /home/../ig-monitoring/migrations/m180628_113634_add_user_id_column_to_account_tag_table.php(20): yii\db\Migration->addPrimaryKey('idx_primary', 'account_tag', Array)
#4 /home/../ig-monitoring/vendor/yiisoft/yii2/db/Migration.php(114): m180628_113634_add_user_id_column_to_account_tag_table->safeUp()
#5 /home/../ig-monitoring/vendor/yiisoft/yii2/console/controllers/BaseMigrateController.php(725): yii\db\Migration->up()
#6 /home/../ig-monitoring/vendor/yiisoft/yii2/console/controllers/BaseMigrateController.php(199): yii\console\controllers\BaseMigrateController->migrateUp('m180628_113634_...')
#7 [internal function]: yii\console\controllers\BaseMigrateController->actionUp(0)
#8 /home/../ig-monitoring/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#9 /home/../ig-monitoring/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#10 /home/../ig-monitoring/vendor/yiisoft/yii2/console/Controller.php(148): yii\base\Controller->runAction('', Array)
#11 /home/../ig-monitoring/vendor/yiisoft/yii2/base/Module.php(528): yii\console\Controller->runAction('', Array)
#12 /home/../ig-monitoring/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('migrate', Array)
#13 /home/../ig-monitoring/vendor/yiisoft/yii2/console/Application.php(147): yii\console\Application->runAction('migrate', Array)
#14 /home/../ig-monitoring/vendor/yiisoft/yii2/base/Application.php(386): yii\console\Application->handleRequest(Object(yii\console\Request))
#15 /home/../ig-monitoring/yii(19): yii\base\Application->run()
#16 {main}
*** failed to apply m180628_113634_add_user_id_column_to_account_tag_table (time: 0.868s)
41 from 62 migrations were applied.
Migration failed. The rest of the migrations are canceled.
wrong version of mysql…