Database Scripts

In the 2025.1 release, several scripts have been created to help tidy up the database and maintain more accurate records within Care Partner. Additionally, there are scripts that can be utilised for basic reporting, such as generating lists of login times.

We have also reviewed our script repository and identified some existing scripts that were developed prior to the 2025.1 release - but which we believe could benefit admin users and database administrators working with Care Partner teams - so these have also been included below.

Admin Audit Script

  • This script is designed for Care Partner systems where audit records have been cleared from a production environment and archived. It allows users or database administrators to run the script, producing output in the same style as the Care Partner UI.
  • While it can generate an audit report directly from the database, this functionality is also available within Care Partner.

Auto close forms script

  • This script, specifically developed for the 2025.1 release, enables the closure of open forms on demand when executed. It will close any forms that have been open longer than a parameter set in the script, termed @DaysOpen.
  • For instance, if set to 30, the script will close any form that has been open for over 30 days in the database.
  • This script will only impact Assessments, Activities & Contact Records.
  • This will not affect forms with mandatory items, and an audit record will be created to inform admin users about which forms were closed.

Close historical OPD forms

  • This script, also developed for the 2025.1 release, functions similarly to the auto close forms script but specifically targets historical OPD forms. It can be run as a database maintenance task in conjunction with a resolved issue relating to OPD forms in this release, thereby preventing the issue from recurring going forward.

Clear down bulk export tables

  • This script is intended to clear out historical bulk export tables. This process is beneficial when there are many historic exports that do not need to be retained in the database, as it can improve the performance of the service user’s export history page and facilitate faster loading times after execution.
  • Please note that this is a destructive script, meaning it will manipulate and remove data from the database. Ensure that necessary backups are taken before running such a script.

Form instance counts for service user

  • This script executes a simple select statement using a temporary table to provide quick access to the number of form types open for a specific service user. It helps gain metrics on the data assigned to a service user without requiring data filtering.

Inactive service users with open involvements

  • As part of the 2025.1 release, validation has been included to prevent the deactivation of a service user record while open involvements exist. For historical cases where the involvement remains open for a deactivated service user, this script acquires the necessary information for admin users to resolve the issue.

If any of the scripts above could be beneficial, please contact a member of the team, and the script will be provided.