Purging user data from dev install

Importing Restoring a backup will overwrite all data, if that’s all you need.

If you need a fresh empty database and you’re using the docker setup, you can do this:

./launcher enter app

# in the container as root now

sv stop unicorn

su postgres -c 'psql -c "drop database discourse"'
# or keep it: "alter database discourse rename to discourse_backup"

su postgres -c 'createdb discourse'
su postgres -c 'psql discourse -c "grant all privileges on database discourse to discourse;"'
su postgres -c 'psql discourse -c "alter schema public owner to discourse;"'
su postgres -c 'psql discourse -c "create extension if not exists hstore;"'
su postgres -c 'psql discourse -c "create extension if not exists pg_trgm;"'

RAILS_ENV=production rake db:migrate

sv start unicorn