Not quote. First, your model must exactly describe what is in the db.
Then you set fake_migrate=True, this will create the metadata. Then
you set fake_migrate=False (or remove it) and migrate=True. Not you
can change the model and web2py will perform the ALTER TABLE.

If web2py does not know what is in DB it will always try create the
table not alter it.

Massimo

On Dec 30, 10:01 pm, "Thomas Dall'Agnese"
<thomas.dallagn...@gmail.com> wrote:
> Indeed, I am talking about (3), and in that case, running with migrate=True
> raises an error (table already exists).
>
> The table had been created by web2py so of course it exists.
> In case (3) should I also have fake_migrate=True?
>
> On Sat, Dec 31, 2011 at 12:58 PM, Massimo Di Pierro <
>
>
>
>
>
>
>
> massimo.dipie...@gmail.com> wrote:
> > There are various scenarios:
>
> > 1) the table exist in db but were not created by web2py
> > run at least once with migrate=True,fake_migrate=True
> > 2) the table exist in db and where created by web2py (or you run
> > fake_migrate once)
> > it is ok to run with migrate=False
> > 3) web2py is aware of the tables (created by web2py or you run
> > fake_migrate) but you need to change them
> > set migrate=True until the migration has happened.
>
> > I guess you are asking about 3.
>
> > On Dec 30, 9:53 pm, Thomas Dall'Agnese <thomas.dallagn...@gmail.com>
> > wrote:
> > > But if we change the table definition, for example we add one field, it
> > > will not be updated then, isn't it?
> > > How can we migrate a MySQL table?

Reply via email to