1

I've been trying to figure this out for almost 2 days now. So, I have a seeder like this:

class DatabaseSeeder extends Seeder
{
 /**
 * Seed the application's database.
 *
 * @return void
 */
 public function run()
 {
 $this->call([
 'RolesTableSeeder',
 'UserTableSeeder',
 'DevelopersTableSeeder',
 'ESRBRatingTableSeeder',
 'GameGenreTableSeeder',
 'ManufacturerTableSeeder',
 'PlatformsTableSeeder',
 'PublishersTableSeeder',
 'GamesTableSeeder',
 'CommunitiesTableSeeder'
 ]);
 }
}

However, when I run it using php artisan db:seed I get the following error:

Illuminate\Database\QueryException : SQLSTATE[22003]: Numeric value out of range: 1416 Cannot get geometry object from data you send to the GEOMETRY field (SQL: insert into `games` (`title`, `description`, `platform`, `ESRBRating`, `developer`, `publisher`, `genre`) values (Pokemon Sun, Pokemon Sun version for the Nintendo 3DS, 4, 1, 1, 1, 4))

I have determined that the issue being triggered in the GamesTableSeeder file, which looks like this:

public function run()
{
 $platform = Platform::where('name', '=', 'Nintendo 3DS')->first(); 
 $esrb = EsrbRating::where('rating', '=', 'E')->first(); 
 $dev = Developer::where('name', '=', 'GameFreak')->first(); 
 $pub = Publisher::where("name", "Nintendo")->first(); 
 $genre = GameGenre::where('genre', 'Role-Playing')->first(); 
 DB::table('games')->insert([
 'title' => 'Pokemon Sun',
 'description' => "Pokemon Sun version for the Nintendo 3DS",
 'release_date' => new Carbon(),
 'minimum_players' => 1,
 'maximum_players' => 4,
 'platform' => $platform->id,
 'ESRBRating' => $esrb->id,
 'developer' => $dev->id,
 'publisher' => $pub->id,
 'genre' => $genre->id,
 'created_at' => new Carbon()
 ]);
}

As you can see, this table has a few foreign keys that reference different tables. I have checked the results from other seeders to see if any of those were causing the error. But, they all seem to work.

I'd appreciate any assistance as this one tiny thing is already giving me a headache. And it's probably something ridiculously silly that is causing it that I am just not noticing.

Here is the migration(s) for the table.

Schema::create('games', function (Blueprint $table) {
 $table->increments('id');
 $table->string('title')->unique(); 
 $table->multilineString('description'); 
 $table->datetime('release_date')->nullable(); 
 $table->integer('minimum_players')->unsigned()->default(1); 
 $table->integer('maximum_players')->unsigned()->default(1); 
 $table->timestamps();
 $table->softDeletes(); 
 });

And here is where the foreign keys are added:

Schema::table('games', function(Blueprint $table){
 $table->integer('platform')->unsigned(); 
 $table->integer('ESRBRating')->unsigned(); 
 $table->integer('developer')->unsigned(); 
 $table->integer('publisher')->unsigned();
 $table->integer('genre')->unsigned(); 
 $table->foreign('platform')->references('id')->on('platforms'); 
 $table->foreign('ESRBRating')->references('id')->on('esrb_ratings'); 
 $table->foreign('developer')->references('id')->on('developers'); 
 $table->foreign('publisher')->references('id')->on('publishers'); 
 $table->foreign('genre')->references('id')->on('game_genres'); 
 }); 
asked May 9, 2018 at 4:05
2
  • would you add your migration of the table Commented May 9, 2018 at 4:09
  • I updated the original question to include the migrations for this table. Thanks for the help. Commented May 9, 2018 at 4:16

1 Answer 1

1

I think there is an issue with the field description datatype i.e. multilineString which is used to store the geometry points, not a string. Please update the description field as:

$table->text('description'); in games table schema. You may create a new migration for it as:

Schema::table('games', function (Blueprint $table) {
 $table->text('description')->change();
});

Run it and then run the seeder again.

answered May 9, 2018 at 5:10

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.