我使用 Rails 4.0 和 Ruby 2.3.0
我有一个小的 Rails 应用程序。起初,我想根据每个用户注册的内容为他/她分配不同的角色。所以我从https://github.com/MartinJNash/Royce试用了“Royce”宝石
在看到它对我的要求来说太复杂后,我将其卸载。
然后我尝试了“简单角色”gem,看看它是如何从这里https://github.com/stanislaw/simple_roles工作的。我也卸载了tat。当我的应用程序中有这两个 gem 时,我运行了 db:migrate。
现在我不想在我的 schema.rb 中找到这两个 gem 的对应表。它并不完全干扰我的应用程序,但我想删除它们。
以下是我的 schema.rb 文件
ActiveRecord::Schema.define(version: 20160911213902) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
create_table "roles", force: :cascade do |t|
t.string "name"
t.integer "resource_id"
t.string "resource_type"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "roles", ["name", "resource_type", "resource_id"], name: "index_roles_on_name_and_resource_type_and_resource_id", using: :btree
add_index "roles", ["name"], name: "index_roles_on_name", using: :btree
create_table "royce_connector", force: :cascade do |t|
t.integer "roleable_id", null: false
t.string "roleable_type", null: false
t.integer "role_id", null: false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "royce_connector", ["role_id"], name: "index_royce_connector_on_role_id", using: :btree
add_index "royce_connector", ["roleable_id", "roleable_type"], name: "index_royce_connector_on_roleable_id_and_roleable_type", using: :btree
create_table "royce_role", force: :cascade do |t|
t.string "name", null: false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "royce_role", ["name"], name: "index_royce_role_on_name", using: :btree
create_table "sessions", force: :cascade do |t|
t.string "session_id", null: false
t.text "data"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "sessions", ["session_id"], name: "index_sessions_on_session_id", unique: true, using: :btree
add_index "sessions", ["updated_at"], name: "index_sessions_on_updated_at", using: :btree
create_table "users", force: :cascade do |t|
t.string "email"
t.string "name"
t.string "login_token"
t.datetime "login_token_valid_until"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "users_roles", id: false, force: :cascade do |t|
t.integer "user_id"
t.integer "role_id"
end
add_index "users_roles", ["user_id", "role_id"], name: "index_users_roles_on_user_id_and_role_id", using: :btree
create_table "vendors", force: :cascade do |t|
t.string "name"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "visits", force: :cascade do |t|
t.string "country"
t.datetime "visited_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
end
即使我已经卸载了 2 个角色-gems,每次我运行 rake db:migrate 时,我都会得到上述模式。
我只在我的应用程序中使用“会话”和“供应商”表。知道我应该怎么做才能摆脱这些不需要的表吗?