0.0
No commit activity in last 3 years
No release in over 3 years
Rake database tasks for Sequel and Postgres
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 1.16
~> 5.0
~> 10.0

Runtime

>= 0.3.1
>= 0
 Project Readme

Sequel::DbTasks

Rake CLI tasks for Sequel ORM and Postgres. All available tasks:

rake db:create_user       # Create database user
rake db:drop_user         # Drop database user

rake db:create            # Create database
rake db:drop              # Drop database

rake db:gm[name]          # Generate migration file
rake db:migrate[version]  # Run migrations

rake db:schema:print      # Print current database schema

There is no config/database.yml file. Gem works with DATABASE_URL (https://github.com/jeremyevans/sequel/blob/master/doc/opening_databases.rdoc#using-the-sequelconnect-method), which is should match exactly this format:

postgres://user:password@localhost/database_name

By default gem takes db_url from DATABASE_URL env variable. You can set other value (see Installation below).

Installation

Gemfile:

gem 'dotenv'
gem 'sequel-db_tasks', require: false

Run bundle install.

Rakefile:

require 'sequel/db_tasks'
require 'dotenv/load' # require dotenv/load (dotenv gem) to get value of DATABASE_URL env variable inside .env file

Sequel::DbTasks.load!

You can tweak settings using configure block:

# Rakefile

Sequel::DbTasks.configure do |config|
  config.database_url = ENV["DATABASE_URL"] # default value
  config.migrations_path = "db/migrate"     # default value
end

Sequel::DbTasks.load!

Notes

# lib/capistrano/tasks/sequel_migrate.rake

namespace :deploy do
  desc "Migrate sequel db"
  task :migrate do
    on roles(:all) do
      within release_path do
        execute :rake, 'db:migrate'
      end
    end
  end
end

after 'deploy:updated', 'deploy:migrate'

License

The gem is available as open source under the terms of the MIT License.