使用activerecord (< 5.0, >= 3.2)
,我能够使用activerecord-mysql-unsigned
gem在我的MySQL数据库中创建一个UNSIGNED INT,但是没有对该gem的更新,我在Rails 5中找不到任何关于本机支持的文档。
是否有一个选项哈希或者可以在add_column方法中调用的东西允许这样做?
从Rails 5.1.x开始,有一个无符号整数,bigint,decimal和float in the schema adapter for MySQL的选项
迁移中的这类内容将适用于Rails 5.1.4
def up
create_table :unsigned_columns do |t|
t.integer "positive", :unsigned => true
t.timestamps
end
end