module NoWhen::Model
Public Class Methods
init(db_path)
click to toggle source
# File lib/nowhen/model.rb, line 9 def self.init(db_path) FileUtils.mkdir_p File.dirname(db_path) unless File.exists? File.dirname(db_path) DataMapper.setup(:default, {:adapter => :sqlite, :database => db_path}) DataMapper::Logger.new($stdout, :debug) migrate unless File.exists? db_path DataMapper.finalize end
migrate()
click to toggle source
# File lib/nowhen/model.rb, line 17 def self.migrate require 'dm-migrations' DataMapper.auto_migrate! end
upgrade()
click to toggle source
# File lib/nowhen/model.rb, line 22 def self.upgrade require 'dm-migrations' DataMapper.auto_upgrade! end