Sha256: 7daa4a562d77ccfc24cb0cc2432e4723f37e18638b0e8fbc526b4d594d01bfd7

Contents?: true

Size: 642 Bytes

Versions: 3

Compression:

Stored size: 642 Bytes

Contents

module Coupler
  Database = Sequel.connect(Coupler.connection_string('coupler'), :loggers => [Coupler::Logger.instance], :max_connections => 20)
  class << Database
    def rollback!
      version = self[:schema_info].first[:version]
      migrate!(version - 1)
    end

    def migrate!(to = nil, from = nil)
      dir = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'db', 'migrate'))
      args = [self, dir]
      if to
        args << to
        args << from  if from
      end
      Sequel::Migrator.apply(*args)
    end

    def instance
      warn("DEPRECATION NOTICE: Database.instance")
      self
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
coupler-0.0.9-java lib/coupler/database.rb
coupler-0.0.8-java lib/coupler/database.rb
coupler-0.0.7-java lib/coupler/database.rb