Revert "Merge pull request #43604 from nikonoid/bug/31722"

This reverts commit 2374f0efed, reversing
changes made to b37c02e027.

Since this break existing applications, and is necesary only because
applications are not using timestamped migrations and are expecting it
to just work, I decided to not revert this.

Those application should either follow the timestamped migrations format
or disable it.
This commit is contained in:
Rafael Mendonça França 2021-12-20 21:29:17 +00:00
parent 104c14fbda
commit b2350f28dd
No known key found for this signature in database
GPG Key ID: FC23B6D0F1EEE948
2 changed files with 1 additions and 10 deletions

View File

@ -1001,7 +1001,7 @@ module ActiveRecord
# Determines the version number of the next migration.
def next_migration_number(number)
if ActiveRecord.timestamped_migrations
[Time.now.utc.strftime("%Y%m%d%H%M%S").to_i, ("%.14d" % number).to_i].max
[Time.now.utc.strftime("%Y%m%d%H%M%S"), "%.14d" % number].max
else
SchemaMigration.normalize_migration_number(number)
end

View File

@ -148,15 +148,6 @@ class MigrationTest < ActiveRecord::TestCase
assert_equal 20131219224947, migrator.current_version
end
def test_migration_next_migration_number_consistent_across_year_boundary
last_year = Time.now.year - 1
not_a_month = 14
day_of_month = Time.now.day
time = Time.now.utc.strftime("%H%M%S")
last_year_number = "#{last_year}#{not_a_month}#{day_of_month}#{time}01"
assert_equal last_year_number, ActiveRecord::Migration.new.next_migration_number(last_year_number).to_s
end
def test_create_table_raises_if_already_exists
connection = Person.connection
connection.create_table :testings, force: true do |t|