Open jvalrog opened 12 years ago
I'm also observing this issue (see below error). The same code worked under dm 1.0.2.
Here are my gem list: [root@mimic-scale rack]# gem list
* LOCAL GEMS *
addressable (2.2.8) bcrypt-ruby (3.0.1) daemon_controller (1.0.0) data_mapper (1.2.0) data_objects (0.10.8) dm-aggregates (1.2.0) dm-constraints (1.2.0) dm-core (1.2.0) dm-do-adapter (1.2.0) dm-migrations (1.2.0) dm-mysql-adapter (1.2.0) dm-serializer (1.2.1) dm-timestamps (1.2.0) dm-transactions (1.2.0) dm-types (1.2.1) dm-validations (1.2.0) do_mysql (0.10.8) fastercsv (1.5.5) fastthread (1.0.7) json (1.6.7) json_pure (1.6.7) multi_json (1.0.4) nokogiri (1.5.5) passenger (3.0.13) rack (1.4.1) rake (0.9.2.2) stringex (1.3.3) uuidtools (2.1.2)
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/dm-do-adapter-1.2.0/lib/dm-do-adapter/adapter.rb:114:in execute_non_query': Table 'cl_1.nodes' doesn't exist (DataObjects::SyntaxError) from /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/dm-do-adapter-1.2.0/lib/dm-do-adapter/adapter.rb:114:in
create'
from /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/dm-do-adapter-1.2.0/lib/dm-do-adapter/adapter.rb:276:in with_connection' from /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/dm-do-adapter-1.2.0/lib/dm-do-adapter/adapter.rb:113:in
create'
from /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/dm-do-adapter-1.2.0/lib/dm-do-adapter/adapter.rb:85:in each' from /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/dm-do-adapter-1.2.0/lib/dm-do-adapter/adapter.rb:85:in
create'
from /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/dm-core-1.2.0/lib/dm-core/repository.rb:146:in create' from /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/dm-core-1.2.0/lib/dm-core/resource/persistence_state/transient.rb:61:in
create_resource'
from /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/dm-core-1.2.0/lib/dm-core/resource/persistence_state/transient.rb:25:in commit' from /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/dm-core-1.2.0/lib/dm-core/resource.rb:956:in
_persist'
from /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/dm-core-1.2.0/lib/dm-core/resource.rb:970:in create_with_hooks' from /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/dm-core-1.2.0/lib/dm-core/resource.rb:967:in
catch'
from /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/dm-core-1.2.0/lib/dm-core/resource.rb:967:in create_with_hooks' from /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/dm-core-1.2.0/lib/dm-core/resource.rb:1021:in
save_self'
from /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/dm-core-1.2.0/lib/dm-core/resource.rb:1006:in _save' from /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/dm-core-1.2.0/lib/dm-core/resource.rb:1222:in
run_once'
from /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/dm-core-1.2.0/lib/dm-core/resource.rb:1005:in _save' from /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/dm-core-1.2.0/lib/dm-core/resource.rb:405:in
save'
from /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/dm-core-1.2.0/lib/dm-core/model.rb:717:in __send__' from /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/dm-core-1.2.0/lib/dm-core/model.rb:717:in
_create'
from /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/dm-core-1.2.0/lib/dm-core/model.rb:457:increate' from dm_create.rb:46 from dm_create.rb:44:in
each'
from dm_create.rb:44
from dm_create.rb:42:inopen' from dm_create.rb:42 from /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/dm-core-1.2.0/lib/dm-core.rb:263:in
repository'
from /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/dm-core-1.2.0/lib/dm-core/repository.rb:114:inscope' from /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/dm-core-1.2.0/lib/dm-core.rb:263:in
repository'
from /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/dm-core-1.2.0/lib/dm-core/core_ext/kernel.rb:20:inrepository' from dm_create.rb:39 from dm_create.rb:37:in
each'
from dm_create.rb:37
Same problem here as well. Anybody have an idea what could be the cause?
You are probably creating two in memory connection which isn't supported. You probably need to use a full path in the URL, if Sqlite can't open the file specified, it will fallback to an in memory connection.
Does this work properly if you use a full path in the url to a file for the database?
At least it does not work for me (with dm-core 1.2.1).
The changes to use full path look like:
DataMapper.setup(:default, "sqlite://#{Dir.pwd}/foo.sqlite")
DataMapper.setup(:lite, "sqlite://#{Dir.pwd}/foo2.sqlite")
It works if I auto_migrate the model in the repository block like this:
DataMapper.repository(:lite) {
Foo.auto_migrate!
Foo.create(:name => "bar")
}
thanks @fwolfst works for me!
I have this simple code using two sqlite stores:
Default repository works, but Lite repository throws this error:
Is this a bug?
I'm using recently updated gems:
and my ruby version: