Class: Brillo::Adapter::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/brillo/adapter/base.rb

Direct Known Subclasses

MySQL, Postgres

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(db_config) ⇒ Base

Returns a new instance of Base.



5
6
7
# File 'lib/brillo/adapter/base.rb', line 5

def initialize(db_config)
  @config = db_config
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



4
5
6
# File 'lib/brillo/adapter/base.rb', line 4

def config
  @config
end

Instance Method Details

#dump_structure_and_migrations(config) ⇒ Object



16
17
18
19
20
# File 'lib/brillo/adapter/base.rb', line 16

def dump_structure_and_migrations(config)
  # Overrides the path the structure is dumped to in Rails >= 3.2
  ENV['SCHEMA'] = ENV['DB_STRUCTURE'] = config.dump_path.to_s
  Rake::Task["db:structure:dump"].invoke
end


12
13
14
# File 'lib/brillo/adapter/base.rb', line 12

def footer
  ""
end

#headerObject



8
9
10
# File 'lib/brillo/adapter/base.rb', line 8

def header
  ActiveRecord::Base.connection.dump_schema_information
end

#load_commandObject

Raises:

  • (NotImplementedError)


22
23
24
# File 'lib/brillo/adapter/base.rb', line 22

def load_command
  raise NotImplementedError
end