module PTJ::Model

Public Class Methods

migrate_all!() click to toggle source

Updates the model schema in the current database.

@return Object

Returns the return value from DataMapper.auto_upgrade!
# File lib/ptj/model.rb, line 46
def self.migrate_all!
  setup! unless setup?
  # use a non-destructive schema migration across the whole model
  ret=DataMapper.auto_upgrade!
  @migrated = true
  return ret
end
migrated?() click to toggle source

@return True,False

Indicates whether the current model has been migrated 
(via auto_upgrade).
# File lib/ptj/model.rb, line 57
def self.migrated?
  @migrated == true
end
setup!() click to toggle source

Sets up the model using with the currently configured db_conn configuration.

# File lib/ptj/model.rb, line 28
def self.setup!
  DataMapper::Logger.new($stdout, :debug) if Env::CONFIG[Env::KEY_DEBUG]
  DataMapper.setup(:default, Env::CONFIG[Env::KEY_DB_CONN])
  DataMapper.finalize
  @setup = true
end
setup?() click to toggle source

@return True,False

Indicates whether the the model has been set up yet with the 
setup! method.
# File lib/ptj/model.rb, line 38
def self.setup?
  @setup == true
end