Skip to content

Commit 53c4248

Browse files
authored
Merge pull request rails#46454 from mishaschwartz/no-extra-newline-in-structure
Do not write additional new lines when dumping sql migration versions
2 parents a8978b2 + 691dbf0 commit 53c4248

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

activerecord/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
* Do not write additional new lines when dumping sql migration versions
2+
3+
This change updates the `insert_versions_sql` function so that the database insert string containing the current database migration versions does not end with two additional new lines.
4+
5+
*Misha Schwartz*
6+
17
* Fix `composed_of` value freezing and duplication.
28

39
Previously composite values exhibited two confusing behaviors:
@@ -368,6 +374,7 @@
368374
369375
*Eileen M. Uchitelle*
370376
377+
371378
* Allow ActiveRecord::QueryMethods#select to receive hash values.
372379
373380
Currently, `select` might receive only raw sql and symbols to define columns and aliases to select.

activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1765,7 +1765,7 @@ def insert_versions_sql(versions)
17651765
if versions.is_a?(Array)
17661766
sql = +"INSERT INTO #{sm_table} (version) VALUES\n"
17671767
sql << versions.reverse.map { |v| "(#{quote(v)})" }.join(",\n")
1768-
sql << ";\n\n"
1768+
sql << ";"
17691769
sql
17701770
else
17711771
"INSERT INTO #{sm_table} (version) VALUES (#{quote(versions)});"

activerecord/test/cases/schema_dumper_test.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,8 @@ def test_dump_schema_information_outputs_lexically_reverse_ordered_versions_rega
3434
('20100301010101'),
3535
('20100201010101'),
3636
('20100101010101');
37-
3837
STR
39-
assert_equal expected, schema_info
38+
assert_equal expected.strip, schema_info
4039
ensure
4140
@schema_migration.delete_all_versions
4241
end

0 commit comments

Comments
 (0)