Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

MaxTenco's avatar

How to update data in a production database?

What's the best solution to update data in a production database? For example: I have a table "Categories", I want to insert the new records after the deploy in production with Forge. How I can this? Thanks

0 likes
8 replies
sr57's avatar

First you have to know (application specific) that your update will not change st bad ...

That said, let's assume that add a category is not a sensible update you can :

  1. quickest way (test) : directly insert in the db

  2. better way ie laravel one shot way (app updated) : write et run a seeder

  3. if can/must be done by user : :write a form

MaxTenco's avatar

I don't think using a seeder is a good solution. Imagine to update a row in the database, is it correct to use a seeder? Is there something like migration system to insert and update rows in production?

sr57's avatar

Your question was about to insert a record :-), for this you have to use a seeder

If you want to add a field (or do other change in the db structure), use migration of course.

MaxTenco's avatar

So is it okay to use the seeder to make updates of rows?

sr57's avatar

Hello @maxtenco , what are you afraid of?

Same answer as my first one : YES

If you are not comfortable to do this for the first time in prod, try it on a app test in prod, and always have your an updated backup.

1 like

Please or to participate in this conversation.