Reputation: 821
I created a new Lumen project without any migrations for now. Since I'm setting up CI, I'd like to always run php artisan migrate
just in case migrations are added at some point.
Here is my .env file for the CI server:
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
Here is my database.php
file:
<?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',
]
]
];
When I run php artisan migrate
, I get the following error:
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 ''
When running php artisan migrate:status
, the output is:
No migrations found.
So from my point of view, Lumen should just not do anything at this point. What am I missing here?
Upvotes: 0
Views: 575
Reputation: 518
In your migration file, you have to mention the table name in on function.
Example:
$table->foreign('user_id')->references('id')->on('')
->onUpdate('cascade')->onDelete('cascade');
above will show an error so we need to use table name in on function
$table->foreign('user_id')->references('id')->on('users')
->onUpdate('cascade')->onDelete('cascade');
Upvotes: 0