creating a table with codeignituer db forge. automate code?

344 views Asked by At

Is there a way to take an existing mysql create table String, and turn it into a db_forge array/script suitable for the create_table() method?, ie basically reverse the dbforge process. It is just quicker to make tables in something like Sequel pro, then copy the sql code to the model.

I already have the mysql code, but i was thinking of using the dbforge to allow different databases to be used.

Do people use the dbforge? or just write the SQL creation code manually?

2

There are 2 answers

2
umefarooq On

hi if you want to create tables through codeigniter then use migrations class it can solve your problem. you can create, update and delete table with migrations.

CI Migration class

0
colonelclick On

There is no automated process to do what you ask. You have to convert it manually.

I have found that once I became familiar with the dbforge syntax, I can create tables just as quickly, if not quicker, than using Sequel Pro or another SQL GUI.