chrismccord / labrador

A loyal data retriever for your Rails development databases.
http://chrismccord.github.com/labrador/
253 stars 15 forks source link

No tables found with SQLite #3

Closed adampope closed 12 years ago

adampope commented 12 years ago

Im using the standard SQLite adapter from a new Rails app and when I load Labrador I get a blank DB browser with no tables or data.

If I hit the refresh button I get

requesting [missing %{collection} value]

I've tried adding blank username/password and empty strings as suggested on the Postgres issue #2 but that hasn't done anything.

I ran labrador with rails s and can see this in the console

Started GET "/~/assets/ico/favicon.ico" for 127.0.0.1 at 2012-09-06 16:27:33 +0100 Processing by PagesController#home as Parameters: {"path"=>"~/assets/ico/favicon"} Completed 500 Internal Server Error in 0ms

Errno::ENOENT (No such file or directory - /Users/adampope/assets/ico): lib/labrador/app.rb:18:in open' lib/labrador/app.rb:18:inentries' lib/labrador/app.rb:18:in find_all_from_path' app/controllers/application_controller.rb:48:infind_applications'

That path is wrong. It's missing the .labrador folder.

I also get this in a modal when I hit the refresh button

Caught error from database: function () { if ( list ) { var length = list.length; add( arguments ); // Do we need to add the callbacks to the // current firing batch? if ( firing ) { firingLength = list.length; // With memory, if we're not firing then // we should call right away, unless previous // firing was halted (stopOnFalse) } else if ( memory && memory !== true ) { firingStart = length; fire( memory[ 0 ], memory[ 1 ] ); } } return this; }

Any ideas?

chrismccord commented 12 years ago

This looks like a bug where the database path is not set properly. I should have this patched by the end the day. In the meantime can you confirm that using an absolute path in your database.yml fixes this issue? ie:

development:
  adapter: sqlite3
  database: /Users/adampope/Path/to/app/db/development.sqlite3
  pool: 5
  timeout: 5000

Thanks

adampope commented 12 years ago

Hi Chris, setting the full path works :) Thanks for the fix! Really liking the look of Labrador!

stefanoverna commented 12 years ago

Same problem here! Very promising work btw, great project!

chrismccord commented 12 years ago

This has been fixed on master and will now work without having to touch your database.yml for sqlite apps. To update your local copy:

$ cd ~/.labrador
$ git pull origin master
$ mkdir -p tmp/
$ touch tmp/restart.txt

Let me know if this gets everyone up and running. Thanks!

adampope commented 12 years ago

That's worked great for me, thanks Chris!

johnbellone commented 12 years ago

I am still seeing what seems to be this on master. There are also no tables in labrador database. Anything I can test?

chrismccord commented 12 years ago

@johnbellone Let's try a couple things:

  1. I'm hearing of a yet to opened issue of zero tables showing up when running pow for certain projects. Tables show up properly for this user when running labrador with the path passed through the URL, ie: http://labrador.dev/~/Path/to/app. These two issues may be related, so give it a try and see if you have any luck.
  2. If 1 fails,

    $ cd ~/.labrador $ bundle exec rails c

    Labrador::Sqlite.new(database: "/Users/johnbellone/Path/to/app/db/development.sqlite3").collections => ["some", "table", "names"]

    If you get table names back, the adapter should be working correctly and there must be a bug in setting the database path within Labrador::App/Adapter

Also, please include your database.yml

johnbellone commented 11 years ago
  1. I just saw the text on the left that shows the tables, but nothing actually appeared.
  2. Adapter seems to work and load the sqlite database fine. What would I need to do regarding the Labrador::App/Adapter path?
development:
 adapter: sqlite3
 database: db/development.sqlite3
 pool:5
 timeout: 5000