Twitter Feed

Xataface Maillist

Sign up to receive the Xataface news letter with weekly updates and development tips.

 

How to activate history logging

Xataface 0.6.9 comes with support for managing the history of your records. This how-to shows you how to enable and use this feature.

Have you ever made a change to a record and then said "Oops". Or have you ever wondered whether a record has been changed and what those changes were? Xataface 0.6.9 adds a history feature that will allow you to view the history of records in your database, compare different versions for changes, and even revert to earilier versions of a record.

Figure 1: The History tab shows a list of previous versions of the current record along with timestamps to mark when it was changed.

Figure 1: The History tab shows a list of previous versions of the current record along with timestamps to mark when it was changed.

How it works

If you have history enabled in your application, Xataface will automatically create and maintain a history table to correspond with each table in your application (as necessary). The history table is named using the convention %tablename%__history.

For example, the table foo would have a corresponding foo__history table created automatically in the background (if it does not exist already), with columns matching those in foo. Whenever a record in foo is updated, it is copied into the foo__history table along with a timestamp and some information about the update (such as which language it was in, and which user performed it) so that it can be easily queried.

History tables can easily be queried independently of Xataface, however Xataface 0.6.9 adds a history tab to the details view (along with the "view", "edit", etc... tabs). This tab allows you to quickly see all revisions of the current record.

How to turn on history

Since history functionality requires Xataface to actually modify the database (by creating the history tables), it is disabled by default. To enable it, simply add the following to your conf.ini file:

[history]
enabled = 1

How to see older revisions of a record

Figure 2: Clicking the plus icon beside any row of the history list will show details about the record in that revision.

Figure 2: Clicking the "plus" icon beside any row of the history list will show details about the record in that revision.

Figure 3: The changes tab

Figure 3: Clicking the "changes" tab of the details for a revision will show the changes that have been made to the record since this revision - similar to a wiki.

  1. Click on the Details tab for the record of which to wish to see the previous revision.
  2. You will see a history tab along the top of the record details along with the view and edit tabs. Click on this tab.
  3. At this point you will see a list of revisions, in descending order by date. Each revision has a little "plus" icon to its left. Click this to see the record details in this revision.

How to revert to an earilier revision of a record

  1. Click on the Details tab for the record of which to wish to see the previous revision.
  2. You will see a history tab along the top of the record details along with the view and edit tabs. Click on this tab.
  3. At this point you will see a list of revisions, in descending order by date. Click on the "Revert" icon to the left of the revision that you want to revert to.
  4. Your record will be restored -- if you have permission.
Powered by Xataface
(c) 2005-2014 All rights reserved