G
G
GrimJack2017-07-05 15:57:24
ORM
GrimJack, 2017-07-05 15:57:24

How to run migration with data transfer process?

There is an application written in laravel
Now it was handed over to me with a database optimization question
. In this case, the problem is with users.
I need to create a migration that will create tables and start the transfer process
. The whole problem is in starting this process. There is an incredibly large amount of data and you need to somehow transfer it with a split into two tables.
That is, there is a so-called. a controller that will pull data from one table, process it and enter it into others. What is the best way to make such a migration so as not to put the server?
So far, two crutches come to mind - to make the script run indefinitely (for the duration of the migration) or to use queues. But I think there are better practices.
How to do it more elegantly?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
JhaoDa, 2017-07-05
@GrimJack

Make a console command that will run the migration and then perform the transfer.
Or call this console command from the migration, whichever you prefer.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question