Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Devise Admin Role: PG::Error: ERROR: relation "admins" already exists

After successfully configuring devise with users I am now trying to add an Admin role in preparation of using rails_admin.

I followed these instructions (https://github.com/plataformatec/devise/wiki/How-To:-Add-an-Admin-role) to add the admin role to devise even though the migration generated looked completely different from that in the instructions. I then ran "bundle exec rake db:migrate" only to get the error:

PG::Error: ERROR:  relation "admins" already exists

At this point I had not attempted to install rails_admin because I wanted to get devise working fully first.

Any ideas why I got this error when I did not previously have an admin model?

like image 656
LightBox Avatar asked Dec 16 '22 15:12

LightBox


1 Answers

Solution thanks to wildplasser: run db:drop -> db:create -> db:migrate to reset the database!

like image 101
LightBox Avatar answered May 08 '23 10:05

LightBox