Devise管理员角色:PG ::错误:错误:关系“管理员”已经存在 [英] Devise Admin Role: PG::Error: ERROR: relation "admins" already exists

查看:116
本文介绍了Devise管理员角色:PG ::错误:错误:关系“管理员”已经存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我按照这些说明(https:// github),在使用设备成功配置之后,我现在正在尝试添加一个管理角色。 com / plataformatec / devise / wiki / How-To:-Add-an-Admin-role)添加管理角色来设计,即使生成的迁移看起来与说明书完全不同。然后我运行bundle exec rake db:migrate只得到错误:

  PG ::错误:错误:关系管理员已经存在

此时我没有尝试安装rails_admin,因为我想要设计工作完全第一个。



任何想法,为什么我以前没有管理模型时会收到此错误?

解决方案

解决方案感谢wildplasser:运行db:drop - > db:create - > db:migrate重置数据库!


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?

解决方案

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

这篇关于Devise管理员角色:PG ::错误:错误:关系“管理员”已经存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆