[baseten-users] question about relationship
Jianhua Meng
jh_meng at mac.com
Wed Apr 8 23:27:36 EEST 2009
Hi List,
I thought I should ask the list to confirm if we are doing it the
correct way with regards to specifying relationships among entities
for a baseten based app. Something is bugging me. It appears that we
doing something extra that may be avoided.
For the purpose of discussion, let's assume there exists an optional
to-one relationship between Person and Employer. When the underlying
model is loaded into a database via BaseTenAssistant, currently we
need to take an extra step to prepare the database in order for the
loaded schema to be usable, i.e. manually call ALTER TABLE "Person"
ALTER COLUMN "employer_id" DROP NOT NULL; in our model, there are a
lot of relationships like this. We ended up having to maintain a list
of such relationships and then run a script to drop all the not null
constraints on all such relationships.
Without this step, we would not be able to create any Person instances
because doing so violates the default 'not null' constraint.
It appears that BaseTenAssistant by default creates all the
relationships with not null constraint applied. Is this behavior by
design? Is there a way we can influence the BaseTenAssistant behavior
such that not null constraint is not applied by default?
Thanks for any tips.
Regards,
Jianhua Meng
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basetenframework.org/pipermail/baseten-users/attachments/20090408/5aafd49d/attachment.htm>
More information about the baseten-users
mailing list