activerecord-mysql-awesome 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/lib/activerecord-mysql-awesome/active_record/connection_adapters/abstract_mysql_adapter.rb +1 -1
- data/lib/activerecord-mysql-awesome/active_record/connection_adapters/mysql2_adapter.rb +27 -0
- data/lib/activerecord/mysql/awesome/base.rb +1 -0
- data/lib/activerecord/mysql/awesome/version.rb +1 -1
- data/test/cases/date_time_precision_test.rb +1 -1
- data/test/cases/helper.rb +1 -2
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62e622fc5e46035d940733c14a5ba2aa6f07c79f
|
4
|
+
data.tar.gz: 3bf808130042d45f898ca784074ef1b4050d20c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72101340cf2940dc17ec488bdf17e3fb0ab92def22d7c7960ae14282cdf5a21b808c36075ff4a334c7494e406b8b56cdacfdd1e6b70dc96c38330aa801766d10
|
7
|
+
data.tar.gz: ff8a944009cf786aee4b4779e661af4be369f77b9c00a56c3371928449661b29d6865197d9f54349d3941708c87adafc1b04f94c884390e65338736c439e5884
|
data/Gemfile
CHANGED
data/lib/activerecord-mysql-awesome/active_record/connection_adapters/abstract_mysql_adapter.rb
CHANGED
@@ -209,7 +209,7 @@ module ActiveRecord
|
|
209
209
|
public
|
210
210
|
|
211
211
|
def supports_datetime_with_precision?
|
212
|
-
|
212
|
+
version >= '5.6.4'
|
213
213
|
end
|
214
214
|
|
215
215
|
def type_to_sql(type, limit = nil, precision = nil, scale = nil, unsigned = false)
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'active_record/connection_adapters/mysql2_adapter'
|
2
|
+
|
3
|
+
module ActiveRecord
|
4
|
+
module ConnectionAdapters
|
5
|
+
class Mysql2Adapter < AbstractMysqlAdapter
|
6
|
+
class Version
|
7
|
+
include Comparable
|
8
|
+
|
9
|
+
def initialize(version_string)
|
10
|
+
@version = version_string.split('.').map(&:to_i)
|
11
|
+
end
|
12
|
+
|
13
|
+
def <=>(version_string)
|
14
|
+
@version <=> version_string.split('.').map(&:to_i)
|
15
|
+
end
|
16
|
+
|
17
|
+
def [](index)
|
18
|
+
@version[index]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def version
|
23
|
+
@version ||= Version.new(@connection.server_info[:version].match(/^\d+\.\d+\.\d+/)[0])
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -2,6 +2,7 @@ if ActiveRecord::VERSION::MAJOR == 4
|
|
2
2
|
require 'activerecord-mysql-awesome/active_record/schema_dumper'
|
3
3
|
require 'activerecord-mysql-awesome/active_record/connection_adapters/abstract/schema_dumper'
|
4
4
|
require 'activerecord-mysql-awesome/active_record/connection_adapters/abstract_mysql_adapter'
|
5
|
+
require 'activerecord-mysql-awesome/active_record/connection_adapters/mysql2_adapter'
|
5
6
|
else
|
6
7
|
raise "activerecord-mysql-awesome supports activerecord ~> 4.x"
|
7
8
|
end
|
@@ -83,7 +83,7 @@ class DateTimePrecisionTest < ActiveRecord::TestCase
|
|
83
83
|
def test_datetime_column_with_default_in_string_works
|
84
84
|
@connection.create_table(:foos, force: true)
|
85
85
|
@connection.add_column :foos, :default_at, :datetime, default: "2015-01-02 03:04:05"
|
86
|
-
|
86
|
+
assert_match %r{2015-01-02 03:04:05}, activerecord_column_option('foos', 'default_at', 'default').to_s
|
87
87
|
end
|
88
88
|
|
89
89
|
private
|
data/test/cases/helper.rb
CHANGED
@@ -39,8 +39,7 @@ def current_adapter?(*types)
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def mysql_56?
|
42
|
-
current_adapter?(:Mysql2Adapter) &&
|
43
|
-
ActiveRecord::Base.connection.send(:version).join(".") >= "5.6.0"
|
42
|
+
current_adapter?(:Mysql2Adapter) && ActiveRecord::Base.connection.version >= "5.6.0"
|
44
43
|
end
|
45
44
|
|
46
45
|
# FIXME: we have tests that depend on run order, we should fix that and
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-mysql-awesome
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryuta Kamizono
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -97,6 +97,7 @@ files:
|
|
97
97
|
- lib/activerecord-mysql-awesome.rb
|
98
98
|
- lib/activerecord-mysql-awesome/active_record/connection_adapters/abstract/schema_dumper.rb
|
99
99
|
- lib/activerecord-mysql-awesome/active_record/connection_adapters/abstract_mysql_adapter.rb
|
100
|
+
- lib/activerecord-mysql-awesome/active_record/connection_adapters/mysql2_adapter.rb
|
100
101
|
- lib/activerecord-mysql-awesome/active_record/schema_dumper.rb
|
101
102
|
- lib/activerecord/mysql/awesome.rb
|
102
103
|
- lib/activerecord/mysql/awesome/base.rb
|
@@ -139,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
139
140
|
version: '0'
|
140
141
|
requirements: []
|
141
142
|
rubyforge_project:
|
142
|
-
rubygems_version: 2.4
|
143
|
+
rubygems_version: 2.6.4
|
143
144
|
signing_key:
|
144
145
|
specification_version: 4
|
145
146
|
summary: Awesome patches backported for ActiveRecord MySQL adapters
|