Moved to a different github repo
Bbse classes to use on Persistent (table) classes for InterSystems IRIS to keep record history
These classes enable the historizing of persistent class records into another persistent class when touched.
This provides for a full history of any record.
It allows for record rollback to a specific version.
It can automatically purge old history records.
zpm “install csoftsc-persistent-audit”
The usage sample is available in the GitHub repo
git clone https://github.com/csoft-sc/iris-table-audit.git
docker-compose build
docker-compose up -d
docker-compose exec iris iris session iris -U IRISAPP
Do ##class(csoftsc.Demo.RunDemo).Run()
Do ##class(csoftsc.Demo.RunDemo).Run()
Path | Purpose |
---|---|
/src/csoftsc/PersistentAudit | Source to use and include in your deployment |
/src/csoftsc/Demo | A demonstration of usage |
The generated triggers are set to run on row/object, which means it applies to Object-level and SQL operations.
The triggers are orderred at number 10, which means you can still let your own triggers execute before or after the historization triggers.
To disable the auto historizing of records for a Persistent Class, set the ^PersistentAuditOff(“MyPackage.ClassName”) to 1
e.g. ^PersistentAuditOff("csoftsc.Demo.Customer") = 1
To keep only a specific number of history records, set the ^PersistentAuditAutoPurge(“MyPackage.ClassName”) to the number of history records to keep
If not set, or tod less than or equal to 0, auto archiving will not be done.
e.g. ^PersistentAuditAutoPurge("csoftsc.Demo.Customer") = 2
The class that extends from the base will contain two class methods that are available as Stored Procedures as well.
Set tSuccess = ##class(csoftsc.Demo.Customer).RestoreVersion(tCust.%Id(),4)
&sql(:tSuccess = call csoftsc_Demo.Customer_RestorePreviousVersion(:tId))
We use SemVer for versioning. For the versions available, see the tags on this repository.
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the https://github.com/baasvancodeza/iris-table-audit/blob/main/LICENSE file for details.