Communard adds some conventions from ActiveRecord to Sequel.
This means you can use config/database.yml
and db/migrate
again, so you
don't have to change deployment scripts that are made for ActiveRecord.
Sequel doesn't provide the exact same functionality as ActiveRecord. Communard doesn't try to make Sequel quack like ActiveRecord, it just tries to help with some (not all) setup.
Add this line to your application's Gemfile:
gem 'communard'
And then execute:
$ bundle
Or install it yourself as:
$ gem install communard
To get a database connection:
DB = Communard.connect
The DB
object will be familiar to you if you've ever read the Sequel documentation.
Note: Communard doesn't remember your connection.
To add most Rake tasks, add this to your Rakefile
or to lib/tasks/communard.rake
:
require "communard/rake"
Communard::Rake.add_tasks
This will add the most used rake tasks, like db:create
, db:migrate
, and db:setup
.
To see them all:
$ rake -T db
To generate a migration:
$ bundle exec communard --generate-migration create_posts
Communard doesn't support more arguments, like the Rails generator does. You'll have to edit the generated migration file yourself.
There are a couple of configuration options available. They can be set by giving
a block to connect
or add_tasks
. Under normal circumstances you don't need
to set them.
DB = Communard.connect { |config|
config.root = Rails.root
config.logger = Rails.logger
config.environment = Rails.env.to_s
}
- Fork it ( https://github.com/yourkarma/communard/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request