我现在创建了一个没有任何迁移的新 Lumen 项目。由于我正在设置 CI,因此我希望始终运行php artisan migrate
以防在某些时候添加迁移。
这是我的 CI 服务器的 .env 文件:
APP_ENV=testing
APP_DEBUG=true
APP_KEY=base64:ROhueDv4THITTXXfOO14HsMNO/Po5hx1eQndrbt12cA=
APP_URL=http://jarvis-testing.easybell.de
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=jarvis_test
DB_USERNAME=dev
DB_PASSWORD=dev
CACHE_DRIVER=file
这是我的database.php
文件:
<?php
return [
'default' => 'mysql',
'connections' => [
'mysql' => [
'driver' => 'mysql',
'host' => env( 'DB_HOST' ),
'port' => env( 'DB_PORT' ),
'database' => env( 'DB_DATABASE' ),
'username' => env( 'DB_USERNAME' ),
'password' => env( 'DB_PASSWORD' ),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
]
]
];
当我运行时php artisan migrate
,我收到以下错误:
In Connection.php line 664:
SQLSTATE[42000]: Syntax error or access violation: 1103 Incorrect table name '' (SQL: create table `` (`id` int unsigned not null auto_increment primary key, `migration` varchar(255) not null, `batch` int not null) default character set utf8 collate utf8_unicode_ci)
In Connection.php line 452:
SQLSTATE[42000]: Syntax error or access violation: 1103 Incorrect table name ''
运行php artisan migrate:status
时,输出为:
No migrations found.
所以从我的角度来看,Lumen 在这一点上不应该做任何事情。我在这里想念什么?