Hi,
I can’t manage to get an unsigned int column with activerecord
migration, I am using this definition:
create_table :emails, :use_big_id => true do |t|
t.column “destination”, :string, :limit => 60, :null => false
t.column “object”, :string, :limit => 200, :null => false
t.column “options”, :string, :null => false
t.column “created_at”, :datetime, :null => false
FK
t.column “user_id”, :bigint, :unsigned => true, :null => false
end
isn’t the “:unsigned => true” supposed to create an unsigned column ?
If you’re absolutely sure you’re going to be using a DBMS that supports
it,
you can use
t.column :my_unsigned_int, :"int unsigned"
to get what you want. If you need something other than the default limit
on
int there…
t.column :my_unsigned_int, :"int(24) unsigned"
should do the job.
RSL
Thanks for your answer, I will try that.
I am using mysql and it won’t change on this project.
For me it makes total sense to use “unsigned” in primary/foreign keys
definitions whenever the DB supports it.
There is even a patch for this:
http://dev.rubyonrails.org/ticket/5219
Discussion about this topic:
http://www.ruby-forum.com/topic/155218