# Mislukte upgrade: UniqueViolation: dubbele sleutelwaarde schendt unieke beperking "data\_explorer\_queries\_pkey"

**URL:** <https://meta.discourse.org/t/failed-upgrade-uniqueviolation-duplicate-key-value-violates-unique-constraint-data-explorer-queries-pkey/163667>\
**Category:** Self-hosting\
**Created:** [10 september 2020 om 19:30 UTC](https://meta.discourse.org/t/failed-upgrade-uniqueviolation-duplicate-key-value-violates-unique-constraint-data-explorer-queries-pkey/163667 "2020-09-10T19:30:26Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![omarfilip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/omarfilip/32/208019_2.png) [@omarfilip](https://meta.discourse.org/u/omarfilip)\
**Post date:** [10 september 2020 om 19:30 UTC](https://meta.discourse.org/t/failed-upgrade-uniqueviolation-duplicate-key-value-violates-unique-constraint-data-explorer-queries-pkey/163667/1 "2020-09-10T19:30:26Z")

</div>

Today’s upgrade to latest failed:

```
FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 3194 exit 1>
Location of failure: /pups/lib/pups/exec_command.rb:112:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"db_migrate", "cmd"=>["su discourse -c 'bundle exec rake db:migrate'"]}
590cf0611c566ea6df5f70ffdd2cec2359e84eaea29b7abcde77d56288a46370
**FAILED TO BOOTSTRAP** please scroll up and look for earlier error messages, there may be more than one.

```

Above in the log:

```
Caused by:
PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "data_explorer_queries_pkey"
DETAIL: Key (id)=(-10) already exists.

```

and

```
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

ERROR: duplicate key value violates unique constraint "data_explorer_queries_pkey"
DETAIL: Key (id)=(-10) already exists.

```

So, I suppose I need to get rid of the duplicate `data_explorer_queries_pkey` key.

How do I do that?

---

_[View the full topic](https://meta.discourse.org/t/failed-upgrade-uniqueviolation-duplicate-key-value-violates-unique-constraint-data-explorer-queries-pkey/163667)._
