You are changing a "text" column (Field) into an "ineteger" column. My
changing the type web2py assumes you want to keep the data and yet it
cannot convert "text" to "integert". You have to do the migration in
two steps: 1) remove the column (comment it and run appadmin) 2) add
the column again with the new type. In this case web2py understands
you do not want to keep the data and will not attempt to do it.


On Nov 14, 7:08 pm, toomim <too...@gmail.com> wrote:
> I routinely run into migration problems. I suspect this happens when I
> change a column's datatype, or when I remove a table from db.py and
> then later make a new table with the same name as the old one.
>
> In these situations, the migrations get messed up and I get
> stacktraces in sql.py with errors like:
>
>   ProgrammingError: column "study__tmp" is of type integer but
> expression is of type text
>   LINE 1: UPDATE actions SET study__tmp=study;
>                              ^
>   HINT:  You will need to rewrite or cast the expression.
>
> How can I migrate in these situations?
>
> As an aside, I love the automatic migrations when they work, but I
> don't mind writing sql to fix the underlying database when they don't.
> Could web2py just tell me what schema it expects, let me fix the
> database, and then let me say "OK web2py, the database is ready to go!"
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to