Skip to content

Commit dfb2547

Browse files
authored
Merge pull request rails#52817 from kamipo/drop-mysql-5.5-support
Drop MySQL 5.5 support
2 parents d2b6ae1 + 6b1515a commit dfb2547

19 files changed

+52
-159
lines changed

activerecord/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
* Drop MySQL 5.5 support.
2+
3+
MySQL 5.5 is the only version that does not support datetime with precision,
4+
which we have supported in the core. Now we support MySQL 5.6.4 or later, which
5+
is the first version to support datetime with precision.
6+
7+
*Ryuta Kamizono*
8+
19
* Make Active Record asynchronous queries compatible with transactional fixtures.
210

311
Previously transactional fixtures would disable asynchronous queries, because transactional

activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def supports_views?
138138
end
139139

140140
def supports_datetime_with_precision?
141-
mariadb? || database_version >= "5.6.4"
141+
true
142142
end
143143

144144
def supports_virtual_columns?
@@ -668,8 +668,8 @@ def build_insert_sql(insert) # :nodoc:
668668
end
669669

670670
def check_version # :nodoc:
671-
if database_version < "5.5.8"
672-
raise DatabaseVersionError, "Your version of MySQL (#{database_version}) is too old. Active Record supports MySQL >= 5.5.8."
671+
if database_version < "5.6.4"
672+
raise DatabaseVersionError, "Your version of MySQL (#{database_version}) is too old. Active Record supports MySQL >= 5.6.4."
673673
end
674674
end
675675

activerecord/test/cases/adapters/abstract_mysql_adapter/datetime_precision_quoting_test.rb

Lines changed: 0 additions & 47 deletions
This file was deleted.

activerecord/test/cases/calculations_test.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1466,8 +1466,6 @@ def test_minimum_and_maximum_on_tz_aware_attributes
14661466
end
14671467

14681468
def assert_minimum_and_maximum_on_time_attributes(time_class)
1469-
skip unless supports_datetime_with_precision? # Remove once MySQL 5.5 support is dropped.
1470-
14711469
actual = Topic.minimum(:written_on)
14721470
assert_equal Time.utc(2003, 7, 16, 14, 28, 11, 223300), actual
14731471
assert_instance_of time_class, actual

activerecord/test/cases/collection_cache_key_test.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ class CollectionCacheKeyTest < ActiveRecord::TestCase
106106
developers = Developer.where(name: "David")
107107
cache_key = developers.cache_key
108108

109-
sleep 1.0 unless supports_datetime_with_precision? # Remove once MySQL 5.5 support is dropped.
110109
developers.update_all(updated_at: Time.now.utc)
111110

112111
assert_not_equal cache_key, developers.cache_key
@@ -116,7 +115,6 @@ class CollectionCacheKeyTest < ActiveRecord::TestCase
116115
developers = Developer.includes(:projects).where("projects.name": "Active Record")
117116
cache_key = developers.cache_key
118117

119-
sleep 1.0 unless supports_datetime_with_precision? # Remove once MySQL 5.5 support is dropped.
120118
developers.update_all(updated_at: Time.now.utc)
121119

122120
assert_not_equal cache_key, developers.cache_key

activerecord/test/cases/date_time_test.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ def test_assign_in_local_timezone
7272
end
7373

7474
def test_date_time_with_string_value_with_subsecond_precision
75-
skip unless supports_datetime_with_precision?
7675
string_value = "2017-07-04 14:19:00.5"
7776
topic = Topic.create(written_on: string_value)
7877
assert_equal topic, Topic.find_by(written_on: string_value)

activerecord/test/cases/dirty_test.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,6 @@ def test_field_named_field
620620
end
621621

622622
def test_datetime_attribute_can_be_updated_with_fractional_seconds
623-
skip "Fractional seconds are not supported" unless supports_datetime_with_precision?
624623
in_time_zone "Paris" do
625624
target = Class.new(ActiveRecord::Base)
626625
target.table_name = "topics"

activerecord/test/cases/insert_all_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ def test_upsert_all_touches_updated_at_and_updated_on_when_values_change
479479
end
480480

481481
def test_upsert_all_respects_updated_at_precision_when_touched_implicitly
482-
skip unless supports_insert_on_duplicate_update? && supports_datetime_with_precision?
482+
skip unless supports_insert_on_duplicate_update?
483483

484484
Book.insert_all [{ id: 101, name: "Out of the Silent Planet", published_on: Date.new(1938, 4, 1), updated_at: 5.years.ago, updated_on: 5.years.ago }]
485485

@@ -569,7 +569,7 @@ def test_upsert_all_implicitly_sets_timestamps_on_create_when_model_record_times
569569
end
570570

571571
def test_upsert_all_respects_created_at_precision_when_touched_implicitly
572-
skip unless supports_insert_on_duplicate_update? && supports_datetime_with_precision?
572+
skip unless supports_insert_on_duplicate_update?
573573

574574
# A single upsert can occur exactly at the seconds boundary (when usec is naturally zero), so try multiple times.
575575
has_subsecond_precision = (1..100).any? do |i|

activerecord/test/cases/integration_test.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ def test_cache_key_for_newer_updated_on
174174
end
175175

176176
def test_cache_key_format_is_precise_enough
177-
skip("Subsecond precision is not supported") unless supports_datetime_with_precision?
178177
dev = Developer.first
179178
key = dev.cache_key
180179
travel_to dev.updated_at + 0.000001 do
@@ -191,7 +190,6 @@ def test_cache_key_format_is_not_too_precise
191190
end
192191

193192
def test_cache_version_format_is_precise_enough
194-
skip("Subsecond precision is not supported") unless supports_datetime_with_precision?
195193
with_cache_versioning do
196194
dev = Developer.first
197195
version = dev.cache_version.to_param

activerecord/test/cases/locking_test.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@ def test_touch_existing_lock
179179
p1 = Person.find(1)
180180
assert_equal 0, p1.lock_version
181181

182-
sleep 1.0 unless supports_datetime_with_precision? # Remove once MySQL 5.5 support is dropped.
183182
p1.touch
184183

185184
assert_equal 1, p1.lock_version
@@ -298,7 +297,6 @@ def test_touch_existing_lock_without_default_should_work_with_null_in_the_databa
298297
assert_equal 0, t1.lock_version
299298
assert_nil t1.lock_version_before_type_cast
300299

301-
sleep 1.0 unless supports_datetime_with_precision? # Remove once MySQL 5.5 support is dropped.
302300
t1.touch
303301

304302
assert_equal 1, t1.lock_version

0 commit comments

Comments
 (0)