<div dir="ltr">On Tue, Oct 14, 2008 at 5:18 AM, xu zhou <span dir="ltr">&lt;<a href="mailto:redicaps@gmail.com">redicaps@gmail.com</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

WARN - DBD::mysql::st execute failed: BLOB/TEXT column &#39;title&#39; can&#39;t<br>
have a default value at<br>
/usr/local/share/perl/5.8.8/Jifty/DBI/Handle.pm line 554.</blockquote><div><br>If you use MySQL for database storage, don&#39;t use a default for text columns. So, if your model definition looks like this:<br><br>column title =&gt; type is &#39;text&#39;, default is &#39;Untitled post&#39;;<br>
<br>You should change it to:<br><br>column title =&gt; type is &#39;text&#39;;<br><br>or to use a VARCHAR type instead like:<br><br>column title =&gt; type is &#39;varchar(100)&#39;, default is &#39;Untitled post&#39;;<br>
<br>If you still want the default and still want to use the &quot;text&quot; type, you can add a before_create() hook to your model like this:<br><br>sub before_create {<br>&nbsp;&nbsp;&nbsp; my ($self, $args) = @_;<br><br>&nbsp;&nbsp;&nbsp; $args-&gt;{title} ||= &#39;Untitled post&#39;;<br>
<br>&nbsp;&nbsp;&nbsp; return 1;<br>}<br><br>I think Jifty::DBI ought to be smart enough to know about and do the right thing in this case, but it currently does not, so you&#39;ll have to go ahead and take care of it this way for the time being.<br>
<br>Cheers,<br>Sterling<br>&nbsp;</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
WARN - Mywebblog::Handle=HASH(0x9f5abbc) couldn&#39;t execute the query<br>
&#39;CREATE TABLE posts (<br>
 &nbsp;id INTEGER NOT NULL &nbsp;AUTO_INCREMENT,<br>
 &nbsp;title text NULL DEFAULT &#39;Untitled post&#39; ,<br>
 &nbsp;body text NULL &nbsp;,<br>
 &nbsp;PRIMARY KEY (id)<br>
)<br>
&#39; at /usr/local/share/perl/5.8.8/Jifty/DBI/Handle.pm line 578.<br>
error creating table Mywebblog::Model::Post: Couldn&#39;t execute the<br>
query &#39;CREATE TABLE posts (<br>
 &nbsp;id INTEGER NOT NULL &nbsp;AUTO_INCREMENT,<br>
 &nbsp;title text NULL DEFAULT &#39;Untitled post&#39; ,<br>
 &nbsp;body text NULL &nbsp;,<br>
 &nbsp;PRIMARY KEY (id)<br>
)<br>
&#39;BLOB/TEXT column &#39;title&#39; can&#39;t have a default value at<br>
/usr/local/share/perl/5.8.8/Jifty/Record.pm line 699.<br>
<br>
No tables were created in the database mywebblog<br>
Dose anybody know what is the problem?<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" target="_blank">http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel</a><br>
</blockquote></div><br></div>