首页 > 解决方案 > 从 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 

标签: ruby-on-railssqlite

解决方案


可能不是最佳实践,但似乎为我解决的问题是从模式中删除,删除数据库rails db:drop创建一个新的rails db:create并迁移rails db:migrate 据我所知,一切顺利!


推荐阅读