Yes, but if  you know than the field will be added, this can be solved
with an if (seudocode) in the db.py at the end of the file or after
importing modules like t2/t3

if !db.exist_field('table','field')
    db.test.append_field('two')

Well I think so, but of course the exist_field function maybe isn't so
easy to implement or I need to learn more about databases in python...

Thanks for the reply, keep the good and great job...

Mauricio

On 14 ene, 13:55, mdipierro <[email protected]> wrote:
> This cannot be done. think of
>
> 1: db.define_table('test',SQLField('one'))
> 2: db.test.append_field('two')
>
> a) The first time line 1 is executed, the table is created with one
> field.
> b) The first time line 2 is executed, the table is altered and field
> two is added
> c) The second time line 1 is executed, the table is altered and field
> two is dropped
> d) go back to c).
>
> You do not want this to happen to the database. The only way to avoid
> would be a complicated mechanism to tell web2py to delay migrations.
>
> Massimo
>
> On Jan 14, 1:11 pm, mfolmos <[email protected]> wrote:
>
> > I need to add fields to t2 tables, like t2_person and t2_group, and
> > have seen prior posts to do this and I have done that, but it would be
> > desirable a function that do an alter table to add fields to already
> > created tables that comes hard coded in plugins like t2 and t3
> > Ej.
> > You have db.t2_person table and want to add the field nickname
> > db.t2_person.add_field('nickname','string',default='nobody')
> > with all the SQLField parameters...
> > or
> > db.add_field('t2_person','nickname','string',default='nobody')
> > with all the SQLField parameters...
>
> > I think that migrate have many of the code to do this?
>
> > I have to post on WEP's?
>
> > Mauricio
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" 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