Method: Sequel::SchemaDumper#dump_indexes_migration

Defined in:
lib/sequel/extensions/schema_dumper.rb

#dump_indexes_migration(options = OPTS) ⇒ Object

Dump indexes for all tables as a migration. This complements the indexes: false option to dump_schema_migration. Options:

:same_db

Create a dump for the same database type, so don’t ignore errors if the index statements fail.

:index_names

If set to false, don’t record names of indexes. If set to :namespace, prepend the table name to the index name if the database does not use a global index namespace.



113
114
115
116
117
118
119
120
121
122
# File 'lib/sequel/extensions/schema_dumper.rb', line 113

def dump_indexes_migration(options=OPTS)
  ts = _dump_tables(options)
  <<END_MIG
Sequel.migration do
  change do
#{ts.map{|t| dump_table_indexes(t, :add_index, options)}.reject{|x| x == ''}.join("\n\n").gsub(/^/, '    ')}
  end
end
END_MIG
end