mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge branch 'master' of git://github.com/rails/rails
Conflicts: activerecord/CHANGELOG.md
This commit is contained in:
commit
dc0d303127
4 changed files with 24 additions and 6 deletions
|
@ -39,6 +39,12 @@
|
||||||
|
|
||||||
*Jenn Cooper*
|
*Jenn Cooper*
|
||||||
|
|
||||||
|
* Do not use `RENAME INDEX` syntax for MariaDB 10.0.
|
||||||
|
|
||||||
|
Fixes #15931.
|
||||||
|
|
||||||
|
*Jeff Browning*
|
||||||
|
|
||||||
* Calling `#empty?` on a `has_many` association would use the value from the
|
* Calling `#empty?` on a `has_many` association would use the value from the
|
||||||
counter cache if one exists.
|
counter cache if one exists.
|
||||||
|
|
||||||
|
|
|
@ -473,7 +473,7 @@ module ActiveRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def rename_index(table_name, old_name, new_name)
|
def rename_index(table_name, old_name, new_name)
|
||||||
if (version[0] == 5 && version[1] >= 7) || version[0] >= 6
|
if supports_rename_index?
|
||||||
execute "ALTER TABLE #{quote_table_name(table_name)} RENAME INDEX #{quote_table_name(old_name)} TO #{quote_table_name(new_name)}"
|
execute "ALTER TABLE #{quote_table_name(table_name)} RENAME INDEX #{quote_table_name(old_name)} TO #{quote_table_name(new_name)}"
|
||||||
else
|
else
|
||||||
super
|
super
|
||||||
|
@ -774,10 +774,22 @@ module ActiveRecord
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def version
|
||||||
|
@version ||= full_version.scan(/^(\d+)\.(\d+)\.(\d+)/).flatten.map { |v| v.to_i }
|
||||||
|
end
|
||||||
|
|
||||||
|
def mariadb?
|
||||||
|
full_version =~ /mariadb/i
|
||||||
|
end
|
||||||
|
|
||||||
def supports_views?
|
def supports_views?
|
||||||
version[0] >= 5
|
version[0] >= 5
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def supports_rename_index?
|
||||||
|
mariadb? ? false : (version[0] == 5 && version[1] >= 7) || version[0] >= 6
|
||||||
|
end
|
||||||
|
|
||||||
def configure_connection
|
def configure_connection
|
||||||
variables = @config.fetch(:variables, {}).stringify_keys
|
variables = @config.fetch(:variables, {}).stringify_keys
|
||||||
|
|
||||||
|
|
|
@ -269,8 +269,8 @@ module ActiveRecord
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
def version
|
def full_version
|
||||||
@version ||= @connection.info[:version].scan(/^(\d+)\.(\d+)\.(\d+)/).flatten.map { |v| v.to_i }
|
@full_version ||= @connection.info[:version]
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_field_encoding field_name
|
def set_field_encoding field_name
|
||||||
|
|
|
@ -470,9 +470,9 @@ module ActiveRecord
|
||||||
rows
|
rows
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns the version of the connected MySQL server.
|
# Returns the full version of the connected MySQL server.
|
||||||
def version
|
def full_version
|
||||||
@version ||= @connection.server_info.scan(/^(\d+)\.(\d+)\.(\d+)/).flatten.map { |v| v.to_i }
|
@full_version ||= @connection.server_info
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_field_encoding field_name
|
def set_field_encoding field_name
|
||||||
|
|
Loading…
Reference in a new issue