Class: Pliny::DbSupport::MigrationStatus

Inherits:
Object
  • Object
show all
Defined in:
lib/pliny/db_support.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filename:) ⇒ MigrationStatus

Returns a new instance of MigrationStatus.



69
70
71
72
73
# File 'lib/pliny/db_support.rb', line 69

def initialize(filename:)
  @filename = filename
  @present_on_disk = false
  @present_in_database = false
end

Instance Attribute Details

#filenameObject (readonly)

Returns the value of attribute filename.



66
67
68
# File 'lib/pliny/db_support.rb', line 66

def filename
  @filename
end

#present_in_databaseObject

Returns the value of attribute present_in_database.



67
68
69
# File 'lib/pliny/db_support.rb', line 67

def present_in_database
  @present_in_database
end

#present_on_diskObject

Returns the value of attribute present_on_disk.



67
68
69
# File 'lib/pliny/db_support.rb', line 67

def present_on_disk
  @present_on_disk
end

Instance Method Details

#statusObject



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/pliny/db_support.rb', line 75

def status
  if present_on_disk
    if present_in_database
      :up
    else
      :down
    end
  else
    if present_in_database
      :file_missing
    else
      raise "error" # FIXME: better message
    end
  end
end