activerecord-mysql-enum 0.1.0.pre.1 → 0.1.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/.dependabot/config.yml +10 -0
- data/.github/workflows/gem_release.yml +38 -0
- data/.gitignore +8 -0
- data/CHANGELOG.md +1 -1
- data/Gemfile.lock +1 -1
- data/README.md +3 -1
- data/enum_column.gemspec +2 -2
- data/lib/active_record/mysql/enum/mysql_adapter.rb +5 -4
- data/lib/active_record/mysql/enum/version.rb +1 -1
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 731be1b698830840960df66c633230838cc5a12a
|
4
|
+
data.tar.gz: 0546d381f19f95569f6b44aa9c63ec2e5aa53cf1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03b00f78790935c06f5fca8979e25618a73e81a9e7f5c8c3bd7745834054b63303414769dc17374e1f482ec5aeaa2b30b470ec03eafe943f8b4046614cd3ae21
|
7
|
+
data.tar.gz: 94b3cf153dfc170e391914761b6286002806ff405bdaabf9877e57294218363714f38f1af9d32b6696d6a205a469e22aef969183888799d072aa74d108a1f61a
|
@@ -0,0 +1,38 @@
|
|
1
|
+
---
|
2
|
+
on:
|
3
|
+
push:
|
4
|
+
tags:
|
5
|
+
- 'v*'
|
6
|
+
- '!v*.pre*'
|
7
|
+
|
8
|
+
name: Create Release
|
9
|
+
|
10
|
+
jobs:
|
11
|
+
build:
|
12
|
+
name: Create Release
|
13
|
+
runs-on: ubuntu-latest
|
14
|
+
steps:
|
15
|
+
- name: Get version from tag
|
16
|
+
id: tag_name
|
17
|
+
shell: bash
|
18
|
+
run: |
|
19
|
+
echo ::set-output name=current_version::${GITHUB_REF#refs/tags/v}
|
20
|
+
- name: Checkout code
|
21
|
+
uses: actions/checkout@v2
|
22
|
+
- name: Get Changelog Entry
|
23
|
+
id: changelog_reader
|
24
|
+
uses: mindsers/changelog-reader-action@v1
|
25
|
+
with:
|
26
|
+
version: ${{ steps.tag_name.outputs.current_version }}
|
27
|
+
path: ./CHANGELOG.md
|
28
|
+
- name: Create Release
|
29
|
+
id: create_release
|
30
|
+
uses: actions/create-release@v1
|
31
|
+
env:
|
32
|
+
GITHUB_TOKEN: ${{ secrets.GEM_RELEASE_GIT_TOKEN }}
|
33
|
+
with:
|
34
|
+
tag_name: ${{ github.ref }}
|
35
|
+
release_name: Release ${{ github.ref }}
|
36
|
+
body: ${{ steps.changelog_reader.outputs.log_entry }}
|
37
|
+
draft: false
|
38
|
+
prerelease: false
|
data/.gitignore
ADDED
data/CHANGELOG.md
CHANGED
@@ -4,7 +4,7 @@ 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
|
-
## [0.1.0] -
|
7
|
+
## [0.1.0] - 2020-08-17
|
8
8
|
### Added
|
9
9
|
- Backwards compatibility with Rails 4
|
10
10
|
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,9 @@
|
|
2
2
|
|
3
3
|
This gem is an extension to ActiveRecord which enables native support of
|
4
4
|
enumerations in the database schema using the ENUM type in MySQL. Forked
|
5
|
-
and revitalized from
|
5
|
+
and revitalized from [enum_column3](https://github.com/jewlr/enum_column)
|
6
|
+
which was itself a fork of a fork of Nick Pohodnya's original gem for
|
7
|
+
Rails 3, [enum_column3](https://github.com/electronick/enum_column).
|
6
8
|
|
7
9
|
## Support
|
8
10
|
Currently this has been manually tested with Rails version 4 and 5, and works with scaffolding.
|
data/enum_column.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
lib = File.expand_path("
|
3
|
+
lib = File.expand_path("lib", __dir__)
|
4
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
5
|
require "active_record/mysql/enum/version"
|
6
6
|
|
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.email = ["development@invoca.com"]
|
12
12
|
|
13
13
|
spec.summary = "Enable enum type for the MySQL Adapter in ActiveRecord"
|
14
|
-
spec.description =
|
14
|
+
spec.description = spec.summary
|
15
15
|
spec.homepage = "http://github.com/Invoca/activerecord-mysql-enum"
|
16
16
|
|
17
17
|
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
@@ -28,7 +28,7 @@ module ActiveRecord
|
|
28
28
|
#
|
29
29
|
# will generate enum('a', 'b', 'c') for :limit => [:a, :b, :c]
|
30
30
|
if Rails::VERSION::MAJOR < 5
|
31
|
-
def type_to_sql(type, limit = nil, precision = nil, scale = nil, unsigned = nil, **) # :nodoc:
|
31
|
+
def type_to_sql(type, limit = nil, precision = nil, scale = nil, unsigned = nil, **_options) # :nodoc:
|
32
32
|
if type.to_s == 'enum'
|
33
33
|
native = native_database_types[type]
|
34
34
|
column_type_sql = (native || {})[:name] || 'enum'
|
@@ -41,7 +41,7 @@ module ActiveRecord
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
else
|
44
|
-
def type_to_sql(type, limit: nil, precision: nil, scale: nil, unsigned: nil, **) # :nodoc:
|
44
|
+
def type_to_sql(type, limit: nil, precision: nil, scale: nil, unsigned: nil, **_options) # :nodoc:
|
45
45
|
if type.to_s == 'enum'
|
46
46
|
native = native_database_types[type]
|
47
47
|
column_type_sql = (native || {})[:name] || 'enum'
|
@@ -57,11 +57,12 @@ module ActiveRecord
|
|
57
57
|
|
58
58
|
|
59
59
|
private
|
60
|
+
|
60
61
|
def initialize_type_map(m = type_map)
|
61
62
|
super
|
62
63
|
|
63
|
-
m.register_type(
|
64
|
-
limit = sql_type.sub(/^enum\('(.+)'\)/i, '\1').split("','").map { |v| v.
|
64
|
+
m.register_type(/enum/i) do |sql_type|
|
65
|
+
limit = sql_type.sub(/^enum\('(.+)'\)/i, '\1').split("','").map { |v| v.to_sym }
|
65
66
|
ActiveRecord::Type::Enum.new(limit: limit)
|
66
67
|
end
|
67
68
|
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: 0.1.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Pohodnya
|
@@ -38,6 +38,9 @@ executables: []
|
|
38
38
|
extensions: []
|
39
39
|
extra_rdoc_files: []
|
40
40
|
files:
|
41
|
+
- ".dependabot/config.yml"
|
42
|
+
- ".github/workflows/gem_release.yml"
|
43
|
+
- ".gitignore"
|
41
44
|
- CHANGELOG.md
|
42
45
|
- Gemfile
|
43
46
|
- Gemfile.lock
|
@@ -73,9 +76,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
73
76
|
version: '0'
|
74
77
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
78
|
requirements:
|
76
|
-
- - "
|
79
|
+
- - ">="
|
77
80
|
- !ruby/object:Gem::Version
|
78
|
-
version:
|
81
|
+
version: '0'
|
79
82
|
requirements: []
|
80
83
|
rubyforge_project:
|
81
84
|
rubygems_version: 2.6.13
|