Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sqlite support #21

Open
harmsk opened this issue Nov 28, 2012 · 9 comments
Open

sqlite support #21

harmsk opened this issue Nov 28, 2012 · 9 comments

Comments

@harmsk
Copy link

harmsk commented Nov 28, 2012

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?

@pyromaniac
Copy link
Collaborator

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

@harmsk
Copy link
Author

harmsk commented Nov 29, 2012

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

@pyromaniac
Copy link
Collaborator

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

@vsanta
Copy link

vsanta commented Apr 26, 2013

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

@pyromaniac
Copy link
Collaborator

Can you show related migrations?
Also rails version.

@vsanta
Copy link

vsanta commented Apr 29, 2013

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

@pyromaniac
Copy link
Collaborator

Please try t.uuid :id, primary_key: true

@vsanta
Copy link

vsanta commented Apr 29, 2013

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

@pyromaniac
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants