class XMigra::Migration
Constants
- CHANGES
- EMPTY_DB
- FOLLOWS
Attributes
changes[R]
description[R]
file_path[RW]
follows[R]
id[R]
Public Class Methods
id_from_filename(fname)
click to toggle source
# File lib/xmigra/migration.rb, line 51 def id_from_filename(fname) XMigra.secure_digest(fname.upcase) # Base64 encoded digest end
new(info)
click to toggle source
# File lib/xmigra/migration.rb, line 11 def initialize(info) @id = info['id'].dup.freeze _follows = info[FOLLOWS] @follows = (_follows.dup.freeze unless _follows == EMPTY_DB) @sql = info.has_key?('sql') ? info["sql"].dup.freeze : nil @description = info["description"].dup.freeze @changes = (info[CHANGES] || []).dup.freeze @changes.each {|c| c.freeze} @all_info = Marshal.load(Marshal.dump(info)) end
Public Instance Methods
reversion()
click to toggle source
# File lib/xmigra/migration.rb, line 45 def reversion result = RevertFile.new(self) return result if result.exist? end
schema_dir()
click to toggle source
# File lib/xmigra/migration.rb, line 25 def schema_dir @schema_dir ||= begin result = Pathname(file_path).dirname while result.basename.to_s != SchemaManipulator::STRUCTURE_SUBDIR result = result.dirname end result.join('..') end end
sql()
click to toggle source
# File lib/xmigra/migration.rb, line 35 def sql if Plugin.active (@sql || "").dup.tap do |result| Plugin.active.amend_source_sql(result) end else @sql end end