Question

How to create table using ORM or Database builder with kohana 3.2? Is this possible at all? I saved the table definition (create sql) in a file. I'm sure the sql works because I used it in phpMyAdmin and it works. How can I execute the query?

Was it helpful?

Solution

This should do the trick:

Database::instance()->query(NULL, 'raw query here');

Kohana's ORM does not have the capability to create tables for you. You can define the columns manually, but if I recall correctly not with enough information necessary to recreate the table.

I've seen two ORM's made for Kohana that could create tables. They were Sprig and Jelly if I remember correctly, I don't think they are maintained anymore though.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top