Closed salleh closed 3 years ago
When running initial installation php console/yii app/setup
php console/yii app/setup
the migration script m150725_192740_seed_data will fail with error:
> insert into {{%user_profile}} ...Exception: Undefined index: constraint_name.
> insert into {{%user_profile}} ...Exception: Undefined index: constraint_name
The following addition to db config should prevent this error:
'db' => [ 'attributes' => [PDO::ATTR_CASE => PDO::CASE_LOWER], ],
in this case, I changed the file @root_folder/common/config/base.php to have the following db configuration:
'db' => [ 'class' => yii\db\Connection::class, 'dsn' => env('DB_DSN'), 'username' => env('DB_USERNAME'), 'password' => env('DB_PASSWORD'), 'tablePrefix' => env('DB_TABLE_PREFIX'), 'charset' => env('DB_CHARSET', 'utf8'), 'enableSchemaCache' => YII_ENV_PROD, 'attributes' => [PDO::ATTR_CASE => PDO::CASE_LOWER], ],
Run composer update before running migrations
I could not replicate this issue using MySQL 8.0.22. Are you sure you are up to date with the package dependencies from composer?
When running initial installation
php console/yii app/setup
the migration script m150725_192740_seed_data will fail with error:
> insert into {{%user_profile}} ...Exception: Undefined index: constraint_name
.The following addition to db config should prevent this error:
in this case, I changed the file @root_folder/common/config/base.php to have the following db configuration: