Class: RelaxDB::MigrationVersion

Inherits:
Document
  • Object
show all
Defined in:
lib/relaxdb/migration_version.rb

Constant Summary collapse

DOC_ID =
"relaxdb_migration_version"

Instance Attribute Summary

Attributes inherited from Document

#data, #errors, #save_list, #validation_skip_list

Class Method Summary collapse

Methods inherited from Document

#==, add_derived_prop, after_save, #after_save, after_save_callbacks, all, #before_save, before_save, before_save_callbacks, #conflicted, create_all_by_class_view, #create_or_get_proxy, create_validation_msg, create_validator, create_views, #destroy!, inherited, #initialize, #inspect, #new_document?, #on_update_conflict, #post_save, #pre_save, property, references, #save, #save!, #save_all, #save_all!, #save_to_couch, #set_timestamps, #to_json, #to_param, up_chain, #update_conflict?, #validate_att, #validates?, view_by, view_docs_by, #write_derived_props

Methods included from Validators

#validator_required

Constructor Details

This class inherits a constructor from RelaxDB::Document

Class Method Details

.retrieveObject



17
18
19
# File 'lib/relaxdb/migration_version.rb', line 17

def self.retrieve
  (v = RelaxDB.load(DOC_ID)) ? v : new(:_id => DOC_ID).save!
end

.update(v) ⇒ Object



11
12
13
14
15
# File 'lib/relaxdb/migration_version.rb', line 11

def self.update v
  mv = retrieve
  mv.version = v
  mv.save!
end

.versionObject



7
8
9
# File 'lib/relaxdb/migration_version.rb', line 7

def self.version
  retrieve.version
end