A "persons" table is used in various parts of the app to track
individuals. The "rel" column is the relation of the person to
respondent (i.e, the person filling out the web form). In addition,
the respondent's children and his/her choices for financial trustees
are tracked, too. One or more trustees are designated as first
choice, second choice, etc. in the seq column (it's actually an
integer: 1, 2, 3,...) A child can be a trustee; or the person might
designate his/her brother, sister, close friend, etc.
The issue I'm struggling with is that currently, when a trustee that
happens to be a child, is deleted from the Choices table, it has the
unintended effect of also deleting the corresponding row from the
persons table (though a row remains in the children table).
How do I define the tables so that a choice (trustee) that's added
also adds a row to the person table (which currently works!), but a
choice can be deleted WITHOUT deleting the person row? Use case: the
respondent no longer wants that person as a trustee, but data on the
person should remain the database.
Current table definitions are below.
Thanks!
Edgar
class Person(Base):
__tablename__ = 'persons'
id = Column(Integer, primary_key=True)
account_id = Column(Integer, ForeignKey('accounts.id'),
primary_key=True)
first_name = Column(String(20))
middle_name = Column(String(1))
last_name = Column(String(20))
rel = Column(String(1))
gender = Column(String(1))
age = Column(Integer)
phone = Column(String(20))
email = Column(String(100))
class Child(Person):
__tablename__ = 'children'
child_id = Column('id', Integer, primary_key=True)
account_id = Column(Integer, ForeignKey('accounts.id'),
primary_key=True)
person_id = Column(Integer, ForeignKey('persons.id'),
primary_key=True)
seq = Column(Integer)
is_minor = Column(Boolean)
child_of = Column(String(1))
class Choice(Person):
__tablename__ = 'choices'
choice_id = Column('id', Integer, primary_key=True)
account_id = Column(Integer, ForeignKey('accounts.id'),
primary_key=True)
person_id = Column(Integer, ForeignKey('persons.id'),
primary_key=True)
seq = Column(Integer)
category = Column(String(1))
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" 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/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---