aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorKoichi ITO <koic.ito@gmail.com>2016-12-23 12:20:34 +0900
committerKoichi ITO <koic.ito@gmail.com>2016-12-23 12:49:38 +0900
commit8479df482d85b034a5a1e1821f5c75337e114805 (patch)
tree948ef40781a522354b4b47a6406effe7112e3f90 /activerecord
parentfd63aa02289d64e9d14fe56723f1de64bca3bb1f (diff)
downloadrails-8479df482d85b034a5a1e1821f5c75337e114805.tar.gz
rails-8479df482d85b034a5a1e1821f5c75337e114805.tar.bz2
rails-8479df482d85b034a5a1e1821f5c75337e114805.zip
Add a quote to an SQL insert statement of schema migration
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
index 5623257fe8..6906854f97 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
@@ -994,15 +994,15 @@ module ActiveRecord
end
def insert_versions_sql(versions) # :nodoc:
- sm_table = ActiveRecord::Migrator.schema_migrations_table_name
+ sm_table = quote_table_name(ActiveRecord::Migrator.schema_migrations_table_name)
if versions.is_a?(Array)
sql = "INSERT INTO #{sm_table} (version) VALUES\n"
- sql << versions.map { |v| "('#{v}')" }.join(",\n")
+ sql << versions.map { |v| "(#{quote(v)})" }.join(",\n")
sql << ";\n\n"
sql
else
- "INSERT INTO #{sm_table} (version) VALUES ('#{versions}');"
+ "INSERT INTO #{sm_table} (version) VALUES (#{quote(versions)});"
end
end
@@ -1032,7 +1032,7 @@ module ActiveRecord
end
unless migrated.include?(version)
- execute "INSERT INTO #{sm_table} (version) VALUES ('#{version}')"
+ execute "INSERT INTO #{sm_table} (version) VALUES (#{quote(version)})"
end
inserting = (versions - migrated).select { |v| v < version }