Restoring a deleted OpenProject project

Recover one accidentally deleted OpenProject project from a backup without rolling back the whole instance, using a second database, a controlled import and a hierarchy rebuild.

On this page

How to restore a deleted OpenProject project without rolling back the instance

To recover one deleted OpenProject project without reverting the whole instance, restore a backup into a separate openproject_backup database, extract the project's rows into missing_ tables, and import them into the live database with a restore script inside a single transaction. This is the path OpenProject documents for a single deleted project, and it lets the rest of the instance keep its current data. The reader's situation is usually the same: one team's project vanished, other teams kept creating work packages, comments and time entries, and a full restore from an older backup would silently discard all of that. Before starting, confirm the exact steps for your installed release in the OpenProject docs for restoring a deleted project, because the table names and script usage are specific to the documented procedure.

Use this path when the deletion is recent enough that a usable backup exists, the project matters more than the activity that happened after the backup was taken, and the affected project can be identified cleanly. Gather the project identifier, the backup timestamp, and a list of users and project members who worked in the project after the backup, so you can judge which changes will be missing. Test the procedure first on a copy of the instance, not on production. The method does not replace your backup strategy: it depends on a working backup of the database and attachments, it does not recover data that was never backed up, and it does not make the project's history identical to the state before deletion. Plan to confirm with your team which post-backup changes are lost and whether they need manual re-entry.

After the import, check the project hierarchy. If subprojects or the tree of work packages look wrong, the documented remedy is to clear the restored project's lft and rgt values and run Project.rebuild! in the OpenProject console. Verify membership, roles, work package counts, attachments and linked files before announcing the recovery to users, and record who approved the import and what was excluded. Keep the original backup and the extraction output until the team confirms the project is correct, and treat the procedure as a recovery exercise that should be rehearsed before it is needed in an incident.

Which recovery path fits which deletion scenario

This table compares a full instance restore to a point in time, a single-project restore through a second database, and recreating the project by hand. Read each column to see what the path rolls back, who it affects and when it fits the deletion you are dealing with. The main takeaway is that restoring one project through a second database avoids rolling back other work, but it still needs careful extraction and a hierarchy check afterwards.

FactorFull instance restoreSingle-project restore via second databaseManual recreation
When it fitsDeletion is part of wider corruption or the instance itself is damagedOne project was deleted and other projects changed since the backupBackups are missing or too old, and the project content is small enough to rebuild
What it rolls backAll data written after the backup, for every user and projectNothing in the live instance, only the rows imported for the one projectNothing, but original work packages, history and attachments are not restored
Who is affectedAll users, during downtime and after the restore pointOnly the project's members, plus anyone who edited it after the backupProject members who must re-enter work and re-link references
Main effort driverDowntime window and confirming the restore point with stakeholdersExtracting the project's rows from the backup database and testing the importVolume of work packages, attachments and history to reconstruct by hand
Hierarchy riskLow, because the full database comes back as a unitModerate, because subproject nesting may need a rebuild of lft and rgt valuesLow, because the structure is created new, though parent links must be set manually
Data loss riskRecent changes from other projects are lostChanges made to the deleted project after the backup are lostOriginal IDs, comments, history and attachments are usually lost
What to confirm firstBackup age, restore procedure and who approves the rollbackBackup contains the project, versions match, and a test restore worksWhat exports exist and whether anyone holds the original content

How the backup, extraction and import steps connect

The flow starts with a backup file restored into a separate openproject_backup database, so the live instance is never rolled back. The project's rows are extracted into missing_ tables, then a restore script imports them into the live database inside one transaction. If the project hierarchy looks wrong afterwards, the documented fix clears the restored project's lft and rgt values and runs Project.rebuild! in the console. Check the transaction result and the hierarchy before you hand the project back to its team.

Data moves from the backup into a scratch database, then into the live database in one transaction.

Restoring the project step by step

This sequence brings one deleted project back into a live OpenProject instance without rolling back other data. Each step ends with a check, so you only continue once the previous result is confirmed.

  1. Confirm the backup contains the project

    Check that the backup you plan to use was taken before the project was deleted and still contains its work packages, memberships and attachments. Ask the person who ran the deletion for the approximate time, then compare it with the backup timestamp. Record the project identifier, the deletion point and the expected work package count in the change ticket. Done when you can name a backup that predates the deletion and the project identifier appears in it. The restoring a deleted project guide describes the procedure these steps follow.

  2. Freeze writes on the live instance

    Ask users to stop editing, or place the instance in a maintenance window, so no new rows are written while the restore runs. Confirm that background jobs are paused or idle so no changes land during extraction. Take a fresh backup of the live database before you change anything, so the current state can be recovered if a later step fails. Done when users are blocked from editing and you hold a dated copy of the current state.

  3. Create the openproject_backup database

    Create a separate PostgreSQL database named openproject_backup on the same server as the live instance, owned by a role that can restore into it. Keeping it separate means the restore cannot overwrite production data. Confirm that the server runs PostgreSQL 16 or later and that the pg_trgm, btree_gist and unaccent extensions are available to the new database. Done when the empty database exists and the three extensions are installed in it.

  4. Restore the backup into the new database

    Load the backup into openproject_backup using the restore method that matches your backup format. Use the same OpenProject version as the live instance so the schema and data line up. Wait for the restore to finish and keep the full output, including any warnings. Done when the restored database contains the project in the projects table and the identifier matches the one you recorded in step one.

  5. Extract the project's rows into missing_ tables

    Copy the rows that belong to the project from the restored database into the missing_ tables. These cover the project itself and related records such as work packages, journals, memberships and attachment references. Follow the table list in the documentation and do not reconstruct it from memory. Record the row count for each table. Done when every missing_ table you need holds rows and the counts match the work package and membership numbers you expected from the backup.

  6. Run the restore script in one transaction

    Run the restore script from the documentation, which imports the missing_ rows into the live database inside a single transaction. Because the import is one transaction, a failure rolls back every change and leaves the live data as it was. Keep the script output and any error text for your records. Done when the script reports a successful commit and the project appears in the live instance with its work packages.

  7. Rebuild the project hierarchy if needed

    Open the project list and check where the restored project sits among its parent and child projects. If the hierarchy looks wrong, clear the lft and rgt values of the restored project only, then run Project.rebuild! in the OpenProject console to recalculate the tree. Compare the result with the hierarchy you recorded before deletion. Done when parent and child projects appear in their original positions.

  8. Verify the project and reopen writes

    Compare the live project with the backup using row counts for work packages, members, versions and attachments. Spot check several work packages, comments and file links, and ask two or three project members to confirm access and content. Once the checks pass, lift the write freeze and tell users the project is back. Done when the counts match, the members have signed off and users can edit again. Keep the backup database until the owner confirms that no further restore is needed, then remove it under your retention policy.

Fixing a hierarchy that looks wrong after the import

The restore script can leave the restored project in the wrong place in the project tree. The documented fallback resets the tree values for that project and rebuilds the hierarchy from the parent links, so the work is small but touches shared production data. The cards below cover when to use it, how to run it safely, and how to confirm the result.

When the fallback applies

Use this only after the import itself has succeeded and the restored project appears in the wrong position, with missing or misplaced subprojects or a tree view that does not match the parent links. The fallback targets the nested-set values, lft and rgt, of the restored project. Confirm the parent relationship first, because a wrong parent is a different problem that a rebuild will not fix.

Restore docs

Risks of console changes

Running Project.rebuild! in the production Rails console recalculates the tree for every project, not only the restored one. A typo, a wrong environment or an interrupted session can leave the whole hierarchy inconsistent. Record who ran the command, when, and against which database, and keep a current backup taken immediately before the change.

Rehearse on a copy first

Run the complete sequence on a copy of the instance restored from the same backup, using the same OpenProject version. Compare the project tree before and after, and note the exact commands that worked. A rehearsal shows whether the fallback is needed at all and gives the operator a tested runbook, so the production run has no open questions.

Confirm subprojects and tree views

After the rebuild, open the restored project and check its parent, its direct subprojects and their order. Then check the project list, the project tree in the navigation, and any roadmap or portfolio view that depends on hierarchy. Spot-check work packages in a subproject to confirm they still belong to it and that permissions for members are unchanged.

Verify with a second pass

Ask a user who belongs to the restored project to log in and review their access, and compare project counts and membership with the rehearsal copy. Keep the restore notes with the change record so auditors and project owners can see what was altered. If the tree still looks wrong after a clean rebuild, stop and escalate rather than repeating console commands.

Questions teams ask before restoring a deleted project

How long does restoring a deleted OpenProject project take?

The duration depends mainly on how much work sits between the backup and the deletion, how large the project's data is, and how many people must review the result before users see it. Each stage carries its own effort: locating a usable backup, restoring it into the separate database, extracting the project's rows, importing them, and checking the hierarchy. Ask any partner for a timeline that lists these stages separately, and ask what they assume about your backup format, database size and approval steps. Timelines should come from the written scope, not from a general estimate.

Can our internal administrators restore a project without outside help?

Yes, a team with database and OpenProject administration skills can follow the documented procedure, provided it has a recent backup, a second database to restore into and access to the Rails console. The steps involve extracting rows and importing them in one transaction, so mistakes are costly to unpick. Confirm that at least one person has done a restore test before a real incident, and that someone can review the imported rows before they go live.

What does a partner's fixed-scope restore cover?

A fixed-scope engagement covers the agreed project, the agreed backup source and the agreed deliverables, and it is documented in writing before work starts. Typical items include reviewing the backup, restoring it into the separate database, extracting and importing the project, rebuilding the hierarchy if needed, and handing back a short record of what changed. Anything outside that list, such as restoring other projects, repairing unrelated data or changing backup routines, should be named as a separate item in the scope.

Can the restore be tested on a copy before it touches the live instance?

Yes, and this is the safest order of work. The backup can be restored into a non-production OpenProject environment built from the same release, so the extracted rows and the rebuilt hierarchy can be inspected without affecting users. Ask whether the test environment matches your production version, PostgreSQL setup and attachment storage, because differences there can hide problems. Only the final import into the live database should happen after the test result has been reviewed.

What information must the team provide before a restore starts?

The team should supply the name or identifier of the deleted project, the approximate deletion time, the backup set that covers that time, the OpenProject version running at backup and at restore, and the database connection details for a separate restore database. It should also name the people who approve the import and the window in which users can be asked to pause edits. Without these facts, the restore starts with investigation rather than execution, which adds time.

Could restoring one project change other projects or users?

It can, if the work is done carelessly. The procedure imports rows into the live database, and the project hierarchy is stored as nested values, so a wrong rebuild can shift the positions of other projects. Users, memberships and work packages that changed after the backup may also conflict with the restored data. Before importing, check which records the project shares with others and confirm the documented hierarchy step only affects the restored project. Keep the pre-restore database backup so the change can be reversed.

Does the restore need downtime, and what should we check afterwards?

Whether downtime is needed depends on how the import is run and how active the project is during the transaction, so confirm the exact plan with your administrators or partner. Afterwards, check that the project appears in the project list, that its work packages, versions and attachments are present, that memberships are correct, and that the project hierarchy displays as expected in the navigation and Gantt views. Keep notes on the outcome for audit and for future incidents.

Protecting projects before the next deletion

The most effective way to shorten a future project recovery is to make sure a recent, tested backup exists and that fewer people can delete a project in the first place. Backup scheduling and restore testing decide how far back you can recover and how confident you are that the recovery will work when it is needed. Set the backup schedule so that the newest restorable state is no older than the window your teams can tolerate losing, and record the schedule alongside the project data it covers. The backup command, its output and the restore testing steps are covered in the sibling topic on OpenProject backup and restore, so follow that guide rather than improvising a procedure during an incident.

Restore testing matters because a backup you have never restored is an assumption, not a recovery option. Run the restore into a separate copy of the database on a non-production host at a regular interval, then confirm that the target project's work packages, attachments and hierarchy look as expected. Ask your team to confirm the exact database name, the extensions your PostgreSQL version needs and the attachment storage path before the first test, since a restore that works on paper can fail on a missing extension. Keep the test copy isolated from users and from outbound email so that restored data cannot notify anyone.

Deletion permissions are the second control. Review which roles can delete projects in your instance and limit that permission to the smallest group that needs it, usually a small set of administrators rather than every project manager. Confirm that project administrators understand that archiving a project is a reversible alternative for most cases and that deletion removes the project's data from the live database. Where your identity provider or directory assigns project roles, check that group changes do not silently grant deletion rights. These steps cannot prevent every mistake, but they reduce how often a deletion reaches the point where this restore path is needed.

How DeployOpen works on this

DeployOpen treats a deleted project as a bounded recovery job inside your own OpenProject instance, not a reason to roll back everything else. We agree the scope in writing, rebuild the project in a separate database first, and hand over the restored project with the steps your team needs to repeat the work.

How we scope

  • Confirm which project was deleted, when, and which backup holds the most recent usable state of it.
  • Agree in writing which work packages, attachments, members and related records must come back.
  • Check the OpenProject version and PostgreSQL version of the backup against the live instance before work starts.
  • Identify users, groups and custom fields that changed since the backup so the import does not conflict.
  • Engagements are fixed-scope, so the written scope sets deliverables and timelines before any restore begins.

How we build

  • Restore the backup into a separate openproject_backup database so the live database stays untouched during analysis.
  • Extract the deleted project's rows into missing_ tables and review them against the agreed scope.
  • Run the import script inside a single transaction on the live database, so a failed import leaves no partial project.
  • Clear the restored project's lft and rgt values and run Project.rebuild! if the hierarchy looks wrong afterwards.
  • Test the restored project against the agreed checklist on a staging copy before the change touches production.

How we hand over

  • Deliver a written record of the backup used, the tables extracted, the rows imported and the commands run.
  • Provide the restore script and the verification checklist so your own team can review or repeat the procedure.
  • Document any records that could not be restored, with the reason and the manual steps left for your team.
  • Walk your administrators through the post-restore checks, including membership, permissions and attachment access.
  • Store the runbook alongside your backup procedures so the next recovery starts from tested steps.

How we support

  • Offer follow-up review if users report missing links, hierarchy problems or wrong permissions after the restore.
  • Plan a retest of the restore procedure on your current backup set so you know it works before you need it.
  • Available as a retainer for ongoing support, upgrades and continuous testing of your OpenProject instance.
  • Ask for a quote that separates the analysis, import and verification effort so you can compare it with your own team's time.
  • Confirm with your team how long backups are retained and who approves a production import before a restore is scheduled.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.