Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Change models using oil
is there a way, to change models using oil? For example I want to add another field X to an existing model? How would i do that?
Or delete one column?
No. Other then generating them again from scratch.
Thats a pity
Manipulating existing code, that you may have changed manually, would require a complete PHP parser, so you can insert your changes at the right location.
Very complex, and imho not worth while. By the time you have typed in the oil command, you've also added a property to an existing model (select property line, copy, paste new line, change fieldname, save).
It's not only for changing the model. The main point for me is, to change the migration as well at the same point. If this would work, I have to make changes to the database model only in oil on my dev system and can replicate these changes to all other systems by migration. Isn't this the sense of oil migrations?
But I know that that would be a complex script and its ok if it doesn't work.
I understand the reason for wanting this.
The big problem is that files may have been changed manually after generation. This is the case with everything oil generates. If overwriting is not a problem, you can just generate again, but you have to specify everything on the commandline, not only the delta. If you want to be able to specify delta's, oil would need so kind of repository somewhere, so it knows what the status is without having to look in the code.
If overwriting is a problem, the source would need to be parsed to make sure changes are not lost. And that is extremely complicated.
We've created an issue list of the 2.0 version of Fuel here:
. There are separate issues of Oil itself (the cli engine), code generation, and migrations. If you have any idea about future functionality or requirements, feel free to join the discussion.
Add a Comment
It looks like you're new here. If you want to get involved, click one of these buttons!
Apply for Membership
↳ Job Board
↳ Installation & Setup
↳ Tips and Tutorials
↳ Code share
In this Discussion