Class: Alchemy::Upgrader::Tasks::CellsMigration

Inherits:
Object
  • Object
show all
Defined in:
lib/alchemy/upgrader/tasks/cells_migration.rb

Defined Under Namespace

Classes: Cell

Instance Method Summary collapse

Instance Method Details

#migrate_cellsObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/alchemy/upgrader/tasks/cells_migration.rb', line 8

def migrate_cells
  if ActiveRecord::Base.connection.data_source_exists?('alchemy_cells')
    cells = Cell.all

    if cells.any?
      cells.each do |cell|
        migrate_cell!(cell)
      end
    else
      puts "No cells found. Skip"
    end
  else
    puts "Cells table does not exist. Skip"
  end
end