activeuuid icon indicating copy to clipboard operation
activeuuid copied to clipboard

sqlite support

Open harmsk opened this issue 11 years ago • 9 comments

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?

harmsk avatar Nov 28 '12 21:11 harmsk

Is sqlite you have the latest version? Is it sqlite3?

pyromaniac avatar Nov 29 '12 02:11 pyromaniac

I've got jruby 1.6.7.2, rails 3.1.4, sqlite3 1.3.6, activerecord-jdbcsqlite3-adapter 1.2.2.1.

harmsk avatar Nov 29 '12 03:11 harmsk

С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.

pyromaniac avatar Nov 29 '12 03:11 pyromaniac

I'm having the same problem using sqlite3 gem. Do you know what may be happening?

vsanta avatar Apr 26 '13 21:04 vsanta

Can you show related migrations? Also rails version.

pyromaniac avatar Apr 27 '13 01:04 pyromaniac

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

vsanta avatar Apr 29 '13 13:04 vsanta

Please try t.uuid :id, primary_key: true

pyromaniac avatar Apr 29 '13 13:04 pyromaniac

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

vsanta avatar Apr 29 '13 14:04 vsanta

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.

pyromaniac avatar Apr 29 '13 14:04 pyromaniac