2

Since Heroku now supports ruby 1.9.3 but not sqlite3, I finally went along and took the journey to discover Heroku's way of using PostgreSQL. Took a little time to understand and configure, but I trucked through the weekend and gained some solid knowledge about it. However, one thing that caught my eye was the creation of the .dat file. Using

    heroku db:push 

obviously pushes the database to Heroku - taps gem installed - but also creates the .dat file. Anyone have any insight on what this file is? Is it just a session receipt?

Erwin Brandstetter
  • 605,456
  • 145
  • 1,078
  • 1,228
saltex
  • 133
  • 1
  • 1
  • 5

1 Answers1

1

I was wondering about this when these files started appearing as untracked files in git. It looks like it's just a session receipt indeed. I initially thought that these files would let you resume an interrupted database migration somehow, but a quick browse through the taps source code revealed that it's just a receipt (the generated .dat files are never loaded anywhere).

Here's the relevant code from taps' github repo:

def store_session
  file = "#{file_prefix}_#{Time.now.strftime("%Y%m%d%H%M")}.dat"
  puts "\nSaving session to #{file}.."
  File.open(file, 'w') do |f|
    f.write(OkJson.encode(to_hash))
  end
end

def to_hash
  {
    :klass => self.class.to_s,
    :database_url => database_url,
    :remote_url => remote_url,
    :session_uri => session_uri,
    :stream_state => stream_state,
    :completed_tables => completed_tables,
    :table_filter => table_filter,
  }
end
Alex Jegtnes
  • 177
  • 10