Module: Oughtve::Database
- Defined in:
- lib/oughtve/database.rb
Constant Summary collapse
- Path =
The database file path.
File. "#{Oughtve::ResourceDirectory}/data.db"
- URI =
The full URI to access the DB.
"sqlite3:///#{Path}"
Class Method Summary collapse
-
.bootstrap ⇒ Object
Create a brand-new database.
-
.connect ⇒ Object
Connect to database (new or existing).
Class Method Details
.bootstrap ⇒ Object
Create a brand-new database.
76 77 78 79 |
# File 'lib/oughtve/database.rb', line 76 def self.bootstrap() raise OughtveError, "#{Path} already exists!" if File.exist? Path connect and DataMapper.auto_migrate! end |
.connect ⇒ Object
Connect to database (new or existing)
68 69 70 71 |
# File 'lib/oughtve/database.rb', line 68 def self.connect() DataMapper::Logger.new(STDOUT, :debug) if $VERBOSE DataMapper.setup :default, URI end |