Sha256: 23d2c8383f4234aa8b01b604269160bac093141a6f0948dcdce24db49f99531f

Contents?: true

Size: 843 Bytes

Versions: 4

Compression:

Stored size: 843 Bytes

Contents

require "rspec/core/rake_task"
require "active_record"

RSpec::Core::RakeTask.new(:spec)

task :default => %w(db:do_over spec)

namespace :db do
  task :create do
    connection.execute "CREATE DATABASE activerecord_postgresql_citext"
  end

  task :drop do
    connection.execute "DROP DATABASE IF EXISTS activerecord_postgresql_citext"
  end

  def connection
    config = {
      :adapter => 'postgresql',
      :template => 'template0',
      :schema_search_path => 'public',
      :username => ENV["DB_USERNAME"] || ENV["USER"],
      :password => ENV["DB_PASSWORD"],
      :host => 'localhost',
      :port => ENV["DB_PORT"] || 5433
    }
    ActiveRecord::Base.establish_connection(config.merge('database' => 'postgres', 'schema_search_path' => 'public'))
    ActiveRecord::Base.connection
  end

  task :do_over => %w(drop create)
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
staq-activerecord-postgresql-citext-0.2.0 Rakefile
activerecord-postgresql-citext-0.2.0 Rakefile
activerecord-postgresql-citext-0.1.0 Rakefile
activerecord-postgresql-citext-0.0.1 Rakefile