Ruby on rails 从Rails中删除具有单数名称的SQLite表
因此,我正在努力迁移到一个SQLiteDB-on-Rails中,最终以用户和用户表结束。如何在不删除用户的情况下删除它Ruby on rails 从Rails中删除具有单数名称的SQLite表,ruby-on-rails,sqlite,Ruby On Rails,Sqlite,因此,我正在努力迁移到一个SQLiteDB-on-Rails中,最终以用户和用户表结束。如何在不删除用户的情况下删除它 create_table "user", force: :cascade do |t| t.string "first_name" t.string "last_name" t.string "username" t.string "email" t.string "password" t.datetime "created_
create_table "user", force: :cascade do |t|
t.string "first_name"
t.string "last_name"
t.string "username"
t.string "email"
t.string "password"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
end
create_table "users", force: :cascade do |t|
t.string "first_name"
t.string "last_name"
t.string "username"
t.string "email"
t.string "password"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
end
可能不是最佳实践,但对我来说似乎解决了这个问题的方法是从模式中删除数据库,删除数据库
rails db:drop
创建一个新的rails db:create
并迁移rails db:migrate
就我所能说的,很好
drop\u table:user
可能不是最佳实践,但对于一个项目jsut开始或个人项目,这可能并不重要。我想说的是,将来创建一个rake任务,将用户表中的用户移动到用户表中,然后删除该表。