Restoring deleted apps

An administrator can restore a deleted app within seven days of the deletion. After seven days, you cannot restore the app.

Before you begin

  • Log in with the utest account on the virtual machine instance.
  • Important: Back up the IBM MobileFirst Quality Assurance system before you recover a deleted app or otherwise attempt to manipulate the database.

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:

  1. 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.
  2. On the command line, enter each of the following commands:
    1. cd ~
    2. . apphance/env/bin/activate
    3. cd apphance/project/src/apphance/
    4. 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)
  3. In the Python Interpreter shell, enter each of the following commands at the >>> prompt:
    1. from applications.models import Application
    2. application = Application.deleted_objects.get(id=ID_OF_DELETED_APP) where ID_OF_DELETED_APP is the ID of the deleted app.
    3. application.is_deleted = False
    4. application.save()
    5. 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.