设置:
rails: 4.2.5.1
ruby: 2.2.4p230 (2015-12-16 revision 53155) [i386-mingw32]
windows 7 environment
数据库.yml:
default: &default
adapter: mysql2
encoding: utf8
database: "database"
username: "name"
password: "password"
host: "host"
port: 3306
development:
adapter: mysql2
encoding: utf8
database: "database"
username: "name"
password: "password"
host: "host"
port: 3306
我正在尝试使用 RDS 上现有的 mysql 数据库。我使用
创建了一个新项目
rails new "app"
然后尝试获取数据库架构。
当我运行时
ruby bin\rake db:schema:dump
对于数据库中的每个表,我的 schema.rb 文件中的输出都充满了相同的错误:
ActiveRecord::Schema.define() do
# Could not dump table "test" because of following NoMethodError
# undefined method `type' for "int(11)":String
end
我一开始以为可能是因为int(11)是64位整数,后来了解到int(11)中的“11”指的是显示大小,而且它仍然是32位整数。
任何人都可以解释为什么会发生这种情况,或者为什么 ruby 无法识别主键列的 32 位整数类型。
最佳答案
关于mysql - db :schema:dump on RDS with mysql. 错误:无法转储表 "",因为以下 NoMethodError 未定义方法 `type' for "int(11)":String,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40287809/