laravel-countries icon indicating copy to clipboard operation
laravel-countries copied to clipboard

Region África not found

Open sumannath opened this issue 1 year ago • 9 comments

Using composer to install and then running migrate:refresh --seed, I get the following error:

` Region África not found

at vendor/lwwcas/laravel-countries/src/database/seeders/Builder.php:87 83▕ ->first(); 84▕ 85▕ if ($response == null) { 86▕ DB::rollBack(); ➜ 87▕ throw new Exception('Region ' . $region . ' not found'); 88▕ } 89▕ 90▕ CountryRegionTranslation::create([ 91▕ 'lc_region_id' => $response->id,

  +27 vendor frames 

28 database/seeders/DatabaseSeeder.php:16 Illuminate\Database\Seeder::call() +34 vendor frames

63 artisan:35 Illuminate\Foundation\Console\Kernel::handle()`

sumannath avatar Jul 31 '23 20:07 sumannath

@sumannath I'm also experiencing this issue, but it seems it occurs with PostgreSQL and not MySQL.

amharris avatar Aug 03 '23 08:08 amharris

I can confirm that running the seeder in MySQL (and MariaDB) seems to work fine but running it in SQLite (I use it for testing) throws the same exception.

elcapo avatar Aug 30 '23 19:08 elcapo

According to the documentation about updating JSON columns:

This operation is supported on MySQL 5.7+ and PostgreSQL 9.5+

In other words, it's apparently a known limitation.

elcapo avatar Aug 30 '23 20:08 elcapo

@amharris Are you using PostgreSQL 9.5 or greater? If not, you may consider upgrading to solve this issue.

elcapo avatar Aug 30 '23 20:08 elcapo

@elcapo It's PostgreSQL 15, which is included in Laravel Sail (both the 8.1 and 8.2 Dockerfiles, (but even the 8.0 Dockerfile includes PostgreSQL 13)). It would be good to ensure compatibility what comes out-of-the-box with Sail, given this package is for Laravel.

amharris avatar Aug 31 '23 07:08 amharris

same error pgsql 16

Lwwcas\LaravelCountries\Database\Seeders\LanguagesSeeder ........................................................... RUNNING  
 Lwwcas\LaravelCountries\Database\Seeders\Languages\PortugueseLanguageSeeder ........................................ RUNNING  

  Exception 

 Region África not found

 at vendor/lwwcas/laravel-countries/src/database/seeders/Builder.php:87
    83▕                 ->first();
    84▕ 
    85▕             if ($response == null) {
    86▕                 DB::rollBack();
 ➜  87▕                 throw new Exception('Region ' . $region . ' not found');
    88▕             }
    89▕ 
    90▕             CountryRegionTranslation::create([
    91▕                 'lc_region_id' => $response->id,

     +27 vendor frames 

 28  database/seeders/DatabaseSeeder.php:15
     Illuminate\Database\Seeder::call()
     +22 vendor frames 

 51  artisan:35
     Illuminate\Foundation\Console\Kernel::handle()

rolandverner avatar Feb 05 '24 10:02 rolandverner

Any news? I have same with Postgre

adilbekes avatar May 19 '24 11:05 adilbekes

@adilbekes The issue still persists with Postgres.

amharris avatar May 19 '24 15:05 amharris

I have same issue using postgres 16 with laravel 11.

It seems the problem came from portugues Language seeder. Is there a way to ignore this language to make seeder work?

sanjarani avatar Jun 10 '24 17:06 sanjarani