Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make add_index and remove_index more resilient; new rename_index meth…
…od; track database limits [#3452 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
- Loading branch information
1 parent
a5696e3
commit 99bcce7
Showing
8 changed files
with
147 additions
and
13 deletions.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
activerecord/lib/active_record/connection_adapters/abstract/database_limits.rb
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
module ActiveRecord | ||
module ConnectionAdapters # :nodoc: | ||
module DatabaseLimits | ||
|
||
# the maximum length of a table alias | ||
def table_alias_length | ||
255 | ||
end | ||
|
||
# the maximum length of a column name | ||
def column_name_length | ||
64 | ||
end | ||
|
||
# the maximum length of a table name | ||
def table_name_length | ||
64 | ||
end | ||
|
||
# the maximum length of an index name | ||
def index_name_length | ||
64 | ||
end | ||
|
||
# the maximum number of columns per table | ||
def columns_per_table | ||
1024 | ||
end | ||
|
||
# the maximum number of indexes per table | ||
def indexes_per_table | ||
16 | ||
end | ||
|
||
# the maximum number of columns in a multicolumn index | ||
def columns_per_multicolumn_index | ||
16 | ||
end | ||
|
||
# the maximum number of elements in an IN (x,y,z) clause | ||
def in_clause_length | ||
65535 | ||
end | ||
|
||
# the maximum length of a SQL query | ||
def sql_query_length | ||
1048575 | ||
end | ||
|
||
# maximum number of joins in a single query | ||
def joins_per_query | ||
256 | ||
end | ||
|
||
end | ||
end | ||
end |
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
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
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
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
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
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
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
99bcce7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we really be swallowing issues with the index name being too long? This seems like unexpected behavior and an exception should just be raised. Granted a warning is logged, but the console output looks like everything worked okay. I'm unaware of anyone that checks the detailed log when things look okay.
99bcce7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it was fixed in https://rails.lighthouseapp.com/projects/8994/tickets/5645-rails-300-add_index-fails-silently-on-invalid-index-names