You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pgcli is a command-line interface for PostgreSQL that offers many improvements over psql, like auto-completion and syntax highlighting. Wouldn't it be nice to have a convenient way to use pgcli with your Rails app?
That's where the pgcli-rails gem comes in. It adds a pgcli Rake task to your Rails app. Use it in place of rails dbconsole.
Usage
Add the gem to your Gemfile and run bundle install:
gem"pgcli-rails"
Running the pgcli Rake task automatically uses your database.yml to launch pgcli with the correct connection options:
pgcli-rails is simply a Rake task that reuses the existing Rails::DBConsole command class provided by Rails. It applies a monkey patch so that pgcli is executed instead of psql. All you need to do is require the pgcli-rails gem by placing it in your Gemfile.
Configuration
There is no configuration. Like rails dbconsole, it simply uses your ActiveRecord database connection as specified in database.yml.
Roadmap
pgcli-rails is little more than a proof-of-concept at this point. Next steps are:
Add tests
Use Appraisal to test against multiple versions of Rails
If you have other ideas, open an issue on GitHub!
Contributing
Code contributions are also welcome! Read CONTRIBUTING.md to get started.
License
The gem is available as open source under the terms of the MIT License.
About
Replaces Rails PostgreSQL `dbconsole` with the much nicer `pgcli`