Content
View differences
Updated by Max Mutzge about 5 years ago
**As** an administrator / project administrator
**I want to** create backups on a project based level
**so that** project states can be saved and restored individually, without affecting other projects.
**Background** **Acceptance criteria**
* OpenProject backups can be created for the entire OP system only. Most likely you have plenty of projects in your OP database, but there's no way to create backups for just one project.
* So it's not possible to restore a project without restoring _all_ projects.
* That's why we're suggesting an SQL based backup and restore mechanism.
**Idea / Solution**
Roughly said: Creating a project based backup could be performed by feeding tables like this (rudimental pseudo code)
```SQL
SELECT * INTO myProjectBackup
FROM projects
WHERE project_id = 47
```
... followed by similar queries for all related tables containing references to project\_id 47 (work\_packages, types, statuses, assignees, many more)
Restoring would be done by first clearing any existing entries belonging to the project in question and inserting the contents of myProjectBackup afterwards, like so:
```SQL
DELETE FROM projects WHERE project_id = 47
SELECT INTO projects
FROM myProjectBackup
```
Again, this would need to be done for all related tables, as described above.
Though this might appear cumbersome on first sight, actually it's only a set of SQL statements reflecting the table dependencies.
As a desirable extra, this functionality would be integrated into the OP GUI. :D
**I want to** create backups on a project based level
**so that** project states can be saved and restored individually, without affecting other projects.
**Background**
* OpenProject backups can be created for the entire OP system only. Most likely you have plenty of projects in your OP database, but there's no way to create backups for just one project.
* So it's not possible to restore a project without restoring _all_ projects.
* That's why we're suggesting an SQL based backup and restore mechanism.
**Idea / Solution**
```SQL
SELECT * INTO myProjectBackup
FROM projects
WHERE project_id = 47
```
... followed by similar queries for all related tables containing references to project\_id 47 (work\_packages, types, statuses, assignees, many more)
Restoring would be done by first clearing any existing entries belonging to the project in question and inserting the contents of myProjectBackup afterwards, like so:
```SQL
DELETE FROM projects WHERE project_id = 47
SELECT INTO projects
FROM myProjectBackup
```
Again, this would need to be done for all related tables, as described above.
Though this might appear cumbersome on first sight, actually it's only a set of SQL statements reflecting the table dependencies.
As a desirable extra, this functionality would be integrated into the OP GUI. :D