Legacy Version
These are the docs for Directus 8, a legacy version of the platform. If you're looking for the current Directus 9 documentation, go here: https://docs.directus.io
Accountability
Directus stores detailed records of every change made to data through the App and API. This gives a comprehensive overview of who did what, and when.
System Fields
There are four system Interfaces (and their respective Field Types) that are important to accountability:
created_by
— Automatically saves the Directus User that created the item- This interface is required for
mine
androle
permissions
- This interface is required for
created_on
— Automatically saves the UTC datetime when the item was createdmodified_by
— Automatically saves the Directus User that last modified the itemmodified_on
— Automatically saves the UTC datetime when the item was last modified
Activity
This is a log of all platform activity. You can see a listing of all your activity within the App by opening the Activity page from the user menu. You can also see the full history for a specific item by opening the Info Sidebar on its Item Detail page.
There are several different types of activity that is tracked:
create
— An item is createdupdate
— An item is updateddelete
— An item is hard deletedrevert
— An item is reverted to a different revisionsoft-deleted
— An item's status is changed to a soft deleted optionauthenticate
— A Directus user signs inupload
— A file is uploaded to the File Librarycomment
— A comment was left on an item
Skip Activity Log
If you need to interact with data without saving to the activity log there is an API parameter to skip the activity log. This bypasses accountability and should be used judiciously.
Revisions
In addition to the activity log, every time an item is created or updated Directus creates a revision record. Each revision is stored within directus_revisions
and contains both a delta of changes and a full snapshot.
API Access
Item revision can be fetched from the API using the revisions endpoint. This is a 0-based index that allows for fetching revisions based on creation point or current state.
Revert
Revisions are stored within (and fetched from) the system schema. However to shift the actual database item to a different point in its revision history you would use "revert". While primarily used to roll-backwards in time, this can also be used to move forward. Whenever an item is reverted, new activity and revision records are created with a revert
action instead of update
.
You can use the API to revert an item, or you can revert through the App:
- Go to the detail page of the item you want to revert
- Open the Info Sidebar, expanding revisions it to see the diff
- Click on the "Revert" button to preview the revision
- Confirm the revert in the preview modal