Class: Charming::DatabaseCommands

Inherits:
Object
  • Object
show all
Defined in:
lib/charming/database_commands.rb

Instance Method Summary collapse

Constructor Details

#initialize(command, out:, destination:) ⇒ DatabaseCommands

Returns a new instance of DatabaseCommands.



7
8
9
10
11
# File 'lib/charming/database_commands.rb', line 7

def initialize(command, out:, destination:)
  @command = command
  @out = out
  @destination = destination
end

Instance Method Details

#runObject



13
14
15
16
17
18
19
20
21
22
# File 'lib/charming/database_commands.rb', line 13

def run
  case command
  when "db:create" then create
  when "db:migrate" then migrate
  when "db:rollback" then rollback
  when "db:drop" then drop
  when "db:seed" then seed
  else raise Generators::Error, "Unknown database command: #{command}"
  end
end