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>&gt; I also wonder if each plugin might want to supply a prefix to the table names to avoid collisions.
<br><br>My patch doesn&#39;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 &quot;table_prefix()&quot; to the Jifty::Plugin that could be overridden and just calculates a preset table prefix from the plugin&#39;s name.
<br><br><div><span class="gmail_quote">On 7/16/07, <b class="gmail_sendername">Jesse Vincent</b> &lt;<a href="mailto:jesse@bestpractical.com">jesse@bestpractical.com</a>&gt; 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>&gt; Jesse,<br>&gt;<br>&gt; We&#39;ve discussed it before and I believe it was your intention that<br>&gt; plugins be able to supply their own models. Up to this point, it
<br>&gt; has not been possible. I have created a patch that will make it<br>&gt; possible, but I&#39;ve not committed it yet. I wanted to run it by you<br>&gt; first to make sure I haven&#39;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&#39;ve<br>thought about or played with?<br><br>-j<br><br><br>&gt; You can find the patch attached. It includes modifications to
<br>&gt; Jifty::Plugin, Jifty::Schema, and Jifty::Script::Schema along with<br>&gt; a new test application and a single test that verifies the basics.<br>&gt; (I&#39;m planning a couple more to make sure that plugin models
<br>&gt; cooperate properly with app models and that upgrades work.)<br>&gt;<br>&gt; Anyway, the major fix is in two areas:<br>&gt; Jifty::Schema now includes any models found under installed plugins<br>&gt; and adds them to Jifty-&gt;schema-&gt;models
<br>&gt; Jifty::Script::Schema now iterates through installed plugins when<br>&gt; checking for installation and upgrades.<br>&gt; Supporting the later piece, I have added some new methods to<br>&gt; Jifty::Plugin that are inherited with the expected defaults:
<br>&gt; $plugin-&gt;version: Returns the database version of the plugin.<br>&gt; Returns 0.0.1 unless overridden.<br>&gt; $plugin-&gt;bootstrapper: Returns the bootstrap class for the plugin.<br>&gt; Returns $plugin_class::Bootstrap unless overidden.
<br>&gt; $plugin-&gt;upgrade_class: Returns the bootstrap class for the plugin.<br>&gt; Returns $plugin_class::Upgrade unless overridden.<br>&gt; That&#39;s it. Thanks to Jesse and Alex, et. al. this patch was pretty<br>&gt; simple.
<br>&gt;<br>&gt; Oh, there is one possible nasty you may run into (at least I did).<br>&gt; I had installed an old version of Jifty at some point where<br>&gt; Authentication::Password and the User plugins had User models. This
<br>&gt; caused bad things to happen.<br>&gt;<br>&gt; I also wonder if each plugin might want to supply a prefix to the<br>&gt; table names to avoid collisions.<br>&gt;<br>&gt; Cheers,<br>&gt; Andrew<br>&gt; &lt;plugin-models.patch
&gt;<br>&gt; _______________________________________________<br>&gt; jifty-devel mailing list<br>&gt; <a href="mailto:jifty-devel@lists.jifty.org">jifty-devel@lists.jifty.org</a><br>&gt; <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>