Created
October 13, 2011 11:46
-
-
Save tillsc/1284040 to your computer and use it in GitHub Desktop.
dm-oracle-adapter patch for indices with long table names
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create_index_statement(model, index_name, fields) | |
table_name = model.storage_name(name) | |
table_name_short = table_name.split("_").map{|s|s[0..3]}.join("_") | |
DataMapper::Ext::String.compress_lines(<<-SQL) | |
CREATE INDEX #{quote_name("i_#{table_name_short}_#{index_name}")} ON | |
#{quote_name(table_name)} (#{fields.map { |field| quote_name(field) }.join(', ')}) | |
SQL | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment