An administrator can restore a deleted app within seven
days of the deletion. After seven days, you cannot restore the app.
About this task
Important: Use extreme caution. This procedure
involves direct manipulation of the MobileFirst Quality Assurance PostgreSQL database.
A mistake might irreparably damage the database.
Procedure
To restore a deleted app:
- Look up the ID of the deleted app in the database using
one of the following methods:
- If you have the api_key:
On the command line, enter psql
apphance -U apphance -c "SELECT id,name,api_key FROM applications_application,
where api_key='40 character key. The id for the
app with that api_key displays.
- If you do not have the api_key:
On the command line, enter psql
apphance -U apphance -c "SELECT id,name FROM applications_application
WHERE deleted;". The ID and name of all deleted apps displays.
Note: If you are prompted to enter a password for the apphance
database, enter apphance.
- On the command line, enter each of the following commands:
- cd ~
- . apphance/env/bin/activate
- cd apphance/project/src/apphance/
- python manage.py shell
The Python Interpreter shell opens and the following
message displays: Python 2.6.6 (r266:84292, Jul 10 2013, 22:48:45)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
- In the Python Interpreter shell, enter each of the following
commands at the >>> prompt:
- from applications.models import Application
- application = Application.deleted_objects.get(id=ID_OF_DELETED_APP) where ID_OF_DELETED_APP is
the ID of the deleted app.
- application.is_deleted = False
- application.save()
- exit() The
Python Interpreter closes.
For the deleted application, the value of the is_deleted column
in the applications_application table is set
to False. The deleted app
is restored.