Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
Checking mergeability… Don’t worry, you can still create the pull request.
  • 1 commit
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Commits on May 10, 2012
@betelgeuse betelgeuse Log MySQL schema queries with the SCHEMA name
The rails mysql2 adapter behaves in the same way in that it ignores the
name parameter and always uses SCHEMA. Using SCHEMA instead of SQL by
default allows differentiating the queries in notification subscribers.
198bd06
Showing with 5 additions and 5 deletions.
  1. +5 −5 lib/schema_plus/active_record/connection_adapters/mysql_adapter.rb
View
10 lib/schema_plus/active_record/connection_adapters/mysql_adapter.rb
@@ -32,7 +32,7 @@ def remove_foreign_key(table_name, foreign_key_name, options = {})
def foreign_keys(table_name, name = nil)
- results = execute("SHOW CREATE TABLE #{quote_table_name(table_name)}", name)
+ results = execute("SHOW CREATE TABLE #{quote_table_name(table_name)}", 'SCHEMA')
foreign_keys = []
@@ -60,7 +60,7 @@ def foreign_keys(table_name, name = nil)
end
def reverse_foreign_keys(table_name, name = nil)
- results = execute(<<-SQL, name)
+ results = execute(<<-SQL, 'SCHEMA')
SELECT constraint_name, table_name, column_name, referenced_table_name, referenced_column_name
FROM information_schema.key_column_usage
WHERE table_schema = SCHEMA()
@@ -86,14 +86,14 @@ def reverse_foreign_keys(table_name, name = nil)
def views(name = nil)
views = []
- execute("SELECT table_name FROM information_schema.views WHERE table_schema = SCHEMA()", name).each do |row|
+ execute("SELECT table_name FROM information_schema.views WHERE table_schema = SCHEMA()", 'SCHEMA').each do |row|
views << row[0]
end
views
end
- def view_definition(view_name, name = nil)
- result = execute("SELECT view_definition, check_option FROM information_schema.views WHERE table_schema = SCHEMA() AND table_name = #{quote(view_name)}", name)
+ def view_definition(view_name)
+ result = execute("SELECT view_definition, check_option FROM information_schema.views WHERE table_schema = SCHEMA() AND table_name = #{quote(view_name)}", 'SCHEMA')
return nil unless (result.respond_to?(:num_rows) ? result.num_rows : result.to_a.size) > 0 # mysql vs mysql2
row = result.respond_to?(:fetch_row) ? result.fetch_row : result.first
sql = row[0]

No commit comments for this range

Something went wrong with that request. Please try again.