Simple Database Design Problem
Posted by: Filip Nedyalkov
Date: June 09, 2011 08:49AM

Hi, I am trying to figure out how to solve this little problem:

I have this table structures:

1) Themes -> 2) Theme Templates -> 3) Theme Page Templates
So 1 Theme can have some Theme Templates and each Theme Template can have some Theme Page Templates

4) Page Templates
A table with Page Templates which do not depend on the selected Theme.

5) Pages
Imagine you have a control panel and you can select for page About Us a Theme Page Template OR Page Template.

The question is how do I structure the table pages?

I imagined the table to look like:
1) page_id template_type template_id
1 theme_page 1
2 page 1
Basicly the template_type is like a marker that points to look for id in the correct table.

2) page_id page_template_id theme_page_template_id
1 1 0
2 0 1
Here both ids cannot be set, one of them is always 0 the other is pointing to the id in the correct table.

Is there a third option or some other better way to organize this? If no then which of these options makes more sense?

Thanks in advance!

Options: ReplyQuote

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.