Method: DataDuck::Commands.recreate

Defined in:
lib/dataduck/commands.rb

.recreate(table_name) ⇒ Object



138
139
140
141
142
143
144
145
146
147
# File 'lib/dataduck/commands.rb', line 138

def self.recreate(table_name)
  table_name_camelized = DataDuck::Util.underscore_to_camelcase(table_name)
  require DataDuck.project_root + "/src/tables/#{ table_name }.rb"
  table_class = Object.const_get(table_name_camelized)
  if !(table_class <= DataDuck::Table)
    raise "Table class #{ table_name_camelized } must inherit from DataDuck::Table"
  end
  table = table_class.new
  table.recreate!(DataDuck::Destination.only_destination)
end