php - SQLite does not create an index -


i working on database migrations in laravel 5.4. migrations work fine mysql database, testing want use sqlite migration fails. here's code

public function up()     {         schema::create('mapped_venues', function (blueprint $table) {             $table->increments('id');             $table->unsignedinteger('upload_job_id')->nullable();             $table->string('venue')->default('');             $table->unsignedinteger('venue_id')->nullable();              $table->timestamps();              $table->index(['venue']);         });          schema::create('mapped_teams', function (blueprint $table) {             $table->increments('id');             $table->unsignedinteger('upload_job_id')->nullable();             $table->string('team')->default('');             $table->unsignedinteger('team_id')->nullable();              $table->timestamps();              $table->index(['team']);         });     } 

when run php artisan migrate index on mapped_teams.team column not created, 1 on mapped_venues.venue is!!

$ sqlite3 database/database.sqlite  sqlite version 3.19.3 2017-06-08 14:26:16 enter ".help" usage hints. sqlite> .indexes mapped_teams sqlite> .indexes mapped_venues mapped_venues_venue_index sqlite> 

i have tried create indexes on separate call

schema::table('mapped_venues', function (blueprint $table) {             $table->index(['venue']);         }); schema::table('mapped_teams', function (blueprint $table) {             $table->index(['team']);         }); 

but result same. interestingly though, when (by mistake) left creation of index $table->index['team']) inside call create table (so, have 2 calls create index) error index mapped_teams_team_index exists.

i using:

  • laravel 5.4.36
  • doctrine dbal 2.6.2
  • sqlite 3.19.3

it seems have small mistake when calling index function (used array instead of function):

    $table->index['venue']; 

should be:

    $table->index('venue'); 

Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -