0

So I am looking to find the best database design for the following situation. I will refer to my entities as 'articles' as that would best/most-easily describe them.

So the articles have already been created and have

id  | name   | content
1   | aricle1| the frog jumped...
2   | aricle2| Joe met stan...
3   | aricle3| Mikey has never...

Now, I would like to be able to retrospectively make certain articles sub-articles of other articles, and make other articles sub-articles of sub-articles (sub-sub articles). Most articles will NOT have a sub article, but many will.

So essentially it is building lots of little trees, with a presumed max-depth of 5.

I would like to be able to shift a set (articles and all sub-articles) under the domain of another article with (relative) ease.

After having done plenty of reading, I am almost 100% certain anything relating to the nested set model would be overkill and not appropriate.

Other than that however, I don't have much idea as to what is the proper approach here.

Sincere thanks for any help. It is greatly appreciated.

0
0

If you can only have one Parent article, add a column and call it 'parentArticle'.

ALTER TABLE table_name
ADD parentArticle int

This will link to the article id of the parent article. You can then have as many depth as you would like.

I would like to be able to shift a set (articles and all sub-articles) under the domain of another article with (relative) ease.

You could then add a 'category' column and a category table or, to keep it under articles, have a master article named after its category.

Not the answer you're looking for? Browse other questions tagged or ask your own question.