[typo] Postgres Issue with Migrate BoolifyContentAllowFoo
Jeffrey Allan Hardy
packagethief at gmail.com
Fri Dec 9 14:15:24 EST 2005
Paul Hart wrote:
> I'm running Typo-current with the latest Rails release (RC4 I guess!)
> and a PostgreSQL 8.0.3.
>
> During the migrate 35, there is a problem with the update query; the
> message in the logfile is:
>
> ActiveRecord::StatementInvalid (PGError: ERROR: column "allow_comments"
> is of type boolean but expression is of type integer
> HINT: You will need to rewrite or cast the expression.
>
> The start of the query is:
>
> UPDATE contents SET "keywords" = '', "created_at" = '2005-11-29
> 19:15:00', "allow_comments" = 1, "extended" = 'There [...]'
>
> Suggestions? :)
It seems that PostgreSQL likes its boolean values as literals, but
allow_comments being set as an integer.
Looking in db/migrate/35_boolify_content_allow_foo, changing the call to
update_attribute on line 16 so it converts the value arg to a string
might work, but I didn't test it...
c.update_attribute(fieldname, !res["oldval"].to_i.zero?.to_s)
HTH
/Jeff
More information about the Typo-list
mailing list