Hello

I wrote a web app in PHP/MySQL to handle the data of a medical team. the prototype has worked well and I am now rewriting it using Yii because it needs to expand from 1 team to perhaps 100 - and I am learning Yii as I go.

To simplify my question each team uses two tables, operation_N and followup_N where operation_N has a one-to-many relation with followup_N. The structure of operation_N is the same for all teams, likewise followup_N. Lets say N = 1…100

I have figured out how to make my AR model work with a dynamic table name depending on N, but I am struggling with how to handle FK relations between the tables. It seems very clumsy to have N sets of FK assignments, one set for each team. Is there any way I can use the common structure of the N sets of tables to in effect use some "template-like" technique? Or is is best to abandon FK altogether?

Any pointers as to where to look would be very much appreciated.

David Johnson