Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Oil Generate migration from an entire set of pre-defined models
  • This is probably more of a feature request as I'm fairly sure this functionality isn't there. But after spending some time working with Django, one thing I really liked (lost in a sea of dislikes) was that you create the models of your application first, outlining all the relationships, properties, etc... Then after some command line goodness, it would take your models and generate the proper Database scheme to correspond with the models (field types were defined in the models. At least initially it was very helpful to get a project started. I might look at the oil generate command and see if we could read the specific properties found in the models and go from there. Would it be much work to change the $_properties declaration from this class Model_Article extends Orm\Model {
    protected static $_properties = array('id', 'title', 'contents', 'publish');
    } to this class Model_Article extends Orm\Model {
    protected static $_properties = array('id' => 'integer', 'title' => 'string', 'contents' => 'text', 'publish' => 'bit');
    } It seems like if this were done it wouldn't be very hard to implement the feature I'm talking about. Just a thought.
  • Afaik that kind of property definition is already possible, but I'm not sure of the correct synax. Maybe Jelmer can comment on this.
  • Hah, give me an afternoon ... https://github.com/jondavidjohn/fuel-initdb I wrote a task that will accomplish this

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion