Welcome Guest, Not a member yet? Register   Sign In
Create MySQL Tables without using Database Forge Class
#1

Hi,
I am wondering is it possible to execute the raw MySQL CREATE TABLE commands with all columns and accompanying definitions in CodeIgniter 4 instead of using the Database Forge Class?
I am parsing a special .fxl file (which is structured quite similar to an .xml file) and using all the information within the file to create tables with columns and definitions.
In my specific case, building up the raw MySQL queries into the complete query string would be better.
Reply
#2

(10-27-2021, 01:40 PM)josh2112o Wrote: Hi,
I am wondering is it possible to execute the raw MySQL CREATE TABLE commands with all columns and accompanying definitions in CodeIgniter 4 instead of using the Database Forge Class?
I am parsing a special .fxl file (which is structured quite similar to an .xml file) and using all the information within the file to create tables with columns and definitions.
In my specific case, building up the raw MySQL queries into the complete query string would be better.
I guess I should have looked better before posting the question here but it looks like I can use the $db connection in a model and run the CREATE TABLE statements.
Reply
#3

use forge for migration is alot easier and good practise. in case we need to pass our project to next person.
Reply
#4

(10-28-2021, 01:02 AM)ikesela Wrote: use forge for migration is alot easier and good practise. in case we need to pass our project to next person.
Thank you for the information. That is great advice and something I haven't considered is the next person who may work on the project too.
Reply
#5

Or just run a .sql file in your database instead of doing it in php.
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
Reply
#6

(10-28-2021, 03:17 PM)includebeer Wrote: Or just run a .sql file in your database instead of doing it in php.
Yes, that is always an option. Thank you for the suggestion.
Reply
#7

[quote pid="391088" dateline="1635459429"]
Thanks for the suggestion brother, it works just fine.
[/quote]
Reply




Theme © iAndrew 2016 - Forum software by © MyBB