lib/sequel/migration_builder.rb
def alter_tables(current_table_names, tables)
      each_table(current_table_names, tables) do |table_name, table, last_table|
        hsh = table.dup
        hsh[:columns] = hsh[:columns].map {|c| Schema::DbColumn.build_from_hash(c) }
        operations = Schema::AlterTableOperations.
          build(@db_tables[table_name], hsh, :immutable_columns => @immutable_columns)
        unless operations.empty?
          all_operations = if @separate_alter_table_statements
                             operations.map {|o| [o] }
                           else
                             [operations]
                           end

          all_operations.each_with_index do |o, i|
            alter_table_statement table_name, o
            add_blank_line unless last_table && i + 1 == all_operations.size
          end
        end
      end
    end
def alter_tables(current_table_names, tables)
      each_table(current_table_names, tables) do |table_name, table, last_table|
        hsh = table.dup
        hsh[:columns] = hsh[:columns].map {|c| Schema::DbColumn.build_from_hash(c) }
        operations = Schema::AlterTableOperations.
          build(@db_tables[table_name], hsh, :immutable_columns => @immutable_columns)
        unless operations.empty?
          all_operations = if @separate_alter_table_statements
                             operations.map {|o| [o] }
                           else
                             [operations]
                           end

          all_operations.each_with_index do |o, i|
            alter_table_statement table_name, o
            add_blank_line unless last_table && i + 1 == all_operations.size
          end
        end
      end
    end
def alter_tables ( current_table_names , tables ) each_table ( current_table_names , tables ) do | table_name , table , last_table | hsh = table . dup hsh [ :columns ] = hsh [ :columns ] . map { | c | Schema :: DbColumn . build_from_hash ( c ) } operations = Schema :: AlterTableOperations . build ( @db_tables [ table_name ] , hsh , :immutable_columns => @immutable_columns ) unless operations . empty? all_operations = if @separate_alter_table_statements operations . map { | o | [ o ] } else [ operations ] end all_operations . each_with_index do | o , i | alter_table_statement table_name , o add_blank_line unless last_table && i + 1 == all_operations . size end end end end
Generates any alter table statements for current tables.
Generates any alter table statements for current tables .