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.



71
72
73
74
75
# File 'lib/pliny/db_support.rb', line 71

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.



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

def filename
  @filename
end

#present_in_databaseObject

Returns the value of attribute present_in_database.



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

def present_in_database
  @present_in_database
end

#present_on_diskObject

Returns the value of attribute present_on_disk.



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

def present_on_disk
  @present_on_disk
end

Instance Method Details

#statusObject



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

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