> For the complete documentation index, see [llms.txt](https://help.security.gallagher.com/knowledge-hub/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.security.gallagher.com/knowledge-hub/configuration-client/licensable-features/shifts/purging-shift-history.md).

# Purging Shift history

### Introduction

The Command Centre database keeps historical records of:

* Shift items that have been deleted,
* The previous configurations of Shift items that have had configuration on their 'Shifts' tab changed, and
* Associations between Cardholders and Shifts that have since been removed (i.e. it keeps a memory of when a Cardholder was assigned to a Shift, even after the Cardholder is un-assigned).

This is so that Time Reports and Time Report - Overviews can report on Shift information for dates in the past, even after the Shifts have been un-assigned from Cardholders, re-configured, or deleted. Since this takes up space in the Command Centre database, you can optionally configure Command Centre to purge this historical information after a certain number of days since the Shift was unassigned or deleted. You may, for example, decide that you will never wish to report on Shifts that were worked more than 1 year ago, so you configure the system to purge Shift information that has been 'historical' for more than 365 days.

* After the configured number of days have passed since a Shift item was deleted, it is purged so that it can no longer appear in Time Reports or Time Report - Overviews that report on the period during which the Shift existed.
* After the configured number of days have passed since a Cardholder was un-assigned from a Shift, the Cardholder-Shift association is purged so that the Cardholder can no longer be reported as having worked that Shift in Time Reports or Time Report - Overviews that report on the period during which the Cardholder was assigned that Shift.

The automated purge (if enabled) runs daily. The ability to purge Shift history is only available at system level, therefore where the system is used by multiple companies, it will not be possible for them to purge Shift history according to different "number of days" settings.

You can configure the parameters for when Shift history gets purged from the system via the **Database Maintenance** tab in the Server Properties. See [Database Maintenance](https://help.security.gallagher.com/knowledge-hub/configuration-client/site-installation/server-properties/database-maintenance.md) for details.

**Notes:**

* The "purge process" can be disabled.
* In a multi-server system, Shifts are not replicated, so the purge needs to be run on *each* server using Shifts.

### Operation

Only *historical* Shift items, Shift configurations, and Cardholder-Shift associations get deleted. The following do **not** get deleted as part of the purge:

* Cardholder records (active or historical)
* Active (non-deleted) Shift items
* Active Cardholder-Shift associations
* Events.

An event is logged when the purge starts and another when the purge completes.

If the purge process encounters a Shift history which cannot be deleted, it will skip that history and continue deleting the others. A message will be logged to the log file showing any available information on why the Shift history failed to delete, and the "purge process" will try to delete the history again during its next run (i.e. the next day).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.security.gallagher.com/knowledge-hub/configuration-client/licensable-features/shifts/purging-shift-history.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
