Hello

The following is a purely DB related answer to the question.

I am also inclined to avoid the use of triggers. What follows is an idea I had on the issue, but I did not realize it yet in practice. Moreover, it depends on possibilities of your DB :

Keep one table containing all objects and their history, so primary key should somehow involve the history, I would actually prefer to create a new unique id for each modification to the original object.
Keep a field in the table to indicate that a specific version is default or current.
Create a materialized view and let your DB do the work of updating.

Admittingly, the work of adapting the view when the underlying table changes is not avoided, but this seems to be less cumbersome in maintenance than adapting triggers

Tabari

In reply to Re: ORM with version control? by Tabari
in thread ORM with version control? by moritz

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.