lhm-shopify 4.1.1 → 4.2.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: 49f23bf2b018fc5af679644fb6c9f424f943a0d4dd58d7e2d8366b389ae4270b
4
- data.tar.gz: 14e15f4fc464d721b20889a1841c4a78a609bb3c6aee1a68ee5f3f5e3e89d2ec
3
+ metadata.gz: dec22d00a0a019706b1a6d62e85e416caf210aa2d0b4f77bb3ccf562f1db8fb2
4
+ data.tar.gz: 181acf59e61b100dc3320b6674a7cd13a2a1dcf767c7259a88a58dbf4b826bf5
5
5
  SHA512:
6
- metadata.gz: 86a7153f5278bdf8d26ebd0ca668dab3e4861ad5349e1115796a59b72ac7c8b0eb920cbe74f443e9913efd5b8c2861499c98ba37990d970177e273188656d02a
7
- data.tar.gz: f394a26a3dcf8e5737748610db039b28e9cde415a5a82f3b2f29f358f93124155ee6be68c8196bf027b807aedf19feb6f7a60d89097384242f31e65c96907fc7
6
+ metadata.gz: 8c197de7b7658cdb9c31dd91adde7fdaf54505bc7e910812d8c80edf447f6266630c08a80d773391071c518f72b9527280e1ece7e2bdc00bc60d5a8c22f294ed
7
+ data.tar.gz: 6f1f7da4e1bd2e61fb8921eb9e724408d01ee576d98eb8ba393c2c2dada846368ec2a187e5c61d77f3691290edc815addd0e93acb8e1fa065c206564243ef798
@@ -18,6 +18,11 @@ jobs:
18
18
  ruby: ["3.0", "3.1", "3.2", "head"]
19
19
  mysql: ["5.7", "8.0"]
20
20
  adapter: ["mysql2", "trilogy"]
21
+ exclude:
22
+ - activerecord: 6.1
23
+ ruby: head
24
+ - activerecord: 7.0
25
+ ruby: head
21
26
 
22
27
  env:
23
28
  BUNDLE_GEMFILE: "${{ github.workspace }}/gemfiles/activerecord_${{ matrix.activerecord }}.gemfile"
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Unreleased
2
2
 
3
+ # 4.2.1 (Mar, 2024)
4
+ * Retry more errors when using Trilogy.
5
+
6
+ # 4.2.0 (Mar, 2024)
7
+ * Support `DROP DEFAULT` & `SET DEFAULT` in `change_column` operations.
8
+
3
9
  # 4.1.1 (Nov, 2023)
4
10
  * Fix check for warnings against PK in MySQL 8+
5
11
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lhm-shopify (4.1.1)
4
+ lhm-shopify (4.2.1)
5
5
  retriable (>= 3.0.0)
6
6
 
7
7
  GEM
@@ -38,7 +38,7 @@ GEM
38
38
  ruby2_keywords
39
39
  i18n (1.14.1)
40
40
  concurrent-ruby (~> 1.0)
41
- minitest (5.20.0)
41
+ minitest (5.22.2)
42
42
  mocha (2.1.0)
43
43
  ruby2_keywords (>= 0.0.5)
44
44
  mutex_m (0.1.2)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- lhm-shopify (4.1.1)
4
+ lhm-shopify (4.2.1)
5
5
  retriable (>= 3.0.0)
6
6
 
7
7
  GEM
@@ -31,7 +31,7 @@ GEM
31
31
  docile (1.4.0)
32
32
  i18n (1.14.1)
33
33
  concurrent-ruby (~> 1.0)
34
- minitest (5.20.0)
34
+ minitest (5.22.2)
35
35
  mocha (2.1.0)
36
36
  ruby2_keywords (>= 0.0.5)
37
37
  mysql2 (0.5.5)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- lhm-shopify (4.1.1)
4
+ lhm-shopify (4.2.1)
5
5
  retriable (>= 3.0.0)
6
6
 
7
7
  GEM
@@ -30,7 +30,7 @@ GEM
30
30
  docile (1.4.0)
31
31
  i18n (1.14.1)
32
32
  concurrent-ruby (~> 1.0)
33
- minitest (5.20.0)
33
+ minitest (5.22.2)
34
34
  mocha (2.1.0)
35
35
  ruby2_keywords (>= 0.0.5)
36
36
  mysql2 (0.5.5)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- lhm-shopify (4.1.1)
4
+ lhm-shopify (4.2.1)
5
5
  retriable (>= 3.0.0)
6
6
 
7
7
  GEM
@@ -38,7 +38,7 @@ GEM
38
38
  ruby2_keywords
39
39
  i18n (1.14.1)
40
40
  concurrent-ruby (~> 1.0)
41
- minitest (5.20.0)
41
+ minitest (5.22.2)
42
42
  mocha (2.1.0)
43
43
  ruby2_keywords (>= 0.0.5)
44
44
  mutex_m (0.1.2)
data/lib/lhm/migrator.rb CHANGED
@@ -67,7 +67,11 @@ module Lhm
67
67
  # @param [String] name Name of the column to change
68
68
  # @param [String] definition Valid SQL column definition
69
69
  def change_column(name, definition)
70
- ddl('alter table `%s` modify column `%s` %s' % [@name, name, definition])
70
+ if definition.match?(/^(DROP|SET) DEFAULT/i)
71
+ ddl('alter table `%s` alter column `%s` %s' % [@name, name, definition])
72
+ else
73
+ ddl('alter table `%s` modify column `%s` %s' % [@name, name, definition])
74
+ end
71
75
  end
72
76
 
73
77
  # Rename an existing column.
data/lib/lhm/sql_retry.rb CHANGED
@@ -186,13 +186,26 @@ module Lhm
186
186
  def retriable_trilogy_errors
187
187
  return unless defined?(Trilogy::BaseError)
188
188
 
189
- {
189
+ errors = {
190
190
  ActiveRecord::StatementInvalid => [
191
- # Those sometimes appear as Trilogy::TimeoutError, and sometimes as ActiveRecord::StatementInvalid
192
191
  /Lock wait timeout exceeded/,
192
+ /Timeout waiting for a response from the last query/,
193
+ /Deadlock found when trying to get lock/,
194
+ /Query execution was interrupted/,
195
+ /Lost connection to MySQL server during query/,
196
+ /Max connect timeout reached/,
197
+ /Unknown MySQL server host/,
198
+ /connection is locked to hostgroup/,
199
+ /The MySQL server is running with the --read-only option so it cannot execute this statement/,
193
200
  ],
194
201
  Trilogy::ConnectionError => nil,
195
202
  }
203
+
204
+ if ActiveRecord::VERSION::STRING >= "7.1"
205
+ errors[ActiveRecord::ConnectionFailed] = nil
206
+ end
207
+
208
+ errors
196
209
  end
197
210
  end
198
211
  end
data/lib/lhm/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
  # Schmidt
3
3
 
4
4
  module Lhm
5
- VERSION = '4.1.1'
5
+ VERSION = '4.2.1'
6
6
  end
@@ -116,6 +116,22 @@ describe Lhm::Migrator do
116
116
  'alter table `lhmn_alt` modify column `logins` INT(11)'
117
117
  ])
118
118
  end
119
+
120
+ it "should drop a default" do
121
+ @creator.change_column('foo', 'DROP DEFAULT')
122
+
123
+ value(@creator.statements).must_equal([
124
+ 'alter table `lhmn_alt` alter column `foo` DROP DEFAULT'
125
+ ])
126
+ end
127
+
128
+ it "should set a default" do
129
+ @creator.change_column('foo', "SET DEFAULT 'bar'")
130
+
131
+ value(@creator.statements).must_equal([
132
+ "alter table `lhmn_alt` alter column `foo` SET DEFAULT 'bar'"
133
+ ])
134
+ end
119
135
  end
120
136
 
121
137
  describe 'direct changes' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lhm-shopify
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.1
4
+ version: 4.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - SoundCloud
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2023-11-22 00:00:00.000000000 Z
15
+ date: 2024-03-11 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: retriable
@@ -320,7 +320,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
320
320
  - !ruby/object:Gem::Version
321
321
  version: '0'
322
322
  requirements: []
323
- rubygems_version: 3.4.21
323
+ rubygems_version: 3.5.6
324
324
  signing_key:
325
325
  specification_version: 4
326
326
  summary: online schema changer for mysql