# DB Ownership / Wiping out Production

**URL:** <https://meta.discourse.org/t/db-ownership-wiping-out-production/113534>\
**Category:** Self-hosting\
**Created:** [4월 5, 2019, 11:32오전 UTC](https://meta.discourse.org/t/db-ownership-wiping-out-production/113534 "2019-04-05T11:32:18Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![pgr](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pgr/32/156783_2.png) [@pgr](https://meta.discourse.org/u/pgr)\
**Post date:** [4월 5, 2019, 11:32오전 UTC](https://meta.discourse.org/t/db-ownership-wiping-out-production/113534/1 "2019-04-05T11:32:18Z")

</div>

Hi. I’m trying to wipe out my production server, and I want to know what I am doing wrong (apart from “trying to wipe out my production server” which sounds really wrong, but it’s not really in production yet, I am just working on a migration).

I am using the Discourse Docker installation, which a colleague installed for me.

This is what I tried:

```plaintext
root@discourse:/docker-app/discourse# ./launcher enter app
root@discourse-app:/var/www/discourse# su - discourse

discourse@discourse-app:~$ cd /var/www/discourse
discourse@discourse-app:/var/www/discourse$ RAILS_ENV=production DISABLE_DATABASE_ENVIRONMENT_CHECK=1 bundle exec rake db:drop db:create db:migrate

PG::InsufficientPrivilege: ERROR: must be owner of database discourse
: DROP DATABASE IF EXISTS "discourse"
Couldn't drop database 'discourse'
rake aborted!

```

So I went to check if this ownership was really like it says and I got this:

```plaintext
discourse@discourse-app:/var/www/discourse$ psql
psql (10.5 (Ubuntu 10.5-2.pgdg16.04+1))
Type "help" for help.

discourse=> SELECT d.datname as "Name",
pg_catalog.pg_get_userbyid(d.datdba) as "Owner"
FROM pg_catalog.pg_database d
WHERE d.datname = 'discourse'
ORDER BY 1;
   Name | Owner
-----------+----------
 discourse | postgres
(1 row)

discourse=>

```

So my questions would be…

1. Is it wrong not to have the database ownership set to `discourse` user?

2. Did I do this setup error? Or maybe my colleague. But what I mean to ask is: isn’t this something that comes with the Docker container provided?

3. How to go past this roadblock?

Thanks in advance for any help! 🙂

---

_[View the full topic](https://meta.discourse.org/t/db-ownership-wiping-out-production/113534)._
