hehe.... poor web2py (and maybe db schema)

You should let create the two tables without references and then set the 
references to each other. 

I think that during the first creation if a foreign key is requested but 
there is no foreign table the db (rightfully) will prevent you to create 
such foreign key.


Il giorno giovedì 14 giugno 2012 14:41:45 UTC+2, Gabriella Canavesi ha 
scritto:
>
> Hi all, 
> Actually I cannot move the pictures table declaration because both off 
> them have references to each other (mutual reference?) 
> In route the field photo_id references pictures and in pictures the 
> field route_id references route. 
>
> -- 
>   Paolo 
>
> Il 14.06.2012 09:56 Niphlod ha scritto: 
> > don't know precisely how dal works, but if a table have a field 
> > referenced in a table defined after that, wouldn't that cause a 
> > problem ? 
> > 
> > i.e. db.define_table('route', 
> > Field('photo_id', 'reference pictures', readable=False, 
> > writable=False) 
> > ) 
> > db.define_table('pictures', 
> > Field('name')) 
> > 
> > does not work, where 
> > db.define_table('pictures', 
> >  Field('name')) 
> >  db.define_table('route', 
> >  Field('photo_id', 'reference pictures', readable=False, 
> >  writable=False) 
> >  ) 
> > 
> > instead works ? 
> > 
> > Not using web2py, for normal sql development, you have to create 
> > "child" tables before declaring a "parent" with references to it. 
>
>

Reply via email to