Because you have to do in a different way. Your boolean column cannot
be converted to integer because it is implemented as a char(1) that
contains 't' and 'f'. postgres cannot convert 't' to an integer.

The way of doing is by first deleting the existing column, migrating,
adding the column again as integer, migraing again.

If you need to convert the data, instead, you add a new dummy column,
add a script to convert the data, delete the original column, create
the new column, copy the data, delete the dummy column.

On Sep 11, 3:29 am, Richard <[email protected]> wrote:
> Well, yesterday I changed a boolean type column to integer in my model
> and all hell broke loose.
> Fortunately all the boolean values were false so I was able to
> manually enter postgres and do the update myself.
> I never experienced such a problem with sqlite, perhaps because sqlite
> is typeless (IIRC).
>
> Richard
>
> On Sep 11, 3:05 pm, mdipierro <[email protected]> wrote:
>
> > 1) actually migrations work better in posgresql because all types of
> > alter tables are supported (http://www.sqlite.org/faq.html#q11).
>
> > For example if you change the type of a column with postgresql web2py
> > will create a new column, try to convert the data, drop the old
> > column, rename the old column. This may fail if data cannot be
> > converted (like a string into an int with value that are not int).
>
> > While sqlite does not handle column drop so web2py just does not do
> > the migration. It just tried to parse the data when extracted
> > according to the new column type. That migration can never fails
> > because it never actually happens but it can lead to other problems
> > later.
>
> > 2) I have something to add about ondelete CASCADE but I will do it in
> > another thread.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to