Generate migration file from existing database? |
Hello,
I watched a video on how to create database migrations from scratch, which is very handy. But the thought of creating many large tables from scratch at the beginning of a project sounds extremely tedious and a huge waste of time, when I can fly through them in Navicat. Or in most cases am starting with pre-existing tables and data from previous projects. What is the command to generate the initial migration file from an existing database already FULL of tables and data? Thanks! -Sergio (11-25-2020, 07:20 AM)php_rocs Wrote: @PwrSrg, MariaDB (MySQL)
There is no migration command to create a migration from an existing database.
You would need to export it and manually convert it over to a migration file. The command to create a blank migration file is: php spark migrate:create [filename] I have looked into this there is a utility for the Laravel framework to do just that To much trouble to write something like that just for a utility. You can find it here: Laravel Migrations Generator What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
Migrations and Seeders are great for small projects, but if you have a lot of existing tables or a lot of data, I think it's better to export the database and use SQL scripts.
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
This would be a great tool. I already have 3 projects where I have to manually write migrations from existing databases
See https://forum.codeigniter.com/thread-634...#pid324798
You can write code to run the export file in a migration file. |
Welcome Guest, Not a member yet? Register Sign In |