I added a new table in migration in file 2018_02_08_094356_create_currency_table.php..
And this is the code:
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCurrencyTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('currency', function (Blueprint $table) {
$table->increments('id');
$table->decimal('usdeur', 15, 2);
$table->decimal('usdchf', 15, 2);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('currency');
}
}
When I run php artisan migrate, there is only default laravel users (and migration) table in my DB. No currency one.
What could be the reason?
EDIT
Everything was fine with migrations. The problem was this:
[Illuminate\Database\QueryException] SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes (SQL: alter table users add unique users_email_unique(email))
[PDOException] SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes
Solution is to add this in AppServiceProvider.php
public function boot()
{
Schema::defaultStringLength(191);
}
Source: https://laravel-news.com/laravel-5-4-key-too-long-error
php artisan migrate:freshfirst. Sounds like you have migration records in the db. This will drop all your tables so be warned.