命令“db:seed”在托管时不起作用
Rather works, but it is not accurate. I created many migrations on the local server and debugged them by
php artisan migrate
and
php artisan migrate:reset
.
Everything works, no problem. Next, I created classes to fill the tables in the seeds folder. And, consequently, I tested the script for loading data into the database:
php artisan db:seed
.
Here, too, everything works fine, the site after these tests is displayed as before. Next, I upload all these changes to the hosting. I note that up to this point this project was already on hosting, but I imported the database there using MySQL. And there it was also displayed perfectly. And now I wanted to test the migration and filling the initial data on the host server. All this is done, of course, by SSH. And what is surprising
php artisan migrate
and
php artisan migrate:reset
work on the hosting correctly, the tables are deleted and created without errors. And when i try to run
php artisan db:seed
The first class in the list of the run() method of the DatabaseSeeder class does not already see the script and I get this error:
Class UsersTableSeeder does not exist
And all other classes are also out of range.
相反有效,但不准确。 我在本地服务器上创建了许多迁移并通过 p>
和 p> \进行了调试 n
一切正常,没问题。 接下来,我创建了类来填充 seeds strong>文件夹中的表。 因此,我测试了将数据加载到数据库中的脚本: p>
在这里,一切正常,这些测试后的网站也像以前一样显示。 接下来,我将所有这些更改上传到托管。 我注意到到目前为止这个项目已经在托管,但我使用MySQL在那里导入了数据库。 它也显示完美。 现在我想测试迁移并在主机服务器上填充初始数据。 当然,这一切都是通过SSH完成的。 令人惊讶的是 p>
和 p>
正确处理托管,删除并创建表没有错误。 当我尝试运行时 p>
列表中的第一个类 DatabaseSeeder strong>类的> run() strong>方法尚未看到该脚本,我收到此错误: p>
所有其他类也超出范围。 p>
div> php artisan migrate code> p>
php artisan migrate:reset code>。 p>
php artisan db:seed code>。 p>
php artisan migrate code> p>
php artisan migrate:reset code> p>
php artisan db:seed code> p>
Class UsersTableSeeder不 存在 code> p>
You likely have an old autoload
file prior to uploading the new code. Try php artisan cache:clear
and composer dumpautoload
. If those fail, delete the contents of the bootstrap/cache
directory and rerun those two commands.