How to activate history loggingXataface 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. How it worksIf 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 historySince 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] How to see older revisions of a recordFigure 2: Clicking the "plus" icon beside any row of the history list will show details about the record in that revision. 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.
How to revert to an earilier revision of a record
|