persistent_enum 1.2.4 → 1.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +44 -33
- data/lib/persistent_enum/version.rb +1 -1
- data/lib/persistent_enum.rb +5 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d11d2cd28eb40b76c5f0a286ba1f382342beaa62a216905357860c02e4078579
|
4
|
+
data.tar.gz: 031273743a7a2d2fa85c41c6bc0bd232e6741ac3ed96dc6cc70d2548fb5727fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1b9f31ed175df65e7cd60783c4e8892e1c7d776972dbae259581912b266a4648f5926ef0e67500d8cceaaeba603cce5b770151b91cd0a0cf849710f57e3415a
|
7
|
+
data.tar.gz: 2b1d79ba03dc20042189b6d76e785f7167b2345236b75a1ab59d66ec3c828cdba433d42d3bffbc4e6c0b3c5cb68f350510c26e63d727599df5a4f04e089b1b0f
|
data/.circleci/config.yml
CHANGED
@@ -2,7 +2,7 @@ version: 2.1
|
|
2
2
|
|
3
3
|
executors:
|
4
4
|
ruby-sqlite: &ruby
|
5
|
-
parameters:
|
5
|
+
parameters: &ruby_params
|
6
6
|
ruby-version:
|
7
7
|
type: string
|
8
8
|
default: "2.6"
|
@@ -22,26 +22,36 @@ executors:
|
|
22
22
|
BUNDLE_GEMFILE: << parameters.gemfile >>
|
23
23
|
ruby-pg:
|
24
24
|
<<: *ruby
|
25
|
+
parameters:
|
26
|
+
<<: *ruby_params
|
27
|
+
pg-version:
|
28
|
+
type: string
|
29
|
+
default: "11"
|
25
30
|
environment:
|
26
31
|
TEST_DATABASE_ENVIRONMENT: postgresql
|
27
32
|
PGHOST: 127.0.0.1
|
28
33
|
PGUSER: eikaiwa
|
29
34
|
docker:
|
30
35
|
- *ruby_docker_ruby
|
31
|
-
- image: circleci/postgres
|
36
|
+
- image: circleci/postgres:<< parameters.pg-version >>-alpine
|
32
37
|
environment:
|
33
38
|
POSTGRES_USER: eikaiwa
|
34
39
|
POSTGRES_DB: persistent_enum_test
|
35
40
|
POSTGRES_PASSWORD: ""
|
36
41
|
ruby-mysql:
|
37
42
|
<<: *ruby
|
43
|
+
parameters:
|
44
|
+
<<: *ruby_params
|
45
|
+
mysql-version:
|
46
|
+
type: string
|
47
|
+
default: "5.6"
|
38
48
|
environment:
|
39
49
|
TEST_DATABASE_ENVIRONMENT: mysql2
|
40
50
|
MYSQL_HOST: 127.0.0.1
|
41
51
|
MYSQL_USER: root
|
42
52
|
docker:
|
43
53
|
- *ruby_docker_ruby
|
44
|
-
- image:
|
54
|
+
- image: circleci/mysql:<< parameters.mysql-version >>
|
45
55
|
environment:
|
46
56
|
MYSQL_ALLOW_EMPTY_PASSWORD: yes
|
47
57
|
MYSQL_ROOT_PASSWORD: ''
|
@@ -50,12 +60,19 @@ executors:
|
|
50
60
|
jobs:
|
51
61
|
test:
|
52
62
|
parameters:
|
53
|
-
|
54
|
-
type:
|
63
|
+
executor-name:
|
64
|
+
type: string
|
65
|
+
ruby-version:
|
66
|
+
type: string
|
67
|
+
gemfile:
|
68
|
+
type: string
|
55
69
|
database-steps:
|
56
70
|
type: steps
|
57
71
|
default: []
|
58
|
-
executor:
|
72
|
+
executor:
|
73
|
+
name: << parameters.executor-name >>
|
74
|
+
ruby-version: << parameters.ruby-version >>
|
75
|
+
gemfile: << parameters.gemfile >>
|
59
76
|
parallelism: 1
|
60
77
|
steps:
|
61
78
|
- checkout
|
@@ -71,15 +88,15 @@ jobs:
|
|
71
88
|
|
72
89
|
- restore_cache:
|
73
90
|
keys:
|
74
|
-
-
|
75
|
-
-
|
91
|
+
- persistent_enum-<< parameters.ruby-version >>-{{ checksum "/tmp/gem-lock" }}
|
92
|
+
- persistent_enum-
|
76
93
|
|
77
94
|
- run:
|
78
95
|
name: Bundle Install
|
79
96
|
command: bundle check || bundle install
|
80
97
|
|
81
98
|
- save_cache:
|
82
|
-
key:
|
99
|
+
key: persistent_enum-<< parameters.ruby-version >>-{{ checksum "/tmp/gem-lock" }}
|
83
100
|
paths:
|
84
101
|
- vendor/bundle
|
85
102
|
|
@@ -114,45 +131,39 @@ workflows:
|
|
114
131
|
jobs:
|
115
132
|
- test:
|
116
133
|
name: 'ruby 2.6 rails 5.2 sqlite'
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
gemfile: gemfiles/rails_5_2.gemfile
|
134
|
+
executor-name: ruby-sqlite
|
135
|
+
ruby-version: "2.6"
|
136
|
+
gemfile: gemfiles/rails_5_2.gemfile
|
121
137
|
- test:
|
122
138
|
name: 'ruby 2.6 rails 6.0 sqlite'
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
gemfile: gemfiles/rails_6_0_beta.gemfile
|
139
|
+
executor-name: ruby-sqlite
|
140
|
+
ruby-version: "2.6"
|
141
|
+
gemfile: gemfiles/rails_6_0_beta.gemfile
|
127
142
|
- test:
|
128
143
|
name: 'ruby 2.6 rails 5.2 pg'
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
gemfile: gemfiles/rails_5_2.gemfile
|
144
|
+
executor-name: ruby-pg
|
145
|
+
ruby-version: "2.6"
|
146
|
+
gemfile: gemfiles/rails_5_2.gemfile
|
133
147
|
database-steps: &pg_wait
|
134
148
|
- run: dockerize -wait tcp://localhost:5432 -timeout 1m
|
135
149
|
- test:
|
136
150
|
name: 'ruby 2.6 rails 6.0 pg'
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
gemfile: gemfiles/rails_6_0_beta.gemfile
|
151
|
+
executor-name: ruby-pg
|
152
|
+
ruby-version: "2.6"
|
153
|
+
gemfile: gemfiles/rails_6_0_beta.gemfile
|
141
154
|
database-steps: *pg_wait
|
142
155
|
- test:
|
143
156
|
name: 'ruby 2.6 rails 5.2 mysql'
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
gemfile: gemfiles/rails_5_2.gemfile
|
157
|
+
executor-name: ruby-mysql
|
158
|
+
ruby-version: "2.6"
|
159
|
+
gemfile: gemfiles/rails_5_2.gemfile
|
148
160
|
database-steps: &mysql_wait
|
149
161
|
- run: dockerize -wait tcp://localhost:3306 -timeout 1m
|
150
162
|
- test:
|
151
163
|
name: 'ruby 2.6 rails 6.0 mysql'
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
gemfile: gemfiles/rails_6_0_beta.gemfile
|
164
|
+
executor-name: ruby-mysql
|
165
|
+
ruby-version: "2.6"
|
166
|
+
gemfile: gemfiles/rails_6_0_beta.gemfile
|
156
167
|
database-steps: *mysql_wait
|
157
168
|
- publish:
|
158
169
|
filters:
|
data/lib/persistent_enum.rb
CHANGED
@@ -265,10 +265,12 @@ module PersistentEnum
|
|
265
265
|
when 'PostgreSQL'
|
266
266
|
model.import!(rows, on_duplicate_key_update: { conflict_target: [name_attr], columns: upsert_columns })
|
267
267
|
when 'Mysql2'
|
268
|
+
# Even for identical rows in the same order, a INSERT .. ON DUPLICATE
|
269
|
+
# KEY UPDATE or INSERT IGNORE can deadlock with itself. Obtain write
|
270
|
+
# locks in advance.
|
271
|
+
model.lock('FOR UPDATE').order(:id).pluck(:id)
|
272
|
+
|
268
273
|
if upsert_columns.present?
|
269
|
-
# Even for identical rows in the same order, a INSERT .. ON DUPLICATE
|
270
|
-
# KEY UPDATE can deadlock with itself. Obtain write locks in advance.
|
271
|
-
model.lock('FOR UPDATE').order(:id).pluck(:id)
|
272
274
|
model.import!(rows, on_duplicate_key_update: upsert_columns)
|
273
275
|
else
|
274
276
|
model.import!(rows, on_duplicate_key_ignore: true)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: persistent_enum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- iKnow
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -226,7 +226,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
226
226
|
- !ruby/object:Gem::Version
|
227
227
|
version: '0'
|
228
228
|
requirements: []
|
229
|
-
rubygems_version: 3.0.3
|
229
|
+
rubygems_version: 3.0.3.1
|
230
230
|
signing_key:
|
231
231
|
specification_version: 4
|
232
232
|
summary: Database-backed enums for Rails
|