Class: ActualDbSchema::Store

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/actual_db_schema/store.rb

Overview

Stores the migrated files into the tmp folder

Defined Under Namespace

Classes: Item

Instance Method Summary collapse

Instance Method Details

#readObject



17
18
19
20
21
# File 'lib/actual_db_schema/store.rb', line 17

def read
  return {} unless File.exist?(store_file)

  CSV.read(store_file).map { |line| Item.new(*line) }.index_by(&:version)
end

#write(filename) ⇒ Object



10
11
12
13
14
15
# File 'lib/actual_db_schema/store.rb', line 10

def write(filename)
  basename = File.basename(filename)
  FileUtils.mkdir_p(folder)
  FileUtils.copy(filename, folder.join(basename))
  (filename)
end