Class: Brillo::Adapter::Base
- Inherits:
-
Object
- Object
- Brillo::Adapter::Base
- Includes:
- Logger
- Defined in:
- lib/brillo/adapter/base.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #dump_structure_and_migrations(config) ⇒ Object
- #footer ⇒ Object
- #header ⇒ Object
-
#initialize(db_config) ⇒ Base
constructor
A new instance of Base.
- #load_command ⇒ Object
- #recreate_db ⇒ Object
- #table_footer(klass) ⇒ Object
Methods included from Logger
Constructor Details
#initialize(db_config) ⇒ Base
Returns a new instance of Base.
7 8 9 |
# File 'lib/brillo/adapter/base.rb', line 7 def initialize(db_config) @config = db_config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
6 7 8 |
# File 'lib/brillo/adapter/base.rb', line 6 def config @config end |
Instance Method Details
#dump_structure_and_migrations(config) ⇒ Object
22 23 24 25 26 |
# File 'lib/brillo/adapter/base.rb', line 22 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 |
#footer ⇒ Object
14 15 16 |
# File 'lib/brillo/adapter/base.rb', line 14 def "" end |
#header ⇒ Object
10 11 12 |
# File 'lib/brillo/adapter/base.rb', line 10 def header ActiveRecord::Base.connection.dump_schema_information end |
#load_command ⇒ Object
28 29 30 |
# File 'lib/brillo/adapter/base.rb', line 28 def load_command raise NotImplementedError end |
#recreate_db ⇒ Object
32 33 34 35 36 37 |
# File 'lib/brillo/adapter/base.rb', line 32 def recreate_db ["db:drop", "db:create"].each do |t| logger.info "Running\n\trake #{t}" Rake::Task[t].invoke end end |
#table_footer(klass) ⇒ Object
18 19 20 |
# File 'lib/brillo/adapter/base.rb', line 18 def (klass) "" end |