Welcome Guest, Not a member yet? Register   Sign In
Laravel like migration functions
#1

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.
Reply
#2

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.
Reply
#3

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.
Reply
#4

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

(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
Reply
#6

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




Theme © iAndrew 2016 - Forum software by © MyBB