How could I make population unsigned?
def self.up
create_table :cities do |t|
t.string :name
t.integer :population
t.float :latitude
t.float :longitude
t.timestamps
end
end
step 1:
add activerecord-mysql-unsigned to GemFile
# add unsigned integer support to mysql2 adapter
gem "activerecord-mysql-unsigned", "~> 0.0.1"
step 2: install gems
bundle install
step 3:
use "unsigned: true" in fields you like
t.integer :cost, unsigned: true
refrence : http://rubydoc.info/gems/activerecord-mysql-unsigned/0.0.1/frames
This should work for you.
t.column :population, 'integer unsigned'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With