Closed abbasmashaddy72 closed 2 weeks ago
The prepare()
call is Eloquent trying to prepare a SQL query on a table that doesn't exist.
If you are going to use Database caching, you must first create a database-migration file for the database cache table. (And name its filename so that it runs before the permissions migration runs.)
That would fix the seeder issue too, because the cache table would exist then.
See the Laravel documentation on prerequisites for database caching: https://laravel.com/docs/master/cache#prerequisites-database and/or github source code: https://github.com/laravel/framework/blob/11.x/src/Illuminate/Cache/Console/stubs/cache.stub
Hi, Got it working with some tweaks but don't remember the changes I made. But Now it is working fine. If someone is having the same issue, can tag me so that I can provide the correct process.
Description
When using the
database
cache store in Laravel, the following error occurs during migration and seeding operations related to the Spatie Laravel Permission package:This error occurs specifically at the following lines in the code:
Line From Database Migration:
and
Line from Custom Seeder:
Additional Context
This issue does not occur when the cache store is set to
file
. Changing the cache store tofile
and re-running the migrations and seeding works flawlessly.Steps To Reproduce
Set the default cache store to
database
:config/cache.php
, set:Set the permission cache store to
default
:config/permission.php
, set:Run migrations and seeding:
Observe the error:
Example Application
No response
Version of spatie/laravel-permission package:
6.9
Version of laravel/framework package:
11.9
PHP version:
8.3
Database engine and version:
mariadb from 11.4.2-MariaDB, client 15.2 for Linux (x86_64) using readline 5.1
OS: Windows/Mac/Linux version:
Linux