<div dir="ltr">On Tue, Oct 14, 2008 at 5:18 AM, xu zhou <span dir="ltr"><<a href="mailto:redicaps@gmail.com">redicaps@gmail.com</a>></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 'title' can'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't use a default for text columns. So, if your model definition looks like this:<br><br>column title => type is 'text', default is 'Untitled post';<br>
<br>You should change it to:<br><br>column title => type is 'text';<br><br>or to use a VARCHAR type instead like:<br><br>column title => type is 'varchar(100)', default is 'Untitled post';<br>
<br>If you still want the default and still want to use the "text" type, you can add a before_create() hook to your model like this:<br><br>sub before_create {<br> my ($self, $args) = @_;<br><br> $args->{title} ||= 'Untitled post';<br>
<br> 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'll have to go ahead and take care of it this way for the time being.<br>
<br>Cheers,<br>Sterling<br> </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't execute the query<br>
'CREATE TABLE posts (<br>
id INTEGER NOT NULL AUTO_INCREMENT,<br>
title text NULL DEFAULT 'Untitled post' ,<br>
body text NULL ,<br>
PRIMARY KEY (id)<br>
)<br>
' at /usr/local/share/perl/5.8.8/Jifty/DBI/Handle.pm line 578.<br>
error creating table Mywebblog::Model::Post: Couldn't execute the<br>
query 'CREATE TABLE posts (<br>
id INTEGER NOT NULL AUTO_INCREMENT,<br>
title text NULL DEFAULT 'Untitled post' ,<br>
body text NULL ,<br>
PRIMARY KEY (id)<br>
)<br>
'BLOB/TEXT column 'title' can'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>