activerecord-mysql2-adapter-patch 0.1.0 → 5.1.4
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b95d1e157dec066675446a293b0ecb6ec8a5368143a7266b4eb789cfb9d30e8e
|
4
|
+
data.tar.gz: c4de7c524b1e42e06aa44fa87bcbd8fa3aeb26b0c4d5696613b0d3c2983aa22f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 755bd921f59c02db3ee8c6f4806983d0923a6af119206c2dcfce9be2d2214584f9a19b788332daca4f205182cd9460da10fa84f365264e79d8827526d4c3d100
|
7
|
+
data.tar.gz: 7b44323c8202c123b1f8bed6f012ab32c06de35019a0a9e4d8d516e1c0bb0228f2b089082b1d69b742c6751fd810fe58046f32ad1932ca3ad84259d1582ac883
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = 'activerecord-mysql2-adapter-patch'
|
5
|
-
s.version = '
|
5
|
+
s.version = '5.1.4'
|
6
6
|
s.licenses = ['MIT']
|
7
7
|
s.summary = 'ActiveRecord Mysql2 Adapater batch for datetime on update'
|
8
8
|
s.description = 'Fixes schema.rb for datetime fields that use on update'
|
@@ -1,20 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'active_record'
|
4
|
-
require 'active_record/connection_adapters/
|
4
|
+
require 'active_record/connection_adapters/abstract_mysql_adapter'
|
5
5
|
|
6
|
-
class ActiveRecord::ConnectionAdapters::
|
7
|
-
def
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
row[:Extra] = ''
|
13
|
-
end
|
14
|
-
yield row
|
15
|
-
end
|
6
|
+
class ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter
|
7
|
+
def new_column_from_field(table_name, field) # :nodoc:
|
8
|
+
type_metadata = fetch_type_metadata(field[:Type], field[:Extra])
|
9
|
+
if type_metadata.type == :datetime && /\ACURRENT_TIMESTAMP(?:\(\))?\z/i.match?(field[:Default])
|
10
|
+
default, default_function = nil, "CURRENT_TIMESTAMP"
|
11
|
+
default_function += ' ' + field[:Extra] if field[:Extra] != ''
|
16
12
|
else
|
17
|
-
|
13
|
+
default, default_function = field[:Default], nil
|
18
14
|
end
|
15
|
+
new_column(field[:Field], default, type_metadata, field[:Null] == "YES", table_name, default_function, field[:Collation], comment: field[:Comment].presence)
|
19
16
|
end
|
20
17
|
end
|