• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

one-to-many relationship: what is the design consideration ?

 
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to ask a question about JForum data design.

Category has many Forums, one-to-many (parent-child) relationship. But in Jforum, we didn't implement this relationship, just forum table has a category id. When deleting a category, it will check "CategoryModel.canDelete".

If we don't have this relationship, one question will arise. how to delete a category and cascade deleting forums ? More importantly, why do we have this 'loose' relationship design ? why we don't implement one-to-many relationship? what is your design consideration ?

Thanks.


[originally posted on jforum.net by czy11421]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is beacuse in that time mysql didn't has this kind of constraints, as far as I can tell.

Now, we can in fact fix this schema. You can open an issue in the bug tracker: http://www.jforum.net/jira

Rafael
[originally posted on jforum.net by Rafael Steil]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

1. I have a mistake here, category-forum is implemented with one-to-many relationship. My fault.

2. Groups-users has many-to-many relationship, so we should have a bridge table, users_groups. But the problem is, users_groups don't add FK to group/user, it is independent. What is your design consideration ? Why not let RDMS to handle this relationship ?

3. I am just a student, I am learning data design from this project.

Thanks
[originally posted on jforum.net by czy11421]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As I said before, there should be FKs there. It just handn't because some limitations of mysql back in time.

Rafael
[originally posted on jforum.net by Rafael Steil]
 
please buy this thing and then I get a fat cut of the action:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic