# Feature OP-12252 - Wayback Machine / in-app backup restoration

Project: OpenProject
Status: in specification
URL: https://community.openproject.org/work_packages/OP-12252

## Planning

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Target versions | Product Backlog |
| Sprint |  |
| Backlog bucket |  |
| Votes | 1 |
| List |  |
| Roadmap |  |
| Relevance |  |

## OPEN POINTS / FEEDBACK

_No work packages_

## Features and Chunks

_No work packages_

## Bugs and other work packages

| ID | Type | Subject | Status | Assignee | Target versions | Spent time | Module |
| --- | --- | --- | --- | --- | --- | --- | --- |
| OP-12832 | Task | Blog post about passion project: Wayback button for in-app backup restoration | closed | Christoph Zierz | Product Backlog |  |  |

## Technical Details

| Attribute | Value |
| --- | --- |
| Module |  |
| Feature Flag |  |
| Requires doc change | Yes |
| Enterprise plan |  |

## Details

| Attribute | Value |
| --- | --- |
| Pull preview |  |
| Mockups |  |
| Accessibility | No |

## People

| Attribute | Value |
| --- | --- |
| Assignee | Markus Kahl |
| Accountable |  |
| Product manager |  |
| Feature Lead |  |
| Developers |  |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Estimates and progress

| Attribute | Value |
| --- | --- |
| PD (min) |  |
| PD (max) |  |
| Work |  |
| Labor costs |  |

## Description

Right now when a user creates a backup, previous ones are discarded. With this feature we would instead hold on to past backups.

In the administration there would be a list of all past backups - for this it would also make sense if backups could be seen by more admin users than just the creator.

Next to each backup would be a "take me back" button. This then does the following.

  - it creates a new schema in the database
  - it imports the (database) backup into this schema
  - it sets a session variable like `current_schema`
  - the user then sees just the data from this schema, not the current (`public`) state
  - if this variable is set the user will be shown a special banner indicating that they are looking at a past state
      - this also includes a button to switch back to the present

### Additional thoughts

  - An **in-app restore backup** feature as the counterpart to the in-app backup feature could be an implicit result of this. With the ability to switch schemas it wouldn't be catastrophic if a user restored a wrong backup because they could switch back to the previous state
  - It may only make sense to support this if the backup also contains attachments (which could be restored to a separate folder), otherwise the state might be missing some. Of course we could check this in the import process and just allow db only backups if the attachments for it are all still present and match the checksum
  - Since we have a backup API, we could even allow importing another running OpenProject instance. Customers have actually asked for this before when migrating servers, or from on-prem to cloud or vice versa

### **UX Considerations**

  - Only instance admins can backup/restore; not possible at a project level.
  - Right now, backup tokens are user-specific. Does this make sense in the context of multiple backups?
      - Presumably, with this feature, we would display a list of past backups initiated by dfferent users. Logically, then, all users with the required permissions would be able to download these past backups.
      - Current permissions are still maintained/respected when previewing a backup.
          - Question: Does this mean that if a user was not an admin, or did not have certain priviledges in the past, that they STILL won't have it when previewing it?
              - Maybe: In this case, show a warning saying something like "You're not an admin in this backup, restoring it will revert to whatever permissions you had at this point in time."
              - Or, have an action/switch like "Make me admin in this backup" - but does this make sense?
  - When in "Preview" state, certain information be present:
      - **Table:**
          - When
          - By whom
          - *What it contains (with/without attachments?), perhaps this is not even an option*
          - Actions:
              - Preview
              - Restore (require preview?)
              - Delete
              - Download
          - Size
      - **Preview mode:**
          - Make obvious the user is viewing a past state (colour, banner)
          - Show info (when, who...) on the backup
          - Show options: restore, close preview.
          - Make it clear that restoring this will not lead to information loss, since the current state (before restore) will be saved as a new backup.
  - How does it work with storages (Nextcloud) and such?
      - Inline images are only attachments today, but storage files can be links
      - An older state might contain a link to a storage file that no longer exists or to which the user no longer has access: in this case, we could grey it out with an error message in the existing style. Something like: "Can't access this file, or file no longer exists."
  - Ability to import and ovewrite the existing state with the past state (but it's a package deal; can't cherry-pick).
  - Previews are not read-only per se. Data can be altered de facto, however it will be lost; it is not saved, it is not persistent.
      - Easier than implementing a read-only mode; unless that's easy to do.

### Cases

#### Restore last available backup

**Initial state:**

  - Backup1
  - Backup2
  - Backup3
  - Current

**Change:**

  - Restore backup3

**Effect:**

  - Current -\> Backup4
  - Backup3 -\> current
  - The restored backup, although previously backup3, is now the latest current state. All older backups are still accessible.

#### Restore an older backup

**Initial state:**

  - Backup1
  - Backup2
  - Backup3
  - Current

**Change:**

  - Restore backup1

**Effect:**

  - Current -\> Backup4
  - Backup1 -\> current
  - The restored backup1 (even if it was behind other backups) is now the latest current state. All older backups are still accessible, including backup4, which was current before restoring.

### Figma

<https://www.figma.com/file/wISiv3Lk0X2n0A9t6Cu76S/Passion-time-2023?type=design&amp;node-id=4-2>
