class XMigra::RevertFile
Constants
- REVERSION_SUBDIR
Attributes
description[R]
path[R]
Public Class Methods
new(migration)
click to toggle source
# File lib/xmigra/revert_file.rb, line 7 def initialize(migration) @migration = migration mig_path = Pathname(migration.file_path) @description = "REVERT #{migration.description} (#{mig_path.basename})" @path = migration.schema_dir.join( REVERSION_SUBDIR, mig_path.basename.to_s.sub(/\..*?$/, '.sql') ) end
Public Instance Methods
exist?()
click to toggle source
# File lib/xmigra/revert_file.rb, line 38 def exist? @path.exist? end
inspect()
click to toggle source
# File lib/xmigra/revert_file.rb, line 31 def inspect "#<#{self.class.name} %s%s>" % [ @path, (" (missing)" unless @path.exist?), ] end
to_s()
click to toggle source
# File lib/xmigra/revert_file.rb, line 19 def to_s if @path.exist? @sql ||= "-- %s:\n\n%s\n%s" % [ @description, @path.read, @migration.reversion_tracking_sql ] else "-- #@description: No reversion given\n" end end