Sha256: 958385e525c0f6bd79e144ee2f84933c7d1b19556884581cb07a480f3fb7f373
Contents?: true
Size: 1.25 KB
Versions: 3
Compression:
Stored size: 1.25 KB
Contents
# # Repairs a quoting problem with Active Record, repaired on Edge Rails # module ActiveRecord::ConnectionAdapters::SchemaStatements def add_column(table_name, column_name, type, options = {}) add_column_sql = "ALTER TABLE #{table_name} ADD #{quote_column_name(column_name)} #{type_to_sql(type, options[:limit])}" add_column_options!(add_column_sql, options) execute(add_column_sql) end def remove_column(table_name, column_name) execute "ALTER TABLE #{table_name} DROP #{quote_column_name(column_name)}" end def add_index(table_name, column_name, options = {}) column_names = Array(column_name) index_name = index_name(table_name, :column => column_names.first) if Hash === options # legacy support, since this param was a string index_type = options[:unique] ? "UNIQUE" : "" index_name = options[:name] || index_name else index_type = options end quoted_column_names = column_names.map { |e| quote_column_name(e) }.join(", ") execute "CREATE #{index_type} INDEX #{quote_column_name(index_name)} ON #{table_name} (#{quoted_column_names})" end def remove_index(table_name, options = {}) execute "DROP INDEX #{quote_column_name(index_name(table_name, options))} ON #{table_name}" end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
radiant-0.5.0 | lib/plugins/index_quoting_fix/init.rb |
radiant-0.5.1 | lib/plugins/index_quoting_fix/init.rb |
radiant-0.5.2 | lib/plugins/index_quoting_fix/init.rb |