Ruby Database Admin
A gem based on Sinatra and Sequel.
You can use it to manage multiple databases at the same time.
For Rails user, this gem will treat ./config/database.yml
as database configuration file.
Here are some demo pictures.
Installation
gem install db_admin
If you prefer to use it in Gemfile
:
group :development do
gem 'db_admin', require: false
end
Make sure you have installed database driver gem.
E.g: gem install pg
, gem install sqlite3
or gem install mysql2
, etc.
$ db_admin
Visit http://localhost:4567
Connect to database
There are two ways for you to connect to a database.
-
Visit http://localhost:4567 . The homepage is asking you to connect to a database. Please look at the demo picture above.
-
touch ./config/database.yml
or touch ./database.yml
You can use Rails's database.yml
file directly.
In yaml, 'Omit the key' or 'keep value blank' means use the default value.
development:
adapter: postgresql
encoding: unicode
host: localhost
database: somthing_development
username: username
password:
port: 5432
default: &default
adapter: postgresql
development:
<<: *default
database: somthing_development
adapter: postgres
encoding: unicode
host: localhost
database: your_database_name
user: username
password:
port: 5432
Customizing
If you want to change some code for your own purpose, please
$ git clone git@github.com:gazeldx/db_admin.git
$ cd db_admin
$ ruby lib/db_admin/run_web.rb
Debugging
You need to restart Web when you made a change.
Uncomment the below line in ./lib/db_admin.rb
to auto-reload changed files.
require 'sinatra/reloader' if development?