activerecord-mysql-enum 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +13 -0
- data/.github/workflows/test.yml +6 -0
- data/Appraisals +13 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +3 -3
- data/README.md +1 -1
- data/enum_column.gemspec +1 -1
- data/gemfiles/rails_5.gemfile +2 -2
- data/gemfiles/rails_6.gemfile +2 -2
- data/gemfiles/rails_6_1.gemfile +16 -0
- data/gemfiles/rails_7_0.gemfile +16 -0
- data/lib/active_record/mysql/enum/enum_column_adapter.rb +0 -10
- data/lib/active_record/mysql/enum/mysql_adapter.rb +18 -7
- data/lib/active_record/mysql/enum/schema_definitions.rb +1 -1
- data/lib/active_record/mysql/enum/version.rb +1 -1
- metadata +8 -6
- data/.dependabot/config.yml +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ffce6e3ac257695994f6047a2fc92014732807c6df5f73e7a50a8c9e43b4dead
|
4
|
+
data.tar.gz: 3cf2a902e47a9d4077c271802aaa1dd2f9dd382be35ff150537f4432312d4453
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 835337ba0e11f9164608edaca8de311e533eba27ede45944b7a4c323377e1ac96cdb8e3c45f4e9fc227c09568fb6501150e8c5e75bb2042eed33dd7d13f4e873
|
7
|
+
data.tar.gz: 9d451b8452ec9981942b09d66e568ee0312e1fca635ab454b342c495f15d8c6e3bbfa7f8fbb13d06a99b50b7d05bb4468ec5a1b9e16515e17e140dafaa3e0df3
|
@@ -0,0 +1,13 @@
|
|
1
|
+
version: 2
|
2
|
+
updates:
|
3
|
+
- package-ecosystem: bundler
|
4
|
+
directory: "/"
|
5
|
+
schedule:
|
6
|
+
interval: daily
|
7
|
+
time: "22:00"
|
8
|
+
timezone: PST8PDT
|
9
|
+
open-pull-requests-limit: 99
|
10
|
+
versioning-strategy: lockfile-only
|
11
|
+
commit-message:
|
12
|
+
prefix: No-Jira
|
13
|
+
include: scope
|
data/.github/workflows/test.yml
CHANGED
@@ -24,6 +24,8 @@ jobs:
|
|
24
24
|
- Gemfile
|
25
25
|
- gemfiles/rails_5.gemfile
|
26
26
|
- gemfiles/rails_6.gemfile
|
27
|
+
- gemfiles/rails_6_1.gemfile
|
28
|
+
- gemfiles/rails_7_0.gemfile
|
27
29
|
exclude:
|
28
30
|
- ruby: '3.0'
|
29
31
|
gemfile: Gemfile
|
@@ -33,6 +35,10 @@ jobs:
|
|
33
35
|
gemfile: gemfiles/rails_5.gemfile
|
34
36
|
- ruby: 3.1
|
35
37
|
gemfile: gemfiles/rails_5.gemfile
|
38
|
+
- ruby: 2.5.8
|
39
|
+
gemfile: gemfiles/rails_7_0.gemfile
|
40
|
+
- ruby: 2.6.5
|
41
|
+
gemfile: gemfiles/rails_7_0.gemfile
|
36
42
|
env:
|
37
43
|
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
38
44
|
DATABASE_MYSQL_HOST: 127.0.0.1
|
data/Appraisals
CHANGED
@@ -8,4 +8,17 @@ end
|
|
8
8
|
appraise 'rails-6' do
|
9
9
|
gem 'rails', '~> 6.0.0'
|
10
10
|
gem 'mysql2', '~> 0.5'
|
11
|
+
gem "net-smtp", require: false
|
12
|
+
end
|
13
|
+
|
14
|
+
appraise 'rails-6-1' do
|
15
|
+
gem 'rails', '~> 6.1.0'
|
16
|
+
gem 'mysql2', '~> 0.5'
|
17
|
+
gem "net-smtp", require: false
|
18
|
+
end
|
19
|
+
|
20
|
+
appraise 'rails-7-0' do
|
21
|
+
gem 'rails', '~> 7.0.0'
|
22
|
+
gem 'mysql2', '~> 0.5'
|
23
|
+
gem "net-smtp", require: false
|
11
24
|
end
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,10 @@ Inspired by [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
4
4
|
|
5
5
|
Note: this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
+
## [2.2.0] - 2022-07-18
|
8
|
+
### Added
|
9
|
+
- Added support for Rails 6.1 and 7.0
|
10
|
+
|
7
11
|
## [2.1.0] - 2022-04-11
|
8
12
|
### Added
|
9
13
|
- Added ruby 3 support
|
@@ -56,6 +60,7 @@ Note: this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0
|
|
56
60
|
### Changed
|
57
61
|
- Renamed the gem from `enum_column3` to `activerecord-mysql-enum`
|
58
62
|
|
63
|
+
[2.2.0]: https://github.com/Invoca/activerecord-mysql-enum/compare/v2.1.0...v2.2.0
|
59
64
|
[2.1.0]: https://github.com/Invoca/activerecord-mysql-enum/compare/v2.0.0...v2.1.0
|
60
65
|
[2.0.0]: https://github.com/Invoca/activerecord-mysql-enum/compare/v1.0.0...v2.0.0
|
61
66
|
[1.0.0]: https://github.com/Invoca/activerecord-mysql-enum/compare/v0.1.4...v1.0.0
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
activerecord-mysql-enum (2.
|
5
|
-
activerecord (>= 5.2, < 7)
|
4
|
+
activerecord-mysql-enum (2.2.0)
|
5
|
+
activerecord (>= 5.2, < 7.1)
|
6
6
|
mysql2 (>= 0.4.5, < 0.6)
|
7
7
|
|
8
8
|
GEM
|
@@ -83,7 +83,7 @@ GEM
|
|
83
83
|
mini_mime (1.1.0)
|
84
84
|
mini_portile2 (2.6.1)
|
85
85
|
minitest (5.14.4)
|
86
|
-
mysql2 (0.5.
|
86
|
+
mysql2 (0.5.4)
|
87
87
|
nio4r (2.5.8)
|
88
88
|
nokogiri (1.12.2)
|
89
89
|
mini_portile2 (~> 2.6.1)
|
data/README.md
CHANGED
@@ -7,7 +7,7 @@ which was itself a fork of a fork of Nick Pohodnya's original gem for
|
|
7
7
|
Rails 3, [enum_column3](https://github.com/electronick/enum_column).
|
8
8
|
|
9
9
|
## Support
|
10
|
-
Currently this is tested with Rails version 5.2,
|
10
|
+
Currently this is tested with Rails version 5.2, 6.0, 6.1, and 7.0.
|
11
11
|
|
12
12
|
**Supported adapters:**
|
13
13
|
- mysql2
|
data/enum_column.gemspec
CHANGED
data/gemfiles/rails_5.gemfile
CHANGED
data/gemfiles/rails_6.gemfile
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "appraisal"
|
6
|
+
gem "coveralls", require: false
|
7
|
+
gem "pry"
|
8
|
+
gem "pry-byebug"
|
9
|
+
gem "rake", "~> 13.0"
|
10
|
+
gem "rails", "~> 6.1.0"
|
11
|
+
gem "rspec", "~> 3.11"
|
12
|
+
gem "rspec-rails", "~> 5.0"
|
13
|
+
gem "mysql2", "~> 0.5"
|
14
|
+
gem "net-smtp", require: false
|
15
|
+
|
16
|
+
gemspec path: "../"
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "appraisal"
|
6
|
+
gem "coveralls", require: false
|
7
|
+
gem "pry"
|
8
|
+
gem "pry-byebug"
|
9
|
+
gem "rake", "~> 13.0"
|
10
|
+
gem "rails", "~> 7.0.0"
|
11
|
+
gem "rspec", "~> 3.11"
|
12
|
+
gem "rspec-rails", "~> 5.0"
|
13
|
+
gem "mysql2", "~> 0.5"
|
14
|
+
gem "net-smtp", require: false
|
15
|
+
|
16
|
+
gemspec path: "../"
|
@@ -22,16 +22,6 @@ module ActiveRecord
|
|
22
22
|
ActiveRecordColumnWithEnums = Enum.mysql_column_adapter
|
23
23
|
|
24
24
|
module EnumColumnAdapter
|
25
|
-
def initialize(*args, **kwargs, &block)
|
26
|
-
super
|
27
|
-
|
28
|
-
if type == :enum
|
29
|
-
@default = if @default.present?
|
30
|
-
@default.to_sym
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
25
|
# Convert to a symbol.
|
36
26
|
def type_cast_from_database(value)
|
37
27
|
if type == :enum
|
@@ -10,6 +10,13 @@ module ActiveRecord
|
|
10
10
|
|
11
11
|
ActiveRecord::ConnectionAdapters::Mysql2Adapter
|
12
12
|
end
|
13
|
+
|
14
|
+
def register_enum_with_type_mapping(m)
|
15
|
+
m.register_type(/enum/i) do |sql_type|
|
16
|
+
limit = sql_type.sub(/^enum\('(.+)'\)/i, '\1').split("','").map { |v| v.to_sym }
|
17
|
+
ActiveRecord::Type::Enum.new(limit: limit)
|
18
|
+
end
|
19
|
+
end
|
13
20
|
end
|
14
21
|
|
15
22
|
ActiveRecordMysqlAdapter = Enum.mysql_adapter
|
@@ -45,20 +52,24 @@ module ActiveRecord
|
|
45
52
|
end
|
46
53
|
end
|
47
54
|
|
55
|
+
if Gem::Version.new(Rails.version) < Gem::Version.new('7.0')
|
56
|
+
private
|
48
57
|
|
49
|
-
|
50
|
-
|
51
|
-
def initialize_type_map(m = type_map)
|
52
|
-
super
|
58
|
+
def initialize_type_map(m = type_map)
|
59
|
+
super
|
53
60
|
|
54
|
-
|
55
|
-
limit = sql_type.sub(/^enum\('(.+)'\)/i, '\1').split("','").map { |v| v.to_sym }
|
56
|
-
ActiveRecord::Type::Enum.new(limit: limit)
|
61
|
+
Enum.register_enum_with_type_mapping(m)
|
57
62
|
end
|
58
63
|
end
|
59
64
|
end
|
60
65
|
|
61
66
|
ActiveRecordMysqlAdapter.prepend ActiveRecord::Mysql::Enum::MysqlAdapter
|
67
|
+
|
68
|
+
unless Gem::Version.new(Rails.version) < Gem::Version.new('7.0')
|
69
|
+
[ActiveRecordMysqlAdapter::TYPE_MAP, ActiveRecordMysqlAdapter::TYPE_MAP_WITH_BOOLEAN].each do |m|
|
70
|
+
Enum.register_enum_with_type_mapping(m)
|
71
|
+
end
|
72
|
+
end
|
62
73
|
end
|
63
74
|
end
|
64
75
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-mysql-enum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Pohodnya
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-
|
12
|
+
date: 2022-07-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
version: '5.2'
|
21
21
|
- - "<"
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: '7'
|
23
|
+
version: '7.1'
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
26
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
version: '5.2'
|
31
31
|
- - "<"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '7'
|
33
|
+
version: '7.1'
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: mysql2
|
36
36
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,7 +58,7 @@ executables: []
|
|
58
58
|
extensions: []
|
59
59
|
extra_rdoc_files: []
|
60
60
|
files:
|
61
|
-
- ".dependabot
|
61
|
+
- ".github/dependabot.yml"
|
62
62
|
- ".github/workflows/gem_release.yml"
|
63
63
|
- ".github/workflows/test.yml"
|
64
64
|
- ".gitignore"
|
@@ -76,6 +76,8 @@ files:
|
|
76
76
|
- gemfiles/.bundle/config
|
77
77
|
- gemfiles/rails_5.gemfile
|
78
78
|
- gemfiles/rails_6.gemfile
|
79
|
+
- gemfiles/rails_6_1.gemfile
|
80
|
+
- gemfiles/rails_7_0.gemfile
|
79
81
|
- init.rb
|
80
82
|
- lib/active_record/mysql/enum.rb
|
81
83
|
- lib/active_record/mysql/enum/enum_column_adapter.rb
|
@@ -107,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
109
|
- !ruby/object:Gem::Version
|
108
110
|
version: '0'
|
109
111
|
requirements: []
|
110
|
-
rubygems_version: 3.
|
112
|
+
rubygems_version: 3.1.6
|
111
113
|
signing_key:
|
112
114
|
specification_version: 4
|
113
115
|
summary: Enable enum type for the MySQL Adapter in ActiveRecord
|