Search code examples
djangopostgresqlosqa

Restoring OSQA database to initial state


I installed OSQA using the bitnami installer and everything worked fine. Now, I am hacking at the osqa code base. If I need to restore the database to its initial state, do i need to reinstall OSQA or is there any command to truncate the database and load intial data.

I tried using use_osqa.bat and did a python.py manage migrate forum but it didnt work.

It uses a postgresql database


Solution

  • Finally, this worked for me. Note that this is applicable only for OSQA using the bitnami environment with postgresql database.

    if you want to restore your database state to the original version, first connect to postgres database using admin credentials(use any client, I used Dbeaver)

    database : postgres
    username : postgres
    password : **admin password** : this is the same password you gave while installing bitnami-osqa
    

    Now, drop the bitnami-osqa database and create it again(if you already have connections to bitnami_osqa, close them)

    Drop-database bitnami_osqa;
    Commit;
    
    Create-database bitnami-osqa;
    Commit;
    

    Now open use_osqa.bat in your bitnami root folder and execute the following

    cd apps\osqa
    python manage.py syncdb --all --verbosity 2
    [specify yes when it prompts to create super user and create some user]
    
    
    python manage.py migrate forum --fake