That works but it is much easier than that since web2py supports it:
db.define_table('standardt', .... standard fields ... )
db.define_table('history', db.standardt, SQLField
('metadata','string'))
Notice can a field can be another table (i.e. all fields of the other
table). You can extend more than one table and you can have the fields
in any order you like.
On May 13, 1:31 pm, Jurgis Pralgauskis <[email protected]>
wrote:
> Hello,
>
> I want to achieve sth similar tohttp://sqlobject.org/Inheritance.html
> but probably simpler:
>
> my pattern in few apps is:
> I have some table, with info which can change freequently
> I want to have full history of it + some metadata:
>
> so I want 2 tables:
> 1) standart
> 2) history = standardt+[user_who_changed, date_of_change, action_CUD]
>
> is my approach correct?
>
> standardt_fields = [ SQLField('info','text'), ] # many feelds in
> reality
> db.define_table('standardt', *standardt_fields )
>
> fields2 = standardt_fields+[ SQLField('metadata','string'), ]
> # would be more aditional fields in reality
> db.define_table('history', *fields2 )
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---