mmaedler's avatar

Migration install fails

Hi there,

I'm trying migrations for the first time and I want to create the following table:

public function up()
    {
        Schema::connection('abo')->create('userlog', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('action', 255);
            $table->bigInteger('userid', false, true);
            $table->string('related_object', 255)->nullable();
            $table->string('field', 2048)->nullable();
            $table->string('value_old', 2048)->nullable();
            $table->string('value_new',2048)->nullable();
            $table->string('ipv4', 128)->nullable();
            $table->string('ipv6', 128)->nullable();

            $table->index('action');
            $table->index('userid');
        });
    }

However, when running artisan migrate:install I get the following error:

[Illuminate\Database\QueryException]                                                                                                                                                                                                   
  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)                                                                                                                                                                                                  
[PDOException]                                                                   
  SQLSTATE[42000]: Syntax error or access violation: 1103 Incorrect table name ''  

For me it looks like, that artisan fails to create the migrations table itself. Am I missing something here?

0 likes
1 reply
mmaedler's avatar
mmaedler
OP
Best Answer
Level 2

Stupid me — I had forgot to add the migrations table name to my config/database.php. Now it works like charm.

Please or to participate in this conversation.