Class: Wanderung::Database
- Inherits:
-
Object
- Object
- Wanderung::Database
- Defined in:
- lib/wanderung/database.rb
Overview
Object to represent a database, with its migration counterpart
Instance Method Summary collapse
-
#initialize(connection_uri:, path:, logger:) ⇒ Database
constructor
A new instance of Database.
- #migrate ⇒ Object
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
#migrate ⇒ Object
16 17 18 |
# File 'lib/wanderung/database.rb', line 16 def migrate Sequel::Migrator.run(@db, @path) end |