views:

197

answers:

1

Is it possible to have nested set capabilities in this somewhat custom setup?

Consider these 4 tables:

  1. Object: (oid, name) contains: [1, 'Licence'] and [2, 'Exemption']
  2. Licence: (lid, name)
  3. Exemption: (eid, name)
  4. Cost: (oid, oid_ref, cost_oid, cost_oid_ref)

For:
P = Licence with lid [1]
R = Exemption with eid [2]

i can say "object P is a parent to object R" if the following Cost record exists:

[oid: 2 oid_ref: 2 cost_oid: 1 cost_oid_ref: 1]

I understand that this creates somesort of 'conditional foreign key' relation which I need to define in code. Is it possible to have the nested set loaded with these conditions?

A: 

I am trying in some way using column_aggregation inheritance, but I have a gut feeling it's not gonna work... :S

Ropstah