lib/generators/declare_schema/migration/migrator.rb
# return a hash of table renames and modifies the passed arrays so
# that renamed tables are no longer listed as to_create or to_drop
return a hash of table renames and modifies the passed arrays so
that renamed tables are no longer listed as to_create or to_drop
return a hash of table renames and modifies the passed arrays so that renamed tables are no longer listed as to_create or to_drop
def extract_table_renames!(to_create, to_drop)
          if @renames
            to_rename = {}
            @renames.each do |old_name, new_name|
              if new_name.is_a?(Hash)
                new_name = new_name[:table_name]
              end
              new_name or next
              old_name = old_name.to_s
              new_name = new_name.to_s
              to_create.delete(new_name) or raise Error,
                "Rename specified new name: #{new_name.inspect} but it was not in the `to_create` list"
              to_drop.delete(old_name) or raise Error,
                "Rename specified old name: #{old_name.inspect} but it was not in the `to_drop` list"
              to_rename[old_name] = new_name
            end
            to_rename
          elsif @ambiguity_resolver
            @ambiguity_resolver.call(to_create, to_drop, "table", nil)
          else
            raise Error, "Unable to resolve migration ambiguities"
          end
        end
def extract_table_renames! ( to_create , to_drop ) if @renames to_rename = { } @renames . each do | old_name , new_name | if new_name . is_a? ( Hash ) new_name = new_name [ :table_name ] end new_name or next old_name = old_name . to_s new_name = new_name . to_s to_create . delete ( new_name ) or raise Error , "Rename specified new name: #{new_name.inspect} but it was not in the `to_create` list" to_drop . delete ( old_name ) or raise Error , "Rename specified old name: #{old_name.inspect} but it was not in the `to_drop` list" to_rename [ old_name ] = new_name end to_rename elsif @ambiguity_resolver @ambiguity_resolver . call ( to_create , to_drop , "table" , nil ) else raise Error , "Unable to resolve migration ambiguities" end end
return a hash of table renames and modifies the passed arrays so
that renamed tables are no longer listed as to_create or to_drop
return a hash of table renames and modifies the passed arrays so that renamed tables are no longer listed as to_create or to_drop
# A hash of table renames has been provided
to_create
<not_specific>
to_drop
<not_specific>