Sha256: d44b077abf043ff0e9a5271e1389a3dec14e21c851f3b0c424a01c54f699ec00
Contents?: true
Size: 1.1 KB
Versions: 3
Compression:
Stored size: 1.1 KB
Contents
module Roomer class SchemaDumper < ActiveRecord::SchemaDumper protected def header(stream) define_params = @version ? ":version => #{@version}" : "" stream.puts <<HEADER # It's strongly recommended to check this file into your version control system. Roomer::Schema.define(#{define_params}) do HEADER end def indexes(table, stream) if (indexes = @connection.indexes(table)).any? add_index_statements = indexes.map do |index| statement_parts = [ ('add_index ' + index.table.inspect) ] statement_parts << index.columns.inspect statement_parts << (':name => "' + index.name + '"') statement_parts << ':unique => true' if index.unique index_lengths = index.lengths.compact if index.lengths.is_a?(Array) if index_lengths.present? statement_parts << (':length => ' + Hash[*index.columns.zip(index.lengths).flatten].inspect) end ' ' + statement_parts.join(', ') end stream.puts add_index_statements.sort.join("\n") stream.puts end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
roomer-0.0.11 | lib/roomer/schema_dumper.rb |
roomer-0.0.10 | lib/roomer/schema_dumper.rb |
roomer-0.0.9 | lib/roomer/schema_dumper.rb |