phinx.php文件
<?php
require_once __DIR__ . '/vendor/autoload.php';
use Dotenv\Dotenv;
Dotenv::createImmutable(base_path())->load();
return [
'paths' => [
'migrations' => 'database/migrations',
'seeds' => 'database/seeds',
],
'environments' => [
'default_migration_table' => 'phinxlog',
'default_environment' => 'development',
'production' => [
'adapter' => 'mysql',
'host' => env('DB_HOST'),
'name' => env('DB_NAME'),
'user' => env('DB_USER'),
'pass' => env('DB_PASSWORD'),
'port' => env('DB_PORT'),
'charset' => 'utf8mb4',
],
'development' => [
'adapter' => 'mysql',
'host' => env('DB_HOST'),
'name' => env('DB_NAME'),
'user' => env('DB_USER'),
'pass' => env('DB_PASSWORD'),
'port' => env('DB_PORT'),
'charset' => 'utf8mb4',
],
'testing' => [
'adapter' => 'mysql',
'host' => env('DB_HOST'),
'name' => env('DB_NAME'),
'user' => env('DB_USER'),
'pass' => env('DB_PASSWORD'),
'port' => env('DB_PORT'),
'charset' => 'utf8mb4',
]
],
'version_order' => 'creation'
];
php vendor/bin/phinx migrate -e development
我也遇到这个问题,不过加上参数-t 或者指定文件就可以成功执行,不知道为什么