Class: Wanderung::Database

Inherits:
Object
  • Object
show all
Defined in:
lib/wanderung/database.rb

Overview

Object to represent a database, with its migration counterpart

Instance Method Summary collapse

Constructor Details

#initialize(connection_uri:, path:, logger:) ⇒ Database

Returns a new instance of Database.



10
11
12
13
14
# File 'lib/wanderung/database.rb', line 10

def initialize(connection_uri:, path:, logger:)
  @logger = logger
  @db = Sequel.connect(connection_uri).tap { |db| db.logger = logger }.freeze
  @path = path
end

Instance Method Details

#migrateObject



16
17
18
# File 'lib/wanderung/database.rb', line 16

def migrate
  Sequel::Migrator.run(@db, @path)
end