Ruby on rails 从架构中删除表
这可能是一个相当基本的问题,但在安装了我决定不使用的gem之后,我不知道如何清理。在的安装过程中,安装说明说要运行Ruby on rails 从架构中删除表,ruby-on-rails,database,gem,rails-migrations,Ruby On Rails,Database,Gem,Rails Migrations,这可能是一个相当基本的问题,但在安装了我决定不使用的gem之后,我不知道如何清理。在的安装过程中,安装说明说要运行rake attachinary:install:migrations——在我的模式中创建一个新表和索引,如下所示: create_table "attachinary_files", force: :cascade do |t| t.integer "attachinariable_id" t.string "attachinariable_type"
rake attachinary:install:migrations
——在我的模式中创建一个新表和索引,如下所示:
create_table "attachinary_files", force: :cascade do |t|
t.integer "attachinariable_id"
t.string "attachinariable_type"
t.string "scope"
t.string "public_id"
t.string "version"
t.integer "width"
t.integer "height"
t.string "format"
t.string "resource_type"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "attachinary_files", ["attachinariable_type", "attachinariable_id", "scope"], name: "by_scoped_parent", using: :btree
我后来决定使用一个更简单的附件gem,我正在尝试清理和删除附件安装过程中创建的所有“东西”
关于如何清理数据库有什么建议吗?如果有什么不同的话,我正在运行Postgresql。创建迁移:
bundle exec rails g migration remove_attachinary
然后告诉Rails要做什么:
def up
drop_table :attachinary_files
end
删除默认情况下存在的change
方法
如果您希望此迁移是可逆的,请使用down
方法复制以前的代码