DB design question . Gmail like schema

977 views
Skip to first unread message

Manu

unread,
Apr 19, 2011, 5:53:58 PM4/19/11
to web...@googlegroups.com
Hi ,
I really like web2py as a framework as I can quickly come up with
something working(controller and views are so easy to write). But as i
am not a seasoned developper i feel weak when it comes to design the
database. DAL is great but unfortunatley it can define the schema for
me ( yet :) )
I would like to know if someone would suggest me a sound design for
the db so that my users can exchange messages that can be organised in
threads like Gmail .

Any help or pointer to some appliance that would help me starting the
db will be appreciated

Thx
Manu

pbreit

unread,
Apr 19, 2011, 7:17:28 PM4/19/11
to web...@googlegroups.com
That's a tricky question. To begin with, keep it simple. Web2py gives you a lot of flexibility to play around with your DB schema. While developing, you can easily modify schema or even throw it out and start over. Once you're in production, you have to be much more careful.

You could start with a single table and see how far you get.

db.define_table('message',
   Field('from_email'), # sender
   Field('to_email'), # recipient
   Field('subject'),
   Field('body', 'text'),
   Field('ref_id'),
   auth.signature)

The "ref_id" would relate to a prior message so you could build a thread. Alternatively, you might need a "thread" table to tie them together. "auth_signature" automatically provides a timestamp and user info (if someone is logged in).
Reply all
Reply to author
Forward
0 new messages