unsafe_where_true
unsafe_where_true

Reputation: 6300

close to messing up my db on heroku: mysql error on db:pull

I think I am close to mess up my db on heroku

I am trying to download the remote DB on heroku by heroku db:pull

I get the following message:

news_items: 100% |==========================================| Time: 00:00:01 /usr/lib/ruby/gems/1.8/gems/sequel-3.13.0/lib/sequel/adapters/mysql.rb:169:in `query': Mysql::Error: Duplicate entry '3-Portfolio' for key 'index_unique_user_plugins' (Sequel::DatabaseError)

Will a re-index solve this problem or am I in trouble? I think to understand that it's my local db (as it's mysql throwing the error, while heroku runs PostgreSQL) which is complaining, thus there seem to be some duplicate keys in some index (not sure I really know what this means)

Upvotes: 0

Views: 237

Answers (1)

wuputah
wuputah

Reputation: 11395

I believe the problem is PostgreSQL treats strings as case-sensitive, while MySQL treats them as case-insensitive. This applies to unique indices as well. User 3 probably has a plugin named "Portfolio" and "portfolio".

The easiest solution is to change your index on Heroku to be non-unique. You can then easily import it into MySQL. Alternately, you can massage your data a bit so it is still unique. The easiest way to access the database on Heroku is the Heroku sql conole. Lastly, and probably the best option, is to use PostgreSQL locally, so your development environment matches your production environment.

Upvotes: 3

Related Questions