Answer the question
In order to leave comments, you need to log in
Is it worth changing records in the database with a migration?
Hello! In general, there are a number of tables in which the data may need to be changed (once every five years), or it may never be needed. As far as I understand, migrations should change the structure of the database, and not its data. Seeders should deal with the data, but it is convenient to use them during the initial loading of data into the database, this is what they are basically doing now. But in production, when the project is being supported, and not its initial launch, it is no longer convenient for seeders to manipulate the data in the database. From here, in fact, the question arose: is it worth changing the records in the database by migration, or am I misunderstanding something, and I have the wrong approach? Put me on the right path :) Thanks in advance!
Answer the question
In order to leave comments, you need to log in
To initially fill the project with some kind of system data, you should use migrations or console commands, but not seeders that were invented for tests.
For further changes to any data that is not subject to change from any kind of admin panel, you should use all the same migrations or console commands.
As you were told above, use migrations for filling - they can be rolled back or corrected.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question