I am a newbie to db design, how can i impletement the model as following
in SQLObject?
A user can have multiple cards. There are several types of cards, named
"A", "B", "C"... etc. Every kinds of cards have different fields (e.g.
Card Type A has a field for blood type, while Card Type B has fields for
interests). And all type of cards have some common fields (e.g. expire
date).
I tried the following but don't know how to specify the relationship
between Card and CardA/B/C... (see the ???? marks). It seems it is
neighter OneToOne nor OnetoMany. Any hints?
class User(SQLObject):
name = StringCol()
cards = MultipleJoin("Card", joinColumn='user_id')
class Card(SQLObject):
expire = DateCol()
type = StringCol(length=1)
real_card = ????
class CardA(SQLObject):
bloodtype = StringCol(length=2)
card = ForeignKey("Card") ????
class CardB(SQLObject):
interests = StringCol()
card = ForeignKey("Card") ????
--
Qiangning Hong
http://hongqn.hn.org
Registered Linux User #396996