CodeIgniter Forums
Laravel like migration functions - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Feature Requests (https://forum.codeigniter.com/forumdisplay.php?fid=29)
+--- Thread: Laravel like migration functions (/showthread.php?tid=88079)



Laravel like migration functions - immachakata - 07-16-2023

I recently saw the migration statements on Laravel and was thinking, can we work on something like that too for CI4? I'm thinking something like this
PHP Code:
$this-forge->string("name"); 

This would be the equivalent of 
PHP Code:
$this-forge->addField([
  "name"=>[
     "type"=> "VARCHAR"
     // And some optional fields
   ]
]); 

I could work on it if that's okay.


RE: Laravel like migration functions - iRedds - 07-18-2023

Of course you can realize your idea and submit a PR. Don't forget about tests and code style.
Also, do not forget about the DBMS supported by the framework.


RE: Laravel like migration functions - kenjis - 07-22-2023

The idea that adding methods to specify table columns is no problem.

But it seems that the API "$this->forge->string("name")" is not good,
or does not make sense.  The Forge class does many things, not only column definition.


RE: Laravel like migration functions - immachakata - 07-22-2023

Thanks for pointing that out. Is it okay if I add it to the Migration class.


RE: Laravel like migration functions - iRedds - 07-23-2023

(07-22-2023, 10:45 PM)immachakata Wrote: Thanks for pointing that out. Is it okay if I add it to the Migration class.

no


RE: Laravel like migration functions - immachakata - 07-25-2023

I'm lost. What would be the best approach?