class Martilla::Database

Attributes

options[R]

Public Class Methods

create(config = {}) click to toggle source

When a new DB is supported it needs to go here

# File lib/martilla/database.rb, line 21
def self.create(config = {})
  case config['type'].downcase
  when 'postgres'
    Postgres.new(config['options'])
  when 'mysql'
    Mysql.new(config['options'])
  else
    raise Error.new("Invalid Database type: #{config['type']}")
  end
end
new(config) click to toggle source
# File lib/martilla/database.rb, line 7
def initialize(config)
  @options = config
  raise Error.new(invalid_options_msg) if @options.nil?
end

Public Instance Methods

dump(temp_file:, gzip:) click to toggle source
# File lib/martilla/database.rb, line 12
def dump(temp_file:, gzip:)
  raise NotImplementedError, 'You must implement the dump method'
end
invalid_options_msg() click to toggle source
# File lib/martilla/database.rb, line 16
def invalid_options_msg
  'DB configuration is invalid. Details here: https://github.com/fdoxyz/martilla'
end