ruby-on-rails - 从 Rails 中删除具有单数名称的 SQLite 表
问题描述
所以我正在努力迁移到 Rails 上的 SQLite 数据库,并以某种方式结束了用户和用户表。如何在不删除用户的情况下删除它?
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
据我所知,一切顺利!
推荐阅读
- javascript - 如何强制用户从自动完成列表 php 和 jquery 中进行选择
- scala - 如何更改使用的默认时区:从 SQL Server 读取时 spark.read.jdbc
- html - 如果两个元素在可变宽度包装器中,则垂直对齐两个元素
- verilog - 始终不分配输出的循环
- java - 如何在列表视图中获取选中行的值,并获取首选文本字段?
- docker - Docker - 将 yum install 添加到基础镜像
- angular - 如何使 Ag-grid 在 Storybook 中工作
- ruby-on-rails - 未定义的方法“页面”
- angular - Angular - 在继承中使用变量作为类型
- haskell - 如何理解 case 表达式?