D
D
Donald_Duck2018-01-30 13:27:58
Database migration
Donald_Duck, 2018-01-30 13:27:58

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

2 answer(s)
J
JhaoDa, 2018-01-30
@Donald_Duck

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.

R
Roman Frank, 2018-01-30
@Akellacom

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 question

Ask a Question

731 491 924 answers to any question