My own stupid fault. The UserSeeder was using DB::table('Users')->insert(...), rather than populating it from the User class. Changing it to use DB::table('users')->insert(...).
Table not found when seeding a database in Laravel Vapor
I am trying to seed my database which is hosted in Laravel Vapor. The environment is using an RDS database.
The database has the default authorisation table, vapor.users. Authorisation operates perfectly for register, login and throughout the application.
I just tried seeding the database from the Vapor command interface using php artisan db:seed. This works find on my local environment, using MySQL, but failed on Vapor with:
Seeding: UserSeeder
Illuminate\Database\QueryException : SQLSTATE[42S02]: Base table or view not found: 1146 Table 'vapor.Users' doesn't exist (SQL: insert into `Users` (`name`, `email`, `email_verified_at`, `password`, `last_read_announcements_at`) values (Test User 01, [email protected], 2020-04-04 09:06:48, xxxxxx, 2020-04-04 09:06:48))
at /var/task/vendor/laravel/framework/src/Illuminate/Database/Connection.php:669
665| // If an exception occurs when attempting to run a query, we'll format the error
666| // message to include the bindings with SQL, which will make this exception a
667| // lot more helpful to the developer instead of just the database's errors.
668| catch (Exception $e) {
> 669| throw new QueryException(
670| $query, $this->prepareBindings($bindings), $e
671| );
672| }
673|
Exception trace:
1 Doctrine\DBAL\Driver\PDOException::("SQLSTATE[42S02]: Base table or view not found: 1146 Table 'vapor.Users' doesn't exist")
/var/task/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:63
2 PDOException::("SQLSTATE[42S02]: Base table or view not found: 1146 Table 'vapor.Users' doesn't exist")
/var/task/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:61
It would appear that the table name is case sensitive in RDS, and the seeding is attempting to access vapor.Users instead of vapor.users.
Any ideas how to overcome this?
Please or to participate in this conversation.