Sql Rails迁移缺少列
我试图重命名一个列,它肯定在模式中,所有的信息都在那里,但当我去更新它时,它会给我一个缺少列的错误,我不知道为什么?有什么想法吗 迁移:Sql Rails迁移缺少列,sql,ruby-on-rails,sqlite,ruby-on-rails-4,database-migration,Sql,Ruby On Rails,Sqlite,Ruby On Rails 4,Database Migration,我试图重命名一个列,它肯定在模式中,所有的信息都在那里,但当我去更新它时,它会给我一个缺少列的错误,我不知道为什么?有什么想法吗 迁移: class ChangeColumnName < ActiveRecord::Migration def change rename_column :postcodes, :type, :zip_type end end 错误: DL is deprecated, please use Fiddle DL is deprecated,
class ChangeColumnName < ActiveRecord::Migration
def change
rename_column :postcodes, :type, :zip_type
end
end
错误:
DL is deprecated, please use Fiddle
DL is deprecated, please use Fiddle
== 20150304172437 ChangeColumnName: migrating =================================
-- rename_column(:postcodes, :type, :zip_type)
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
Missing column postcodes.typeC:/Users/Steve Q/Documents/GitHub/project1/db/migrate/20150304172437_change_column_name.rb:3:in `change'C:in `migrate' ActiveRecord::ActiveRecordError: Missing column postcodes.type
我已尝试将类型列重命名为zip_类型,使其正常工作。另一个解决方案是,您可以删除类型列并将新列添加为zip_类型。也许您已经重命名了此列。检查数据库中的列。在rails控制台Postcode中尝试此操作。最后一个并超过此处的输出。因此列肯定就是该名称。我还没有任何记录,因为type是rails中的一个保留字,所以我想更改它。在我更改它之前,我无法提交数据来创建记录…现在我在activeadmin ExecJS::ProgramError中遇到了这个错误activeadmin::Deviate::Sessionsnew中也不确定发生了什么。
DL is deprecated, please use Fiddle
DL is deprecated, please use Fiddle
== 20150304172437 ChangeColumnName: migrating =================================
-- rename_column(:postcodes, :type, :zip_type)
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
Missing column postcodes.typeC:/Users/Steve Q/Documents/GitHub/project1/db/migrate/20150304172437_change_column_name.rb:3:in `change'C:in `migrate' ActiveRecord::ActiveRecordError: Missing column postcodes.type