activerecord-mysql-uuid-column 0.1.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/build.yml +57 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +27 -0
- data/.rubocop_todo.yml +93 -0
- data/Gemfile +2 -0
- data/README.md +21 -5
- data/Rakefile +3 -1
- data/activerecord-mysql-uuid-column.gemspec +16 -10
- data/bin/console +1 -0
- data/gemfiles/Gemfile.rails-5.0.x +5 -0
- data/gemfiles/Gemfile.rails-5.1.x +5 -0
- data/gemfiles/Gemfile.rails-5.2.x +5 -0
- data/gemfiles/Gemfile.rails-6.0.x +5 -0
- data/gemfiles/Gemfile.rails-6.1.x +5 -0
- data/gemfiles/Gemfile.rails-7.0.x +5 -0
- data/gemfiles/Gemfile.rails-edge +5 -0
- data/lib/active_record-mysql-uuid_column/connection_adapter_quoting_monkey_patch.rb +14 -0
- data/lib/active_record-mysql-uuid_column/migration_column.rb +3 -1
- data/lib/active_record-mysql-uuid_column/mysql2_adapter_monkey_patch.rb +5 -1
- data/lib/active_record-mysql-uuid_column/type_class.rb +17 -12
- data/lib/active_record-mysql-uuid_column/version.rb +3 -1
- data/lib/active_record-mysql-uuid_column.rb +10 -4
- metadata +93 -27
- data/.travis.yml +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1b808043c72c6215dc7e078a5b598bbae0c76a0cfcfdf8988db1ceb1fa49d4dd
|
4
|
+
data.tar.gz: 22f933ae534d40fc75aff2b9d9581194a67f5c4ac8745dce6240ac2521515d82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2531d3928cc3643b6d1d496f904eef6a62e249bcf50215edd305465ab0b312228ce72905eb65535f9ce79a442e910f408a287f5aff7812f26614968f918f220
|
7
|
+
data.tar.gz: ea5bc774a5cf2038664dbdabea15d025beb99c390344f46ff36a1126ae198bf6983e99e890067b0964889073c34708a90133c793140a222cb455563f39ce1a8d
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
2
|
+
# They are provided by a third-party and are governed by
|
3
|
+
# separate terms of service, privacy policy, and support
|
4
|
+
# documentation.
|
5
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
+
|
8
|
+
name: build
|
9
|
+
|
10
|
+
on: [push, pull_request]
|
11
|
+
|
12
|
+
jobs:
|
13
|
+
test:
|
14
|
+
runs-on: ubuntu-20.04
|
15
|
+
strategy:
|
16
|
+
fail-fast: false
|
17
|
+
matrix:
|
18
|
+
gemfile: ["rails-7.0.x"]
|
19
|
+
ruby: [3.1]
|
20
|
+
include:
|
21
|
+
- gemfile: rails-7.0.x
|
22
|
+
ruby: '3.0'
|
23
|
+
- gemfile: rails-7.0.x
|
24
|
+
ruby: '2.7'
|
25
|
+
- gemfile: rails-6.1.x
|
26
|
+
ruby: '3.1'
|
27
|
+
- gemfile: rails-6.1.x
|
28
|
+
ruby: '3.0'
|
29
|
+
- gemfile: rails-6.1.x
|
30
|
+
ruby: 2.7
|
31
|
+
- gemfile: rails-6.1.x
|
32
|
+
ruby: 2.6
|
33
|
+
- gemfile: rails-6.0.x
|
34
|
+
ruby: 2.7
|
35
|
+
- gemfile: rails-6.0.x
|
36
|
+
ruby: 2.6
|
37
|
+
- gemfile: rails-5.2.x
|
38
|
+
ruby: 2.6
|
39
|
+
|
40
|
+
env:
|
41
|
+
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/Gemfile.${{ matrix.gemfile }}
|
42
|
+
steps:
|
43
|
+
- uses: actions/checkout@v2
|
44
|
+
- uses: ruby/setup-ruby@v1
|
45
|
+
with:
|
46
|
+
ruby-version: ${{ matrix.ruby }}
|
47
|
+
bundler-cache: true
|
48
|
+
- name: Start MySQL
|
49
|
+
run: sudo systemctl start mysql.service
|
50
|
+
- name: Rspec test suite
|
51
|
+
run: bundle exec rspec
|
52
|
+
- name: Kill panolint and other rubocop files found in vendor folder. (breaks rubocop)
|
53
|
+
run: find vendor/bundle -name .rubocop.yml | xargs rm
|
54
|
+
if: matrix.gemfile == 'rails-7.0.x' && matrix.ruby == '3.1'
|
55
|
+
- name: Rubocop
|
56
|
+
run: bundle exec rubocop lib spec
|
57
|
+
if: matrix.gemfile == 'rails-7.0.x' && matrix.ruby == '3.1'
|
data/.gitignore
CHANGED
data/.rubocop.yml
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
inherit_from: .rubocop_todo.yml
|
2
|
+
|
3
|
+
require:
|
4
|
+
- rubocop-performance
|
5
|
+
- rubocop-rails
|
6
|
+
|
7
|
+
AllCops:
|
8
|
+
NewCops: enable
|
9
|
+
TargetRubyVersion: 3.1
|
10
|
+
TargetRailsVersion: 7.0
|
11
|
+
Exclude:
|
12
|
+
- gemfiles/vendor/bundle/**/*
|
13
|
+
|
14
|
+
Style/HashSyntax:
|
15
|
+
Enabled: false
|
16
|
+
|
17
|
+
Style/StringLiterals:
|
18
|
+
Enabled: false
|
19
|
+
|
20
|
+
Style/NumericLiterals:
|
21
|
+
Exclude:
|
22
|
+
- spec/support/db_schema.rb
|
23
|
+
|
24
|
+
Metrics/BlockLength:
|
25
|
+
IgnoredMethods:
|
26
|
+
- describe
|
27
|
+
- it
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2022-05-19 01:32:45 UTC using RuboCop version 1.29.1.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 1
|
10
|
+
# This cop supports safe auto-correction (--auto-correct).
|
11
|
+
# Configuration parameters: Include.
|
12
|
+
# Include: **/*.gemspec
|
13
|
+
Gemspec/RequireMFA:
|
14
|
+
Exclude:
|
15
|
+
- 'activerecord-mysql-uuid-column.gemspec'
|
16
|
+
|
17
|
+
# Offense count: 1
|
18
|
+
# Configuration parameters: Include.
|
19
|
+
# Include: **/*.gemspec
|
20
|
+
Gemspec/RequiredRubyVersion:
|
21
|
+
Exclude:
|
22
|
+
- 'activerecord-mysql-uuid-column.gemspec'
|
23
|
+
|
24
|
+
# Offense count: 1
|
25
|
+
# Configuration parameters: Include.
|
26
|
+
# Include: **/*.gemspec
|
27
|
+
Gemspec/RubyVersionGlobalsUsage:
|
28
|
+
Exclude:
|
29
|
+
- 'activerecord-mysql-uuid-column.gemspec'
|
30
|
+
|
31
|
+
# Offense count: 1
|
32
|
+
# Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms.
|
33
|
+
# CheckDefinitionPathHierarchyRoots: lib, spec, test, src
|
34
|
+
# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
|
35
|
+
Naming/FileName:
|
36
|
+
Exclude:
|
37
|
+
- 'lib/active_record-mysql-uuid_column.rb'
|
38
|
+
|
39
|
+
# Offense count: 1
|
40
|
+
# This cop supports safe auto-correction (--auto-correct).
|
41
|
+
Performance/TimesMap:
|
42
|
+
Exclude:
|
43
|
+
- 'spec/mysql_uuid_column_spec.rb'
|
44
|
+
|
45
|
+
# Offense count: 1
|
46
|
+
# This cop supports safe auto-correction (--auto-correct).
|
47
|
+
Rails/ApplicationRecord:
|
48
|
+
Exclude:
|
49
|
+
- 'spec/mysql_uuid_column_spec.rb'
|
50
|
+
|
51
|
+
# Offense count: 5
|
52
|
+
# Configuration parameters: AllowedConstants.
|
53
|
+
Style/Documentation:
|
54
|
+
Exclude:
|
55
|
+
- 'lib/active_record-mysql-uuid_column/connection_adapter_quoting_monkey_patch.rb'
|
56
|
+
- 'lib/active_record-mysql-uuid_column/migration_column.rb'
|
57
|
+
- 'lib/active_record-mysql-uuid_column/mysql2_adapter_monkey_patch.rb'
|
58
|
+
- 'lib/active_record-mysql-uuid_column/type_class.rb'
|
59
|
+
|
60
|
+
# Offense count: 1
|
61
|
+
# This cop supports safe auto-correction (--auto-correct).
|
62
|
+
# Configuration parameters: AllowedVars.
|
63
|
+
Style/FetchEnvVar:
|
64
|
+
Exclude:
|
65
|
+
- 'spec/mysql_uuid_column_spec.rb'
|
66
|
+
|
67
|
+
# Offense count: 1
|
68
|
+
# This cop supports safe auto-correction (--auto-correct).
|
69
|
+
# Configuration parameters: EnforcedStyle.
|
70
|
+
# SupportedStyles: always, always_true, never
|
71
|
+
Style/FrozenStringLiteralComment:
|
72
|
+
Exclude:
|
73
|
+
- 'lib/active_record-mysql-uuid_column/connection_adapter_quoting_monkey_patch.rb'
|
74
|
+
|
75
|
+
# Offense count: 1
|
76
|
+
# Configuration parameters: MinBodyLength, AllowConsecutiveConditionals.
|
77
|
+
Style/GuardClause:
|
78
|
+
Exclude:
|
79
|
+
- 'lib/active_record-mysql-uuid_column/type_class.rb'
|
80
|
+
|
81
|
+
# Offense count: 2
|
82
|
+
# This cop supports safe auto-correction (--auto-correct).
|
83
|
+
# Configuration parameters: EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
|
84
|
+
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
|
85
|
+
# SupportedShorthandSyntax: always, never, either
|
86
|
+
Style/HashSyntax:
|
87
|
+
EnforcedStyle: ruby19
|
88
|
+
|
89
|
+
# Offense count: 1
|
90
|
+
# This cop supports safe auto-correction (--auto-correct).
|
91
|
+
Style/UnpackFirst:
|
92
|
+
Exclude:
|
93
|
+
- 'lib/active_record-mysql-uuid_column/type_class.rb'
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
# ActiveRecord::Mysql::UuidColumn
|
2
2
|
|
3
|
-
Adds a :uuid column to ActiveRecord
|
3
|
+
Adds a :uuid column to ActiveRecord MySQL2 Adapter
|
4
4
|
it is stored in a 16 bytes binary column. which is exactly the space it needs.
|
5
5
|
|
6
|
+
[![Gem Version](https://badge.fury.io/rb/activerecord-mysql-uuid-column.svg)](https://badge.fury.io/rb/activerecord-mysql-uuid-column)
|
7
|
+
[![Build Status](https://travis-ci.org/mathieujobin/activerecord-mysql-uuid-column.svg?branch=master)](https://travis-ci.org/mathieujobin/activerecord-mysql-uuid-column)
|
8
|
+
![GitHub release](https://img.shields.io/github/release/mathieujobin/activerecord-mysql-uuid-column.svg)
|
9
|
+
[![Codecov](https://img.shields.io/codecov/c/github/mathieujobin/activerecord-mysql-uuid-column.svg)](https://codecov.io/gh/mathieujobin/activerecord-mysql-uuid-column)
|
10
|
+
|
6
11
|
## Installation
|
7
12
|
|
8
13
|
Add this line to your application's Gemfile:
|
@@ -21,22 +26,22 @@ Or install it yourself as:
|
|
21
26
|
|
22
27
|
## Usage
|
23
28
|
|
24
|
-
|
29
|
+
Regular MySQL ActiveRecord config
|
25
30
|
```
|
26
31
|
test:
|
27
32
|
adapter: mysql2
|
28
33
|
username: root
|
29
34
|
host: localhost
|
30
35
|
reconnect: true
|
31
|
-
database:
|
36
|
+
database: awesome_project_of_yours
|
32
37
|
```
|
33
38
|
|
34
39
|
Adds column type `uuid`
|
35
40
|
|
36
41
|
```
|
37
42
|
ActiveRecord::Schema.define(version: 20161122225732) do
|
38
|
-
create_table "
|
39
|
-
t.uuid "
|
43
|
+
create_table "workers", force: true do |t|
|
44
|
+
t.uuid "job_uuid"
|
40
45
|
end
|
41
46
|
end
|
42
47
|
```
|
@@ -61,6 +66,17 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
61
66
|
|
62
67
|
Bug reports and pull requests are welcome on GitHub at https://github.com/mathieujobin/activerecord-mysql-uuid-column. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
63
68
|
|
69
|
+
## Online API Doc
|
70
|
+
* http://www.rubydoc.info/gems/activerecord-mysql-uuid-column/0.2.0
|
71
|
+
|
72
|
+
## On libraries.io
|
73
|
+
* https://libraries.io/rubygems/activerecord-mysql-uuid-column
|
74
|
+
|
75
|
+
## Resources
|
76
|
+
* https://christoph.luppri.ch/articles/2017/01/07/adding-custom-types-to-your-activerecord-models-with-the-attributes-api/
|
77
|
+
* https://karolgalanciak.com/blog/2016/12/04/introduction-to-activerecord-and-activemodel-attributes-api/
|
78
|
+
* https://blog.metova.com/rails-5-attributes-api
|
79
|
+
* https://gorails.com/episodes/virtual-attributes-and-rails-5-attribute-api
|
64
80
|
|
65
81
|
## License
|
66
82
|
|
data/Rakefile
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
5
|
require 'active_record-mysql-uuid_column/version'
|
5
6
|
|
@@ -9,8 +10,8 @@ Gem::Specification.new do |spec|
|
|
9
10
|
spec.authors = ["Mathieu Jobin"]
|
10
11
|
spec.email = ["mathieu@justbudget.com"]
|
11
12
|
|
12
|
-
spec.summary =
|
13
|
-
spec.description =
|
13
|
+
spec.summary = 'Adds a :uuid column to ActiveRecord MySQL2 Adapter. Store UUIDs as 16 bytes binary column.'
|
14
|
+
spec.description = spec.summary
|
14
15
|
spec.homepage = "https://github.com/mathieujobin/activerecord-mysql-uuid-column"
|
15
16
|
spec.license = "MIT"
|
16
17
|
|
@@ -20,12 +21,17 @@ Gem::Specification.new do |spec|
|
|
20
21
|
spec.bindir = "exe"
|
21
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
23
|
spec.require_paths = ["lib"]
|
24
|
+
spec.required_ruby_version = ">= 2.5"
|
23
25
|
|
24
|
-
spec.add_development_dependency "bundler", "~>
|
25
|
-
spec.add_development_dependency "
|
26
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
27
|
+
spec.add_development_dependency "byebug"
|
28
|
+
spec.add_development_dependency "codecov"
|
29
|
+
spec.add_development_dependency "looksee" if RUBY_VERSION < '3.0'
|
30
|
+
spec.add_development_dependency "rake"
|
26
31
|
spec.add_development_dependency "rspec", "~> 3.0"
|
27
|
-
spec.add_development_dependency "
|
28
|
-
spec.add_development_dependency "
|
29
|
-
spec.
|
30
|
-
spec.add_dependency "
|
32
|
+
spec.add_development_dependency "rubocop"
|
33
|
+
spec.add_development_dependency "rubocop-performance"
|
34
|
+
spec.add_development_dependency "rubocop-rails"
|
35
|
+
spec.add_dependency "activerecord", ">= 5", "< 8"
|
36
|
+
spec.add_dependency "mysql2"
|
31
37
|
end
|
data/bin/console
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'active_record/connection_adapters/abstract/quoting'
|
2
|
+
|
3
|
+
module ActiveRecordConnectionAdaptersUuidQuoting
|
4
|
+
def quote(value)
|
5
|
+
if value.is_a?(ActiveRecord::Type::Uuid::Data) # || value.is_a?(Type::Binary::Data)
|
6
|
+
# "x'#{value.hex}'"
|
7
|
+
quoted_binary(value)
|
8
|
+
else
|
9
|
+
super
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
ActiveRecord::ConnectionAdapters::Quoting.prepend ActiveRecordConnectionAdaptersUuidQuoting
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module ActiveRecord
|
2
4
|
module ConnectionAdapters
|
3
5
|
module MySQL
|
@@ -5,7 +7,7 @@ module ActiveRecord
|
|
5
7
|
def uuid(*args, **options)
|
6
8
|
# http://dba.stackexchange.com/questions/904/mysql-data-type-for-128-bit-integers
|
7
9
|
# http://dev.mysql.com/doc/refman/5.7/en/binary-varbinary.html
|
8
|
-
args.each { |name| column(name, :binary, options.merge(limit: 16)) }
|
10
|
+
args.each { |name| column(name, :binary, **options.merge(limit: 16)) }
|
9
11
|
end
|
10
12
|
end
|
11
13
|
end
|
@@ -1,10 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'active_record/connection_adapters/mysql2_adapter'
|
4
|
+
|
1
5
|
module ActiveRecord
|
2
6
|
module ConnectionAdapters
|
3
7
|
class Mysql2Adapter
|
4
8
|
private
|
5
9
|
|
6
10
|
def _quote(value)
|
7
|
-
if value.is_a?(Type::Uuid::Data)
|
11
|
+
if value.is_a?(Type::Uuid::Data) || value.is_a?(Type::Binary::Data)
|
8
12
|
"x'#{value.hex}'"
|
9
13
|
else
|
10
14
|
super
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module ActiveRecord
|
2
4
|
module Type
|
3
5
|
class Uuid < ActiveRecord::Type::Binary
|
@@ -8,18 +10,19 @@ module ActiveRecord
|
|
8
10
|
# from database binary(16) to string
|
9
11
|
def deserialize(value)
|
10
12
|
return nil if value.nil?
|
13
|
+
|
11
14
|
Data.from_database(value)
|
12
15
|
end
|
13
16
|
|
14
17
|
# from user input (string) to database
|
15
18
|
def cast(value)
|
16
|
-
|
19
|
+
case value
|
20
|
+
when Data
|
17
21
|
value
|
18
|
-
|
22
|
+
when ActiveSupport::ToJsonWithActiveSupportEncoder, String
|
19
23
|
Data.from_uuid_string(super)
|
20
24
|
else
|
21
|
-
raise ArgumentError,
|
22
|
-
"Unsupported input data of class type #{value.class}"
|
25
|
+
raise ArgumentError, "Unsupported input data of class type #{value.class}"
|
23
26
|
end
|
24
27
|
end
|
25
28
|
|
@@ -30,28 +33,31 @@ module ActiveRecord
|
|
30
33
|
def assert_valid_value(value)
|
31
34
|
case value.class
|
32
35
|
when String, ActiveSupport::ToJsonWithActiveSupportEncoder
|
33
|
-
if value.downcase.gsub(/[^a-f0-9]/, '').size == 32
|
36
|
+
if value.blank? || value.to_s.downcase.gsub(/[^a-f0-9]/, '').size == 32
|
34
37
|
value
|
35
38
|
else
|
36
|
-
raise SerializationTypeMismatch,
|
37
|
-
"Invalid String uuid #{value}."
|
39
|
+
raise SerializationTypeMismatch, "Invalid String uuid '#{value}'"
|
38
40
|
end
|
39
41
|
else
|
40
|
-
raise SerializationTypeMismatch,
|
41
|
-
"Unsupported value object of type #{value.class}."
|
42
|
+
raise SerializationTypeMismatch, "Unsupported value object of type #{value.class}."
|
42
43
|
end
|
43
44
|
end
|
44
45
|
|
45
46
|
class Data
|
46
47
|
def initialize(display_format, storage_format)
|
47
|
-
@display_format
|
48
|
+
@display_format = display_format
|
49
|
+
@storage_format = storage_format
|
48
50
|
end
|
49
51
|
|
50
52
|
def self.from_uuid_string(uuid)
|
53
|
+
return nil if uuid.nil?
|
54
|
+
|
51
55
|
new(uuid, uuid.downcase.gsub(/[^a-f0-9]/, ''))
|
52
56
|
end
|
53
57
|
|
54
58
|
def self.from_database(value)
|
59
|
+
return value if value.is_a? Data
|
60
|
+
|
55
61
|
storage_format = value.unpack('H*').first.rjust(32, '0')
|
56
62
|
new(
|
57
63
|
storage_format.gsub(/^(.{8})(.{4})(.{4})(.{4})(.{12})$/, '\1-\2-\3-\4-\5'),
|
@@ -62,7 +68,7 @@ module ActiveRecord
|
|
62
68
|
def to_s
|
63
69
|
@display_format
|
64
70
|
end
|
65
|
-
|
71
|
+
alias to_str to_s
|
66
72
|
|
67
73
|
def hex
|
68
74
|
@storage_format
|
@@ -72,7 +78,6 @@ module ActiveRecord
|
|
72
78
|
other == to_s || super
|
73
79
|
end
|
74
80
|
end
|
75
|
-
|
76
81
|
end
|
77
82
|
end
|
78
83
|
end
|
@@ -1,8 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'active_record'
|
2
|
-
require 'active_record/connection_adapters/mysql2_adapter'
|
3
4
|
require 'active_record-mysql-uuid_column/version'
|
4
|
-
require 'active_record-mysql-uuid_column/migration_column
|
5
|
-
require 'active_record-mysql-uuid_column/type_class
|
6
|
-
|
5
|
+
require 'active_record-mysql-uuid_column/migration_column'
|
6
|
+
require 'active_record-mysql-uuid_column/type_class'
|
7
|
+
|
8
|
+
if ActiveRecord.version.to_s >= '7.0'
|
9
|
+
require 'active_record-mysql-uuid_column/connection_adapter_quoting_monkey_patch'
|
10
|
+
else
|
11
|
+
require 'active_record-mysql-uuid_column/mysql2_adapter_monkey_patch'
|
12
|
+
end
|
7
13
|
|
8
14
|
ActiveRecord::Type.register(:uuid, ActiveRecord::Type::Uuid, adapter: :mysql2)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-mysql-uuid-column
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mathieu Jobin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,28 +16,70 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: byebug
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: codecov
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: looksee
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
27
69
|
- !ruby/object:Gem::Dependency
|
28
70
|
name: rake
|
29
71
|
requirement: !ruby/object:Gem::Requirement
|
30
72
|
requirements:
|
31
|
-
- - "
|
73
|
+
- - ">="
|
32
74
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
75
|
+
version: '0'
|
34
76
|
type: :development
|
35
77
|
prerelease: false
|
36
78
|
version_requirements: !ruby/object:Gem::Requirement
|
37
79
|
requirements:
|
38
|
-
- - "
|
80
|
+
- - ">="
|
39
81
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
82
|
+
version: '0'
|
41
83
|
- !ruby/object:Gem::Dependency
|
42
84
|
name: rspec
|
43
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -53,31 +95,45 @@ dependencies:
|
|
53
95
|
- !ruby/object:Gem::Version
|
54
96
|
version: '3.0'
|
55
97
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
98
|
+
name: rubocop
|
57
99
|
requirement: !ruby/object:Gem::Requirement
|
58
100
|
requirements:
|
59
|
-
- - "
|
101
|
+
- - ">="
|
60
102
|
- !ruby/object:Gem::Version
|
61
103
|
version: '0'
|
62
104
|
type: :development
|
63
105
|
prerelease: false
|
64
106
|
version_requirements: !ruby/object:Gem::Requirement
|
65
107
|
requirements:
|
66
|
-
- - "
|
108
|
+
- - ">="
|
67
109
|
- !ruby/object:Gem::Version
|
68
110
|
version: '0'
|
69
111
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
112
|
+
name: rubocop-performance
|
71
113
|
requirement: !ruby/object:Gem::Requirement
|
72
114
|
requirements:
|
73
|
-
- - "
|
115
|
+
- - ">="
|
74
116
|
- !ruby/object:Gem::Version
|
75
117
|
version: '0'
|
76
118
|
type: :development
|
77
119
|
prerelease: false
|
78
120
|
version_requirements: !ruby/object:Gem::Requirement
|
79
121
|
requirements:
|
80
|
-
- - "
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rubocop-rails
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
81
137
|
- !ruby/object:Gem::Version
|
82
138
|
version: '0'
|
83
139
|
- !ruby/object:Gem::Dependency
|
@@ -89,7 +145,7 @@ dependencies:
|
|
89
145
|
version: '5'
|
90
146
|
- - "<"
|
91
147
|
- !ruby/object:Gem::Version
|
92
|
-
version: '
|
148
|
+
version: '8'
|
93
149
|
type: :runtime
|
94
150
|
prerelease: false
|
95
151
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -99,32 +155,34 @@ dependencies:
|
|
99
155
|
version: '5'
|
100
156
|
- - "<"
|
101
157
|
- !ruby/object:Gem::Version
|
102
|
-
version: '
|
158
|
+
version: '8'
|
103
159
|
- !ruby/object:Gem::Dependency
|
104
160
|
name: mysql2
|
105
161
|
requirement: !ruby/object:Gem::Requirement
|
106
162
|
requirements:
|
107
|
-
- - "
|
163
|
+
- - ">="
|
108
164
|
- !ruby/object:Gem::Version
|
109
|
-
version: 0
|
165
|
+
version: '0'
|
110
166
|
type: :runtime
|
111
167
|
prerelease: false
|
112
168
|
version_requirements: !ruby/object:Gem::Requirement
|
113
169
|
requirements:
|
114
|
-
- - "
|
170
|
+
- - ">="
|
115
171
|
- !ruby/object:Gem::Version
|
116
|
-
version: 0
|
117
|
-
description:
|
118
|
-
|
172
|
+
version: '0'
|
173
|
+
description: Adds a :uuid column to ActiveRecord MySQL2 Adapter. Store UUIDs as 16
|
174
|
+
bytes binary column.
|
119
175
|
email:
|
120
176
|
- mathieu@justbudget.com
|
121
177
|
executables: []
|
122
178
|
extensions: []
|
123
179
|
extra_rdoc_files: []
|
124
180
|
files:
|
181
|
+
- ".github/workflows/build.yml"
|
125
182
|
- ".gitignore"
|
126
183
|
- ".rspec"
|
127
|
-
- ".
|
184
|
+
- ".rubocop.yml"
|
185
|
+
- ".rubocop_todo.yml"
|
128
186
|
- CODE_OF_CONDUCT.md
|
129
187
|
- Gemfile
|
130
188
|
- LICENSE.txt
|
@@ -133,7 +191,15 @@ files:
|
|
133
191
|
- activerecord-mysql-uuid-column.gemspec
|
134
192
|
- bin/console
|
135
193
|
- bin/setup
|
194
|
+
- gemfiles/Gemfile.rails-5.0.x
|
195
|
+
- gemfiles/Gemfile.rails-5.1.x
|
196
|
+
- gemfiles/Gemfile.rails-5.2.x
|
197
|
+
- gemfiles/Gemfile.rails-6.0.x
|
198
|
+
- gemfiles/Gemfile.rails-6.1.x
|
199
|
+
- gemfiles/Gemfile.rails-7.0.x
|
200
|
+
- gemfiles/Gemfile.rails-edge
|
136
201
|
- lib/active_record-mysql-uuid_column.rb
|
202
|
+
- lib/active_record-mysql-uuid_column/connection_adapter_quoting_monkey_patch.rb
|
137
203
|
- lib/active_record-mysql-uuid_column/migration_column.rb
|
138
204
|
- lib/active_record-mysql-uuid_column/mysql2_adapter_monkey_patch.rb
|
139
205
|
- lib/active_record-mysql-uuid_column/type_class.rb
|
@@ -150,16 +216,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
150
216
|
requirements:
|
151
217
|
- - ">="
|
152
218
|
- !ruby/object:Gem::Version
|
153
|
-
version: '
|
219
|
+
version: '2.5'
|
154
220
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
155
221
|
requirements:
|
156
222
|
- - ">="
|
157
223
|
- !ruby/object:Gem::Version
|
158
224
|
version: '0'
|
159
225
|
requirements: []
|
160
|
-
|
161
|
-
rubygems_version: 2.5.2
|
226
|
+
rubygems_version: 3.1.6
|
162
227
|
signing_key:
|
163
228
|
specification_version: 4
|
164
|
-
summary:
|
229
|
+
summary: Adds a :uuid column to ActiveRecord MySQL2 Adapter. Store UUIDs as 16 bytes
|
230
|
+
binary column.
|
165
231
|
test_files: []
|