activeuuid
activeuuid copied to clipboard
sqlite support
For development, sqlite doesn't seem support in the latest version of this gem.
My schema shows this:
Could not dump table "foo" because of following StandardError
Unknown type 'binary(16)' for column 'bar'
Instead of type binary(16) could we instead use: t.binary, :limit => 16 for sqlite?
Is there some reason this wouldn't work?
Is sqlite you have the latest version? Is it sqlite3?
I've got jruby 1.6.7.2, rails 3.1.4, sqlite3 1.3.6, activerecord-jdbcsqlite3-adapter 1.2.2.1.
Сlear. Activeuuid is adapter-dependent feature. As you can see here https://github.com/jashmenn/activeuuid/blob/master/lib/activeuuid/patches.rb#L117 - only native AR sqlite3 adapter is supported, so you can implement similar patch for your adapter or just try to apply existing sqlite pathces to your adapter - thre is a chance it is compatible.
I'm having the same problem using sqlite3 gem. Do you know what may be happening?
Can you show related migrations? Also rails version.
Sure.
Rails 3.2.13 and sqlite3 (1.3.7)
migration
class CreateDesigners < ActiveRecord::Migration def change create_table :designers, :id => false do |t| t.uuid :id, :unique => true t.string :name, :null =>false t.string :data_source end end
end
Please try t.uuid :id, primary_key: true
Oops. It did not work. Now the generated schema does not have ids
create_table "designers", :force => true do |t|
t.string "name", :null => false
t.string "data_source"
end
Yes, it is not nessesary to set primary_key on model level. And yes, there is no id key in schema. Rails schema dumper wasn't hacked yet - it is too hardcoded. Also, you can use sql schema as a temporarly solution. Maybe, sometime, we will fix schema dumper to understand non-integer primary keys.