activerecord-mysql-enum 2.0.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +13 -0
- data/.github/workflows/test.yml +18 -2
- data/.ruby-version +1 -0
- data/Appraisals +13 -0
- data/CHANGELOG.md +13 -0
- data/Gemfile +2 -2
- data/Gemfile.lock +26 -26
- data/README.md +1 -1
- data/enum_column.gemspec +1 -1
- data/gemfiles/rails_5.gemfile +2 -2
- data/gemfiles/rails_6.gemfile +3 -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 +9 -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
|
@@ -19,10 +19,26 @@ jobs:
|
|
|
19
19
|
strategy:
|
|
20
20
|
fail-fast: false
|
|
21
21
|
matrix:
|
|
22
|
-
ruby: [2.5.8, 2.6.5, 2.7.1]
|
|
22
|
+
ruby: [2.5.8, 2.6.5, 2.7, '3.0', 3.1]
|
|
23
23
|
gemfile:
|
|
24
|
+
- Gemfile
|
|
24
25
|
- gemfiles/rails_5.gemfile
|
|
25
26
|
- gemfiles/rails_6.gemfile
|
|
27
|
+
- gemfiles/rails_6_1.gemfile
|
|
28
|
+
- gemfiles/rails_7_0.gemfile
|
|
29
|
+
exclude:
|
|
30
|
+
- ruby: '3.0'
|
|
31
|
+
gemfile: Gemfile
|
|
32
|
+
- ruby: 3.1
|
|
33
|
+
gemfile: Gemfile
|
|
34
|
+
- ruby: '3.0'
|
|
35
|
+
gemfile: gemfiles/rails_5.gemfile
|
|
36
|
+
- ruby: 3.1
|
|
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
|
|
26
42
|
env:
|
|
27
43
|
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
|
28
44
|
DATABASE_MYSQL_HOST: 127.0.0.1
|
|
@@ -33,7 +49,7 @@ jobs:
|
|
|
33
49
|
- uses: ruby/setup-ruby@v1
|
|
34
50
|
with:
|
|
35
51
|
ruby-version: ${{ matrix.ruby }}
|
|
36
|
-
bundler:
|
|
52
|
+
bundler: 2.2.29
|
|
37
53
|
bundler-cache: true
|
|
38
54
|
- run: RAILS_ENV=test bundle exec rake db:create
|
|
39
55
|
- run: bundle exec rspec
|
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2.7.5
|
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,17 @@ 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
|
+
|
|
11
|
+
## [2.1.0] - 2022-04-11
|
|
12
|
+
### Added
|
|
13
|
+
- Added ruby 3 support
|
|
14
|
+
|
|
15
|
+
### Removed
|
|
16
|
+
- Dropped support for Rails less than 5
|
|
17
|
+
|
|
7
18
|
## [2.0.0] - 2021-08-10
|
|
8
19
|
### Removed
|
|
9
20
|
- Dropped support for Rails less than 5
|
|
@@ -49,6 +60,8 @@ Note: this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0
|
|
|
49
60
|
### Changed
|
|
50
61
|
- Renamed the gem from `enum_column3` to `activerecord-mysql-enum`
|
|
51
62
|
|
|
63
|
+
[2.2.0]: https://github.com/Invoca/activerecord-mysql-enum/compare/v2.1.0...v2.2.0
|
|
64
|
+
[2.1.0]: https://github.com/Invoca/activerecord-mysql-enum/compare/v2.0.0...v2.1.0
|
|
52
65
|
[2.0.0]: https://github.com/Invoca/activerecord-mysql-enum/compare/v1.0.0...v2.0.0
|
|
53
66
|
[1.0.0]: https://github.com/Invoca/activerecord-mysql-enum/compare/v0.1.4...v1.0.0
|
|
54
67
|
[0.1.4]: https://github.com/Invoca/activerecord-mysql-enum/compare/v0.1.3...v0.1.4
|
data/Gemfile
CHANGED
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
|
|
@@ -65,7 +65,7 @@ GEM
|
|
|
65
65
|
thor (>= 0.19.4, < 2.0)
|
|
66
66
|
tins (~> 1.6)
|
|
67
67
|
crass (1.0.6)
|
|
68
|
-
diff-lcs (1.
|
|
68
|
+
diff-lcs (1.5.0)
|
|
69
69
|
docile (1.4.0)
|
|
70
70
|
erubi (1.10.0)
|
|
71
71
|
globalid (0.5.2)
|
|
@@ -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)
|
|
@@ -123,27 +123,27 @@ GEM
|
|
|
123
123
|
rake (>= 0.8.7)
|
|
124
124
|
thor (>= 0.19.0, < 2.0)
|
|
125
125
|
rake (13.0.6)
|
|
126
|
-
rspec (3.
|
|
127
|
-
rspec-core (~> 3.
|
|
128
|
-
rspec-expectations (~> 3.
|
|
129
|
-
rspec-mocks (~> 3.
|
|
130
|
-
rspec-core (3.
|
|
131
|
-
rspec-support (~> 3.
|
|
132
|
-
rspec-expectations (3.
|
|
126
|
+
rspec (3.11.0)
|
|
127
|
+
rspec-core (~> 3.11.0)
|
|
128
|
+
rspec-expectations (~> 3.11.0)
|
|
129
|
+
rspec-mocks (~> 3.11.0)
|
|
130
|
+
rspec-core (3.11.0)
|
|
131
|
+
rspec-support (~> 3.11.0)
|
|
132
|
+
rspec-expectations (3.11.0)
|
|
133
133
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
134
|
-
rspec-support (~> 3.
|
|
135
|
-
rspec-mocks (3.
|
|
134
|
+
rspec-support (~> 3.11.0)
|
|
135
|
+
rspec-mocks (3.11.0)
|
|
136
136
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
137
|
-
rspec-support (~> 3.
|
|
138
|
-
rspec-rails (
|
|
139
|
-
actionpack (>=
|
|
140
|
-
activesupport (>=
|
|
141
|
-
railties (>=
|
|
142
|
-
rspec-core (~> 3.
|
|
143
|
-
rspec-expectations (~> 3.
|
|
144
|
-
rspec-mocks (~> 3.
|
|
145
|
-
rspec-support (~> 3.
|
|
146
|
-
rspec-support (3.
|
|
137
|
+
rspec-support (~> 3.11.0)
|
|
138
|
+
rspec-rails (5.1.1)
|
|
139
|
+
actionpack (>= 5.2)
|
|
140
|
+
activesupport (>= 5.2)
|
|
141
|
+
railties (>= 5.2)
|
|
142
|
+
rspec-core (~> 3.10)
|
|
143
|
+
rspec-expectations (~> 3.10)
|
|
144
|
+
rspec-mocks (~> 3.10)
|
|
145
|
+
rspec-support (~> 3.10)
|
|
146
|
+
rspec-support (3.11.0)
|
|
147
147
|
simplecov (0.16.1)
|
|
148
148
|
docile (~> 1.1)
|
|
149
149
|
json (>= 1.8, < 3)
|
|
@@ -180,8 +180,8 @@ DEPENDENCIES
|
|
|
180
180
|
pry-byebug
|
|
181
181
|
rails (~> 5.2)
|
|
182
182
|
rake (~> 13.0)
|
|
183
|
-
rspec
|
|
184
|
-
rspec-rails (~>
|
|
183
|
+
rspec (~> 3.11)
|
|
184
|
+
rspec-rails (~> 5.0)
|
|
185
185
|
|
|
186
186
|
BUNDLED WITH
|
|
187
|
-
|
|
187
|
+
2.3.11
|
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
|
@@ -8,8 +8,9 @@ gem "pry"
|
|
|
8
8
|
gem "pry-byebug"
|
|
9
9
|
gem "rake", "~> 13.0"
|
|
10
10
|
gem "rails", "~> 6.0.0"
|
|
11
|
-
gem "rspec"
|
|
12
|
-
gem "rspec-rails", "~>
|
|
11
|
+
gem "rspec", "~> 3.11"
|
|
12
|
+
gem "rspec-rails", "~> 5.0"
|
|
13
13
|
gem "mysql2", "~> 0.5"
|
|
14
|
+
gem "net-smtp", require: false
|
|
14
15
|
|
|
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", "~> 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(*)
|
|
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:
|
|
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,11 +58,12 @@ 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"
|
|
65
65
|
- ".rspec"
|
|
66
|
+
- ".ruby-version"
|
|
66
67
|
- Appraisals
|
|
67
68
|
- CHANGELOG.md
|
|
68
69
|
- Gemfile
|
|
@@ -75,6 +76,8 @@ files:
|
|
|
75
76
|
- gemfiles/.bundle/config
|
|
76
77
|
- gemfiles/rails_5.gemfile
|
|
77
78
|
- gemfiles/rails_6.gemfile
|
|
79
|
+
- gemfiles/rails_6_1.gemfile
|
|
80
|
+
- gemfiles/rails_7_0.gemfile
|
|
78
81
|
- init.rb
|
|
79
82
|
- lib/active_record/mysql/enum.rb
|
|
80
83
|
- lib/active_record/mysql/enum/enum_column_adapter.rb
|
|
@@ -106,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
106
109
|
- !ruby/object:Gem::Version
|
|
107
110
|
version: '0'
|
|
108
111
|
requirements: []
|
|
109
|
-
rubygems_version: 3.
|
|
112
|
+
rubygems_version: 3.1.6
|
|
110
113
|
signing_key:
|
|
111
114
|
specification_version: 4
|
|
112
115
|
summary: Enable enum type for the MySQL Adapter in ActiveRecord
|