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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f122ca0476d8b8c06f1f4bf08219bdf653d0ba890a3cdb6d9d5d99dfec353424
4
- data.tar.gz: 0d1d58ea8a26637db28421610971049cbc9730201c39f9d9444757a65a249a4e
3
+ metadata.gz: 5af3537525b91e1c92af1b6ea6bdc8a5a872943a1cb5c8d895f50addb0ae7508
4
+ data.tar.gz: 0032d5ad04a924b166bbcf10b1fa9d01a5222aa57175fca0b645dd5df05eee70
5
5
  SHA512:
6
- metadata.gz: c37272d98ec13e144f2aa8c704d3db3140bf672cf3f6d7e76931acc7ab008b0a51cc91a51c402a8dbc14d73da3ce31092ace18e99efcf31b9ad4ff4c5fd6cb16
7
- data.tar.gz: d7bcabb538e9f4a588b7d28b79459c06e44c9bfaeffdcaf5e563823908cdad5bcf7de3cd9fd2da20b21062415686e40f5df0904b53e38b9ac367084021616a19
6
+ metadata.gz: 3d2855d4fd84b86d85191104aeee9e8574bf3a29bf095c4fec622c611db9c19694db182476d9bd89c2f78f98193c6b8f2fbadf4045fe6240a0d0f0091f30ff19
7
+ data.tar.gz: 02ebc48788b7d39f5d1684802a2941b10e237d880885c63e311d76493d02f6a5956ba98b54c77c9d54014eec0306ac4df9f91d78324279c621623500bbaf002b
data/.env CHANGED
@@ -1 +1 @@
1
- RUBY_VERSION=2.6
1
+ RUBY_VERSION=2.7
@@ -6,6 +6,7 @@ on:
6
6
  push:
7
7
  branches:
8
8
  - master
9
+ workflow_dispatch:
9
10
 
10
11
  jobs:
11
12
  standardrb:
@@ -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.6", "2.7", "3.0", "3.1"]
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
- - name: Test ActiveRecord ${{ matrix.activerecord-version }} and Ruby ${{ matrix.ruby-version }}
30
- run: RUBY_VERSION=${{ matrix.ruby-version }} docker-compose run -e AR_VERSION=${{ matrix.activerecord-version }} test
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: mysql --password=password -e "show databases;"
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: mysql --password=password -e "show databases;"
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: mysql --password=password -e "show databases;"
41
+ test: mysql --password=password -e "show databases;"
40
42
  pg12:
41
43
  image: postgres:12
42
44
  environment:
@@ -0,0 +1,10 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec path: ".."
4
+
5
+ gem "activesupport", "~> 7.0.5"
6
+ gem "activemodel", "~> 7.0.5"
7
+ gem "activerecord", "~> 7.0.5"
8
+ gem "sqlite3", "~> 1.4"
9
+ gem "mysql2", "~> 0.5"
10
+ gem "pg", "~> 1.1"
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"
@@ -23,9 +23,24 @@ module ULID
23
23
  def deserialize(value)
24
24
  return nil if value.nil?
25
25
 
26
- value = value.to_s if value.is_a?(Data)
27
- value = value.unpack1("H*") if value.encoding == Encoding::ASCII_8BIT
28
- value = value[2..-1] if value.start_with?("\\x")
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
@@ -1,5 +1,5 @@
1
1
  module ULID
2
2
  module Rails
3
- VERSION = "1.1.0"
3
+ VERSION = "1.1.1"
4
4
  end
5
5
  end
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.0
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: 2022-12-23 00:00:00.000000000 Z
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.1.6
215
+ rubygems_version: 3.4.12
215
216
  signing_key:
216
217
  specification_version: 4
217
218
  summary: ULID for rails