8 April 2011 at 7:50pm
I was hoping someone could point me in the right direction or at the very least give me a shove, i have a number of tables on a site that would benefit from having a separate date table, eg, i have a table of skills associated with the member table on a belongs_many_may relationship some of these skills will have an expiry date, i also have a table of dogs who have a level that needs a start date and an expiry date, can i just create a single table with dates from and dates to fields and link that in to all the relevant tables? Is that the right way forward?
8 April 2011 at 11:27pm
If at all possible, I would go for adding the datefields to the tables themselves (dogs, skills) themselves. Unless you have very good reasons, because this will make things complicated. I'm assuming skill expiry dates and dog level start dates don't really have much in common beside being dates?
9 April 2011 at 12:14am
yea the dates aren't related and i was thinking of having the dates on the tables themselves but with the skills list each person is gonna have a set of skills, First Aid, Radio etc and each of those will have a different date for each skill and member so kinda leads me to think they need to be a separate table but not sure how to join the whole lot up.
I think this may have to be a just a date table for the team skills but will need to think about this a bit more.
9 April 2011 at 3:54am
each Member has-many Skills
each Skill has_one SkillType and has_one Member
each SkillType has_many Skills
so you'd have
- a Skill object, that holds all info concerning a SkillType for a certain member - including dates and stuff and what SkillType it refers to
- a general SkillType object with records for First Aid, Radio and what have you, and maybe some descriptions,
I wouldn't mix that up with date-related dog-level-stuff, but create whole new Object types for that - room enough... :-)