Skip to content

Commit

Permalink
Raise errors when index creation fails
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Connor authored and josevalim committed Sep 18, 2010
1 parent 9401fa0 commit 55d0d57
Showing 1 changed file with 2 additions and 4 deletions.
Expand Up @@ -340,12 +340,10 @@ def add_index(table_name, column_name, options = {})
end

if index_name.length > index_name_length
@logger.warn("Index name '#{index_name}' on table '#{table_name}' is too long; the limit is #{index_name_length} characters. Skipping.")
return
raise ArgumentError, "Index name '#{index_name}' on table '#{table_name}' is too long; the limit is #{index_name_length} characters"
end
if index_name_exists?(table_name, index_name, false)
@logger.warn("Index name '#{index_name}' on table '#{table_name}' already exists. Skipping.")
return
raise ArgumentError, "Index name '#{index_name}' on table '#{table_name}' already exists"
end
quoted_column_names = quoted_columns_for_index(column_names, options).join(", ")

Expand Down

1 comment on commit 55d0d57

@pcreux
Copy link
Contributor

@pcreux pcreux commented on 55d0d57 Jun 14, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm currently writing migrations for a Rails 3.0.0 app where indexes still fails silently. Thanks for having fixed this! :)

Please sign in to comment.