My migration is
class AddUuidToUsers < ActiveRecord::Migration
def change
add_column :users, :uuid, :uuid, null: false, default: 'uuid_generate_v4()'
add_index :users, :uuid
end
end
The schema is changed with:
t.uuid "uuid", default: "uuid_generate_v4()"
As you see, we the null: false is not added, not sure why?
But when I try with a common column type for instance string it works well.
Is there any limitation for :uuid column type that we can't use null: false?
NOT NULLwith no issues. You could work around this problem by trying to usechange_column_null, tho I suppose it does not answer you question.