In these cases you can still do the migrations in web2py but you have
to do them in two steps:

1) remove the column
2) run appadmin
3) add the new column
4) run appadmin

if you do migrations that involved a change in a column in one step,
web2py tries to port the data and that is not always possible. web2py
has no way of knowing what data is in the db.

Massimo

On Jul 21, 11:13 am, howesc <[email protected]> wrote:
> I agree with massimo about using web2py's migration features where
> possible.  Unfortunately there are some migrations that web2py just
> cannot do if there is data in the table (at least that was true in
> postgres a while ago).  Such things include making a previous nullable
> field not nullable, and i think adding unique qualifiers to an
> existing field.  i have not looked at the latest versions of the code
> to see if they do those migrations better or not, as i have gotten
> used to my manual management of tables.  i know it had to do with
> web2py making a copy of existing data into a temp table with the new
> schema rather than the old schema and not being able to specify
> transformations for existing data (a decently difficult problem to
> solve i suspect....and i'd rather see the crew working on things like
> cube2py than such mundane migrations)
>
> cfh
>
> On Jul 21, 3:07 am, mdipierro <[email protected]> wrote:
>
> > It is better to always use web2py but remember to use (default)
> > migrate=True every time you edit the db.
> > You may also want to keep a backup of your database/*.tables
>
> > On Jul 21, 4:54 am, Paul Gerrard <[email protected]> wrote:
>
> > > An updqate.
>
> > > I read the manual 6.4 on Migrations. I've added a migrate='tablename'
> > > aramter to the table definition call. It seems to work.
>
> > > So I guess I've disconnected the table definition from the Web2py
> > > table history. So far so good.
>
> > > So I have a more general point.
>
> > > "Is it 'better' to manage database designs using the Web2py model or
> > > better to manage the database using the DB utilities and keep the
> > > model in sync?" I understand the web2py model route ought to be
> > > better, but this is the second time I've lots hours messing around
> > > with out of sync database and models.

Reply via email to