Sorry, I make my emails too long. As the dorky consultants around the office say, quoting my Kolbe score, my red line is too long. <br><br>This little nugget was the last line of my original message:<br><br>> I also wonder if each plugin might want to supply a prefix to the table names to avoid collisions.
<br><br>My patch doesn't include that. It was a thought I had as I finished the email. It should be pretty easy to add by adding something like "table_prefix()" to the Jifty::Plugin that could be overridden and just calculates a preset table prefix from the plugin's name.
<br><br><div><span class="gmail_quote">On 7/16/07, <b class="gmail_sendername">Jesse Vincent</b> <<a href="mailto:jesse@bestpractical.com">jesse@bestpractical.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>On Jul 15, 2007, at 11:08 PM, Andrew Sterling Hanenkamp wrote:<br><br>> Jesse,<br>><br>> We've discussed it before and I believe it was your intention that<br>> plugins be able to supply their own models. Up to this point, it
<br>> has not been possible. I have created a patch that will make it<br>> possible, but I've not committed it yet. I wanted to run it by you<br>> first to make sure I haven't stepped in anything.<br><br>
This is very cool. My one concern is plugins offering models of the<br>same name as the user app and what happens. Is that something you've<br>thought about or played with?<br><br>-j<br><br><br>> You can find the patch attached. It includes modifications to
<br>> Jifty::Plugin, Jifty::Schema, and Jifty::Script::Schema along with<br>> a new test application and a single test that verifies the basics.<br>> (I'm planning a couple more to make sure that plugin models
<br>> cooperate properly with app models and that upgrades work.)<br>><br>> Anyway, the major fix is in two areas:<br>> Jifty::Schema now includes any models found under installed plugins<br>> and adds them to Jifty->schema->models
<br>> Jifty::Script::Schema now iterates through installed plugins when<br>> checking for installation and upgrades.<br>> Supporting the later piece, I have added some new methods to<br>> Jifty::Plugin that are inherited with the expected defaults:
<br>> $plugin->version: Returns the database version of the plugin.<br>> Returns 0.0.1 unless overridden.<br>> $plugin->bootstrapper: Returns the bootstrap class for the plugin.<br>> Returns $plugin_class::Bootstrap unless overidden.
<br>> $plugin->upgrade_class: Returns the bootstrap class for the plugin.<br>> Returns $plugin_class::Upgrade unless overridden.<br>> That's it. Thanks to Jesse and Alex, et. al. this patch was pretty<br>> simple.
<br>><br>> Oh, there is one possible nasty you may run into (at least I did).<br>> I had installed an old version of Jifty at some point where<br>> Authentication::Password and the User plugins had User models. This
<br>> caused bad things to happen.<br>><br>> I also wonder if each plugin might want to supply a prefix to the<br>> table names to avoid collisions.<br>><br>> Cheers,<br>> Andrew<br>> <plugin-models.patch
><br>> _______________________________________________<br>> jifty-devel mailing list<br>> <a href="mailto:jifty-devel@lists.jifty.org">jifty-devel@lists.jifty.org</a><br>> <a href="http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel">
http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel</a><br><br><br>_______________________________________________<br>jifty-devel mailing list<br><a href="mailto:jifty-devel@lists.jifty.org">jifty-devel@lists.jifty.org
</a><br><a href="http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel">http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel</a><br><br><br></blockquote></div><br>