lundi 14 septembre 2015

RAILS: rake db:schema:dump produces useless file

Initial requirement was to store datetime values as bigints in database field. The following was added to environment.rb long ago. ActiveRecord::ConnectionAdapters::Mysql2Adapter::NATIVE_DATABASE_TYPES[:datetime]= "BIGINT UNSIGNED"

After that, when I run rake db:schema:dump, schema.rb file is updated without any errors. However upon opening schema.rb in a text editor, I can see that most of the lines appear the following way:

ActiveRecord::Schema.define(:version => 20150826040800) do

# Could not dump table "academic_class_subjects" because of following TypeError
#   can't convert Symbol into Integer

so on ...
end

One can see that the generated schema.rb file is pretty useless. Any solutions?

Aucun commentaire:

Enregistrer un commentaire