获取PG :: DuplicateTable:错误

时间:2017-08-14 20:47:10

标签: ruby-on-rails postgresql

获取PG :: DuplicateTable:错误并且无法弄清楚尝试出错的地方。

Running via Spring preloader in process 6376
== 20170814192757 CreateRestaurants: migrating 
================================
-- create_table(:restaurants)
rake aborted!
 StandardError: An error has occurred, this and all later migrations canceled:

PG::DuplicateTable: ERROR:  relation "restaurants" already exists
: CREATE TABLE "restaurants" ("id" serial primary key, "name" character 
varying, "rating" integer, "created_at" timestamp NOT NULL, "updated_at" 
timestamp NOT NULL)

尝试删除数据库并使用以下内容重新创建它。

rake db:drop db:create db:migrate

0 个答案:

没有答案