As seen in the Commit History: script/dbconsole May 8th, 2008

While going to the recent Rails Git logs, I stumbled across a cool new feature: dbconsole.

We all know and love the Rails console, which gives us an easy interface to our Rails environment, but sometimes we have to be in the database itself.. When this happened, most of the time we had to look up how our database was called, what kind of database it was, basically look at our database.yml file, but no more!

jan:railsproject jan$ script/dbconsole 
SQLite version 3.5.6
Enter ".help" for instructions
sqlite> select * from products;
...

and with easy access to each environment:

jan:railsproject jan$ script/dbconsole production
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 5.0.41 MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>

How cool is that!

tags: , , , l

3 Responses to “As seen in the Commit History: script/dbconsole”

  • about 1 month ago Koen Van der Auwera said

    Nice. No, nifty is the word. :)

    Indeed very helpful.

  • about 1 month ago Steve Purcell said

    Yep, this code used to be in my db_console plugin, but after encouragement from a bunch of people I submitted a patch to add it to the Rails core. I can’t believe everyone has lived without this for so long! :-)

  • about 1 month ago Jan De Poorter said

    @Steve: I didn’t know about the plugin.. There are so many plugins :-) Great it made it to the Rails core!

Leave a Reply