ulid-rails 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.env +1 -1
- data/.github/workflows/lint.yml +1 -0
- data/.github/workflows/test.yml +11 -5
- data/CHANGELOG.md +7 -0
- data/README.md +3 -1
- data/docker-compose.yml +6 -4
- data/gemfiles/7.0.5.gemfile +10 -0
- data/gemfiles/7.0.gemfile +3 -3
- data/lib/ulid/rails/type.rb +18 -3
- data/lib/ulid/rails/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5af3537525b91e1c92af1b6ea6bdc8a5a872943a1cb5c8d895f50addb0ae7508
|
4
|
+
data.tar.gz: 0032d5ad04a924b166bbcf10b1fa9d01a5222aa57175fca0b645dd5df05eee70
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d2855d4fd84b86d85191104aeee9e8574bf3a29bf095c4fec622c611db9c19694db182476d9bd89c2f78f98193c6b8f2fbadf4045fe6240a0d0f0091f30ff19
|
7
|
+
data.tar.gz: 02ebc48788b7d39f5d1684802a2941b10e237d880885c63e311d76493d02f6a5956ba98b54c77c9d54014eec0306ac4df9f91d78324279c621623500bbaf002b
|
data/.env
CHANGED
@@ -1 +1 @@
|
|
1
|
-
RUBY_VERSION=2.
|
1
|
+
RUBY_VERSION=2.7
|
data/.github/workflows/lint.yml
CHANGED
data/.github/workflows/test.yml
CHANGED
@@ -6,25 +6,31 @@ on:
|
|
6
6
|
push:
|
7
7
|
branches:
|
8
8
|
- master
|
9
|
+
workflow_dispatch:
|
9
10
|
|
10
11
|
jobs:
|
11
12
|
tests:
|
13
|
+
name: ActiveRecord ${{ matrix.activerecord-version }} / Ruby ${{ matrix.ruby-version }}
|
12
14
|
runs-on: ubuntu-latest
|
13
15
|
strategy:
|
14
16
|
fail-fast: false
|
15
17
|
matrix:
|
16
|
-
activerecord-version: ["5.0", "5.1", "5.2", "6.0", "6.1", "7.0"]
|
17
|
-
ruby-version: ["2.
|
18
|
+
activerecord-version: ["5.0", "5.1", "5.2", "6.0", "6.1", "7.0", "7.0.5"]
|
19
|
+
ruby-version: ["2.7", "3.0", "3.1", "3.2"]
|
18
20
|
exclude:
|
19
21
|
- {activerecord-version: "5.0", ruby-version: "3.0"}
|
20
22
|
- {activerecord-version: "5.0", ruby-version: "3.1"}
|
23
|
+
- {activerecord-version: "5.0", ruby-version: "3.2"}
|
21
24
|
- {activerecord-version: "5.1", ruby-version: "3.0"}
|
22
25
|
- {activerecord-version: "5.1", ruby-version: "3.1"}
|
26
|
+
- {activerecord-version: "5.1", ruby-version: "3.2"}
|
23
27
|
- {activerecord-version: "5.2", ruby-version: "3.0"}
|
24
28
|
- {activerecord-version: "5.2", ruby-version: "3.1"}
|
29
|
+
- {activerecord-version: "5.2", ruby-version: "3.2"}
|
25
30
|
- {activerecord-version: "6.0", ruby-version: "3.1"}
|
26
|
-
- {activerecord-version: "7.0", ruby-version: "2.6"}
|
27
31
|
steps:
|
28
32
|
- uses: actions/checkout@v3
|
29
|
-
-
|
30
|
-
|
33
|
+
- run: docker-compose run test
|
34
|
+
env:
|
35
|
+
RUBY_VERSION: ${{ matrix.ruby-version }}
|
36
|
+
AR_VERSION: ${{ matrix.activerecord-version }}
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# ulid-rails CHANGELOG
|
2
2
|
|
3
|
+
## Unreleased
|
4
|
+
|
5
|
+
## 1.1.1
|
6
|
+
|
7
|
+
- Drop support for ruby 2.6.
|
8
|
+
- Fix compatibility with ActiveRecord 7.0.5+.
|
9
|
+
|
3
10
|
## 1.1.0
|
4
11
|
|
5
12
|
- Fix eager loading with limit/offset on models that have ulid primary key. The fix only applies to ActiveRecord 5.2, 6 and 7 (#38).
|
data/README.md
CHANGED
@@ -37,6 +37,8 @@ Specify `id: false` to `create_table` and add `id` column as 16-byte binary type
|
|
37
37
|
end
|
38
38
|
```
|
39
39
|
|
40
|
+
**MySQL note:** You can also declare the `id` column as `t.column :id, 'binary(16)'` when using MySQL, given that the syntax in the example will generate a SQL that makes the id as `VARBINARY(16)` instead of `BINARY(16)`.
|
41
|
+
|
40
42
|
### Model Changes
|
41
43
|
|
42
44
|
Just add the below lines to your models.
|
@@ -110,7 +112,7 @@ You need to specicfy `type` option
|
|
110
112
|
|
111
113
|
Please note that this library doesn't work properly with `has_and_belongs_to_many` associations.
|
112
114
|
|
113
|
-
Our recommendation is to be explicit and instead use the `has_many, through: join_class` association.
|
115
|
+
Our recommendation is to be explicit and instead use the `has_many, through: join_class` association.
|
114
116
|
Notice that for it to work properly you must specify the `has_many` to the join class in the main classes of the association,
|
115
117
|
and your join class must have `belongs_to` main classes defined as shown in the example below:
|
116
118
|
|
data/docker-compose.yml
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
version: '3.6'
|
2
2
|
services:
|
3
3
|
test:
|
4
|
-
image: "ruby:${RUBY_VERSION}"
|
4
|
+
image: "ruby:${RUBY_VERSION}"
|
5
5
|
command: sh -c "rm -f Gemfile.lock && bundle install && bin/run_tests"
|
6
|
+
environment:
|
7
|
+
- AR_VERSION=${AR_VERSION}
|
6
8
|
depends_on:
|
7
9
|
pg12:
|
8
10
|
condition: service_healthy
|
@@ -23,20 +25,20 @@ services:
|
|
23
25
|
MYSQL_ROOT_PASSWORD: password
|
24
26
|
command: --innodb-large-prefix --innodb-file-format=barracuda
|
25
27
|
healthcheck:
|
26
|
-
test:
|
28
|
+
test: mysql --password=password -e "show databases;"
|
27
29
|
mysql57:
|
28
30
|
image: mysql:5.7
|
29
31
|
environment:
|
30
32
|
MYSQL_ROOT_PASSWORD: password
|
31
33
|
healthcheck:
|
32
|
-
test:
|
34
|
+
test: mysql --password=password -e "show databases;"
|
33
35
|
mysql80:
|
34
36
|
image: mysql:8.0
|
35
37
|
command: --default-authentication-plugin=mysql_native_password
|
36
38
|
environment:
|
37
39
|
MYSQL_ROOT_PASSWORD: password
|
38
40
|
healthcheck:
|
39
|
-
test:
|
41
|
+
test: mysql --password=password -e "show databases;"
|
40
42
|
pg12:
|
41
43
|
image: postgres:12
|
42
44
|
environment:
|
data/gemfiles/7.0.gemfile
CHANGED
@@ -2,9 +2,9 @@ source "https://rubygems.org"
|
|
2
2
|
|
3
3
|
gemspec path: ".."
|
4
4
|
|
5
|
-
gem "activesupport", "~> 7.0.0"
|
6
|
-
gem "activemodel", "~> 7.0.0"
|
7
|
-
gem "activerecord", "~> 7.0.0"
|
5
|
+
gem "activesupport", "~> 7.0.0", "< 7.0.5"
|
6
|
+
gem "activemodel", "~> 7.0.0", "< 7.0.5"
|
7
|
+
gem "activerecord", "~> 7.0.0", "< 7.0.5"
|
8
8
|
gem "sqlite3", "~> 1.4"
|
9
9
|
gem "mysql2", "~> 0.5"
|
10
10
|
gem "pg", "~> 1.1"
|
data/lib/ulid/rails/type.rb
CHANGED
@@ -23,9 +23,24 @@ module ULID
|
|
23
23
|
def deserialize(value)
|
24
24
|
return nil if value.nil?
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
case adapter
|
27
|
+
when "mysql2"
|
28
|
+
if value.is_a?(Data)
|
29
|
+
value = value.to_s
|
30
|
+
elsif value.is_a?(String)
|
31
|
+
value = value.unpack1("H*")
|
32
|
+
end
|
33
|
+
when "postgresql"
|
34
|
+
if value.is_a?(Data)
|
35
|
+
value = value.to_s
|
36
|
+
value = value.unpack1("H*")
|
37
|
+
end
|
38
|
+
value = value[2..-1] if value.start_with?("\\x")
|
39
|
+
when "sqlite3"
|
40
|
+
if value.is_a?(Data)
|
41
|
+
value = value.to_s
|
42
|
+
end
|
43
|
+
end
|
29
44
|
|
30
45
|
value.length == 32 ? @formatter.format(value) : super
|
31
46
|
end
|
data/lib/ulid/rails/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ulid-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kazunori Kajihiro
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2023-05-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ulid
|
@@ -179,6 +179,7 @@ files:
|
|
179
179
|
- gemfiles/5.2.gemfile
|
180
180
|
- gemfiles/6.0.gemfile
|
181
181
|
- gemfiles/6.1.gemfile
|
182
|
+
- gemfiles/7.0.5.gemfile
|
182
183
|
- gemfiles/7.0.gemfile
|
183
184
|
- lib/ulid/rails.rb
|
184
185
|
- lib/ulid/rails/errors.rb
|
@@ -211,7 +212,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
211
212
|
- !ruby/object:Gem::Version
|
212
213
|
version: '0'
|
213
214
|
requirements: []
|
214
|
-
rubygems_version: 3.
|
215
|
+
rubygems_version: 3.4.12
|
215
216
|
signing_key:
|
216
217
|
specification_version: 4
|
217
218
|
summary: ULID for rails
|