I
I
Ivan2020-07-23 09:47:11
Database migration
Ivan, 2020-07-23 09:47:11

How to create a migration of an old database to a new one (Laravel)?

Good afternoon. I am migrating an old database to a new one, a site on Laravel. The idea is something like this: the old database is deployed, a connection to it is created in the .env file. A seeder has been created, in which the migration actually takes place. But there remains one difficulty that has not yet been overcome. The old database has a salary field. Everything you want is there: 5000, >1000, <5000, from 1000, 1000 - 3000. Something like this is written there. And in the new database it is divided into salary_from i salary_to. And this old data needs to be properly divided and transferred. If there is one number, then this is salary_to, if something like 1000 -3000, then salary_from = 1000, salary_to = 3000. How to do this? There is an idea that it is necessary to write regular expressions, but something does not work out ...

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question