views:

40

answers:

0

I am putting together a DB driven website with kohana and I need to be able to track revisions. So I have the data behind the individual pages in two tables. The first is the generic entity table that I use for keeping track of all the sites content. It contains basic information: resource uid, uri alias, creating user, creation date, and publishing user, and content model. The revision table contains rev_id, resource uid as FK, title, page content, revision creator, revision date, and publish approver.

The site will lookup a page by resource uid or uri alias and return the most recent published revision. However from the uri the user can roll back the page to earlier revisions by including an upper date limit in the uri or a -# to roll back # revisions.

So the page controller will be taking in the resource uid, possibly a date, and a revision rollback count, requesting the appropriate record from the models, and passing the appropriate record to the view.

Creating new pages will update both tables, updating pages will update one table, and deleting tables will effect 1 table.

Should I be creating two models, the entity model and the revision model? Or should I just have the one logical model that abstracts the actual structure?