我对rails很陌生,所以可能有一个简单的答案。我正在尝试将“user_category”列添加到我的“users”表中,该表引用“user_categories”表。我尝试了以下方法:
rails generate migration add_user_category_to_users user_category:integer
接着...
rails generate scaffold User_Category title:string description:text
但是在 rake db:migrate 我收到以下错误:
== CreateUserCategories: migrating ===========================================
-- create_table(:user_categories)
rake aborted!
An error has occurred, this and all later migrations canceled:
SQLite3::SQLException: table "user_categories" already exists: CREATE TABLE "user_categories" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "description" text, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
任何帮助,将不胜感激。