activerecord-aurora-serverless-adapter 5.2.1 → 6.0.0

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: f3ad604df999e26ca0a4db13f00ca1c71616b6dbceecc24549cf38ea4c9c28a5
4
- data.tar.gz: b6a78002100ba027c0a83809f77de08887d40e360051c6efc583d181192b93f4
3
+ metadata.gz: 753090515e0b5d6dc65ac1fdabd712a1c7c673af742340d6e89c41464d1f5863
4
+ data.tar.gz: d48a50c7bc45a756202b4377ee16693db6d1ea153ba52d89459a3cb64f85f726
5
5
  SHA512:
6
- metadata.gz: 7dccc50158b4681545a944ddb3d4df0c28dbad0db48ee005edcf195aeaf5c8413ca58e97567cee3d7945afd853b962f224e21487f5759df739656b6e11a4c836
7
- data.tar.gz: ada81597e30e524a533391229e684b9d0de77171c92a875e7caa7ab4ed3d260cc303180f7d6f9a54aa85257c8f5cb83727b228ae2329e12c0c20d947c996b92c
6
+ metadata.gz: 418749f96453b0dedf58dc2183e4886f09180423c008ab2f7c0126f2db4abf031b9ac3f3df80cba3c2088b4a14a1798b3861df5f31cf0e0847ebcbf6f4c4092d
7
+ data.tar.gz: 700cab49d4ea92f32c24b74c2cc1edee63a1c0ad42004db8dcc56560486144ea7a1491cee584d9fba60ffef3d1aad6619180fc8f97a4d987c5108465bb2846b8
data/Gemfile CHANGED
@@ -2,7 +2,7 @@ source "https://rubygems.org"
2
2
  git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
3
3
  gemspec
4
4
 
5
- ENV['RAILS_VERSION'] = '5.2.4.1'
5
+ ENV['RAILS_VERSION'] = '6.0.2.1'
6
6
 
7
7
  # This allows us to bundle to Rails via Git to get the ActiveRecord test files
8
8
  # which comes down to a git tag. We can also use the `RAILS_VERSION` env variable
@@ -28,5 +28,3 @@ version = ENV['RAILS_VERSION'] || begin
28
28
  end
29
29
  end
30
30
  gem 'rails', github: "rails/rails", tag: "v#{version}"
31
- gem 'mocha', '1.9.0', require: false
32
- gem 'bcrypt'
data/Gemfile.lock CHANGED
@@ -1,74 +1,90 @@
1
1
  GIT
2
2
  remote: https://github.com/rails/rails
3
- revision: 56f45bedd617a76e8e3596c84c872a37c8be9795
4
- tag: v5.2.4.1
3
+ revision: 3a6e8a3ff94f8690dcd68d5184600eabc9e05664
4
+ tag: v6.0.2.1
5
5
  specs:
6
- actioncable (5.2.4.1)
7
- actionpack (= 5.2.4.1)
6
+ actioncable (6.0.2.1)
7
+ actionpack (= 6.0.2.1)
8
8
  nio4r (~> 2.0)
9
9
  websocket-driver (>= 0.6.1)
10
- actionmailer (5.2.4.1)
11
- actionpack (= 5.2.4.1)
12
- actionview (= 5.2.4.1)
13
- activejob (= 5.2.4.1)
10
+ actionmailbox (6.0.2.1)
11
+ actionpack (= 6.0.2.1)
12
+ activejob (= 6.0.2.1)
13
+ activerecord (= 6.0.2.1)
14
+ activestorage (= 6.0.2.1)
15
+ activesupport (= 6.0.2.1)
16
+ mail (>= 2.7.1)
17
+ actionmailer (6.0.2.1)
18
+ actionpack (= 6.0.2.1)
19
+ actionview (= 6.0.2.1)
20
+ activejob (= 6.0.2.1)
14
21
  mail (~> 2.5, >= 2.5.4)
15
22
  rails-dom-testing (~> 2.0)
16
- actionpack (5.2.4.1)
17
- actionview (= 5.2.4.1)
18
- activesupport (= 5.2.4.1)
23
+ actionpack (6.0.2.1)
24
+ actionview (= 6.0.2.1)
25
+ activesupport (= 6.0.2.1)
19
26
  rack (~> 2.0, >= 2.0.8)
20
27
  rack-test (>= 0.6.3)
21
28
  rails-dom-testing (~> 2.0)
22
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
23
- actionview (5.2.4.1)
24
- activesupport (= 5.2.4.1)
29
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
30
+ actiontext (6.0.2.1)
31
+ actionpack (= 6.0.2.1)
32
+ activerecord (= 6.0.2.1)
33
+ activestorage (= 6.0.2.1)
34
+ activesupport (= 6.0.2.1)
35
+ nokogiri (>= 1.8.5)
36
+ actionview (6.0.2.1)
37
+ activesupport (= 6.0.2.1)
25
38
  builder (~> 3.1)
26
39
  erubi (~> 1.4)
27
40
  rails-dom-testing (~> 2.0)
28
- rails-html-sanitizer (~> 1.0, >= 1.0.3)
29
- activejob (5.2.4.1)
30
- activesupport (= 5.2.4.1)
41
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
42
+ activejob (6.0.2.1)
43
+ activesupport (= 6.0.2.1)
31
44
  globalid (>= 0.3.6)
32
- activemodel (5.2.4.1)
33
- activesupport (= 5.2.4.1)
34
- activerecord (5.2.4.1)
35
- activemodel (= 5.2.4.1)
36
- activesupport (= 5.2.4.1)
37
- arel (>= 9.0)
38
- activestorage (5.2.4.1)
39
- actionpack (= 5.2.4.1)
40
- activerecord (= 5.2.4.1)
45
+ activemodel (6.0.2.1)
46
+ activesupport (= 6.0.2.1)
47
+ activerecord (6.0.2.1)
48
+ activemodel (= 6.0.2.1)
49
+ activesupport (= 6.0.2.1)
50
+ activestorage (6.0.2.1)
51
+ actionpack (= 6.0.2.1)
52
+ activejob (= 6.0.2.1)
53
+ activerecord (= 6.0.2.1)
41
54
  marcel (~> 0.3.1)
42
- activesupport (5.2.4.1)
55
+ activesupport (6.0.2.1)
43
56
  concurrent-ruby (~> 1.0, >= 1.0.2)
44
57
  i18n (>= 0.7, < 2)
45
58
  minitest (~> 5.1)
46
59
  tzinfo (~> 1.1)
47
- rails (5.2.4.1)
48
- actioncable (= 5.2.4.1)
49
- actionmailer (= 5.2.4.1)
50
- actionpack (= 5.2.4.1)
51
- actionview (= 5.2.4.1)
52
- activejob (= 5.2.4.1)
53
- activemodel (= 5.2.4.1)
54
- activerecord (= 5.2.4.1)
55
- activestorage (= 5.2.4.1)
56
- activesupport (= 5.2.4.1)
60
+ zeitwerk (~> 2.2)
61
+ rails (6.0.2.1)
62
+ actioncable (= 6.0.2.1)
63
+ actionmailbox (= 6.0.2.1)
64
+ actionmailer (= 6.0.2.1)
65
+ actionpack (= 6.0.2.1)
66
+ actiontext (= 6.0.2.1)
67
+ actionview (= 6.0.2.1)
68
+ activejob (= 6.0.2.1)
69
+ activemodel (= 6.0.2.1)
70
+ activerecord (= 6.0.2.1)
71
+ activestorage (= 6.0.2.1)
72
+ activesupport (= 6.0.2.1)
57
73
  bundler (>= 1.3.0)
58
- railties (= 5.2.4.1)
74
+ railties (= 6.0.2.1)
59
75
  sprockets-rails (>= 2.0.0)
60
- railties (5.2.4.1)
61
- actionpack (= 5.2.4.1)
62
- activesupport (= 5.2.4.1)
76
+ railties (6.0.2.1)
77
+ actionpack (= 6.0.2.1)
78
+ activesupport (= 6.0.2.1)
63
79
  method_source
64
80
  rake (>= 0.8.7)
65
- thor (>= 0.19.0, < 2.0)
81
+ thor (>= 0.20.3, < 2.0)
66
82
 
67
83
  PATH
68
84
  remote: .
69
85
  specs:
70
- activerecord-aurora-serverless-adapter (5.2.1)
71
- activerecord (~> 5.2.0)
86
+ activerecord-aurora-serverless-adapter (6.0.0)
87
+ activerecord (>= 6.0)
72
88
  aws-sdk-rdsdataservice
73
89
 
74
90
  GEM
@@ -79,7 +95,6 @@ GEM
79
95
  bundler
80
96
  rake
81
97
  thor (>= 0.14.0)
82
- arel (9.0.0)
83
98
  aws-eventstream (1.0.3)
84
99
  aws-partitions (1.260.0)
85
100
  aws-sdk-core (3.86.0)
@@ -92,7 +107,6 @@ GEM
92
107
  aws-sigv4 (~> 1.1)
93
108
  aws-sigv4 (1.1.0)
94
109
  aws-eventstream (~> 1.0, >= 1.0.2)
95
- bcrypt (3.1.13)
96
110
  builder (3.2.4)
97
111
  coderay (1.1.2)
98
112
  concurrent-ruby (1.1.5)
@@ -111,7 +125,6 @@ GEM
111
125
  mini_mime (>= 0.1.1)
112
126
  marcel (0.3.3)
113
127
  mimemagic (~> 0.3.2)
114
- metaclass (0.0.4)
115
128
  method_source (0.9.2)
116
129
  mimemagic (0.3.3)
117
130
  mini_mime (1.0.2)
@@ -124,8 +137,6 @@ GEM
124
137
  ruby-progressbar
125
138
  minitest-retry (0.1.9)
126
139
  minitest (>= 5.0)
127
- mocha (1.9.0)
128
- metaclass (~> 0.0.1)
129
140
  nio4r (2.5.2)
130
141
  nokogiri (1.10.7)
131
142
  mini_portile2 (~> 2.4.0)
@@ -157,6 +168,7 @@ GEM
157
168
  websocket-driver (0.7.1)
158
169
  websocket-extensions (>= 0.1.0)
159
170
  websocket-extensions (0.1.4)
171
+ zeitwerk (2.2.2)
160
172
 
161
173
  PLATFORMS
162
174
  ruby
@@ -164,12 +176,10 @@ PLATFORMS
164
176
  DEPENDENCIES
165
177
  activerecord-aurora-serverless-adapter!
166
178
  appraisal
167
- bcrypt
168
179
  dotenv
169
180
  minitest
170
181
  minitest-reporters
171
182
  minitest-retry
172
- mocha (= 1.9.0)
173
183
  pry
174
184
  rails!
175
185
  rake
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- # Activerecord Aurora Serverless Adapter
2
+ # ActiveRecord Aurora Serverless Adapter
3
3
 
4
4
  <a href="https://www.youtube.com/watch?v=Q0cqKl6ktIg"><img alt="Aurora Serverless on Rails" src="https://user-images.githubusercontent.com/2381/71551059-c507f180-29ab-11ea-91dc-0e83a0ed317f.png"></a>
5
5
 
@@ -7,7 +7,7 @@
7
7
 
8
8
  <a href="https://github.com/customink/lamby"><img src="https://user-images.githubusercontent.com/2381/59363668-89edeb80-8d03-11e9-9985-2ce14361b7e3.png" alt="Lamby: Simple Rails & AWS Lambda Integration using Rack." align="right" width="300" /></a>
9
9
 
10
- Simple ActiveRecord Mysql2 adapter extensions to allow Rails to use [AWS Aurora Serverless](https://aws.amazon.com/rds/aurora/serverless/) via the [Aws::RDSDataService::Client](https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/RDSDataService/Client.html) internface. Perfect if you are using [Lamby](https://lamby.custominktech.com) to deploy your Rails applications to AWS Lambda.
10
+ Simple ActiveRecord Mysql2 adapter extensions to allow Rails to use [AWS Aurora Serverless](https://aws.amazon.com/rds/aurora/serverless/) via the [Aws::RDSDataService::Client](https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/RDSDataService/Client.html) interface. Perfect if you are using [Lamby](https://lamby.custominktech.com) to deploy your Rails applications to AWS Lambda.
11
11
 
12
12
  **[Lamby: Simple Rails & AWS Lambda Integration using Rack.](https://lamby.custominktech.com)**
13
13
 
@@ -16,6 +16,7 @@ Simple ActiveRecord Mysql2 adapter extensions to allow Rails to use [AWS Aurora
16
16
 
17
17
  This gem allows Rails to seamless use
18
18
 
19
+ * Tested on Rails v5.2 and v6.0.
19
20
  * No need for the `mysql2` gem at all!
20
21
  * Developed and tested with Aurora Serverless MySQL v5.6.
21
22
  * Emoji support via `utf8mb4`. Please configure your cluster's parameter group. See our [CDK Stack](/blob/master/test/aurora-serverless/lib/aurora-serverless-stack.ts) for examples.
@@ -58,7 +59,7 @@ Cloning the repo and running the tests locally is super easy assuming you have:
58
59
  1. Docker Installed
59
60
  2. AWS Account Configured
60
61
 
61
- These commands will use Docker to setup a node runtime leveraging [AWD CDK](https://github.com/aws/aws-cdk) to deploy a Aurora Serverless stack. Note, you may be to use/set `AWS_PROFILE` for the deploy command.
62
+ These commands will use Docker to setup a node runtime leveraging [AWD CDK](https://github.com/aws/aws-cdk) to deploy an Aurora Serverless stack. Note, you may be to use/set `AWS_PROFILE` for the deploy command.
62
63
 
63
64
  ```s
64
65
  $ ./bin/bootstrap
@@ -67,7 +68,7 @@ $ export AASA_MASTER_PASS=supersecret
67
68
  $ ./test/bin/deploy-aurora
68
69
  ```
69
70
 
70
- The outputs of this deployed stack will containt an `AASASecretArn` and a `AASAAuroraClusterArn` value. Please place these into the local `.env` file in the following format where `{{ Value }}` is replaced.
71
+ The outputs of this deployed stack will contain an `AASASecretArn` and a `AASAAuroraClusterArn` value. Please place these into the local `.env` file in the following format where `{{ Value }}` is replaced.
71
72
 
72
73
  ```
73
74
  AASA_SECRET_ARN={{ AASASecretArn }}
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
  spec.bindir = 'exe'
18
18
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
19
  spec.require_paths = ['lib']
20
- spec.add_runtime_dependency 'activerecord', '~> 5.2.0'
20
+ spec.add_runtime_dependency 'activerecord', '>= 6.0'
21
21
  spec.add_runtime_dependency 'aws-sdk-rdsdataservice'
22
22
  spec.add_development_dependency 'appraisal'
23
23
  spec.add_development_dependency 'dotenv'
@@ -33,32 +33,33 @@ module ActiveRecord
33
33
 
34
34
  # Abstract Mysql Adapter
35
35
 
36
- def translate_exception(exception, message)
37
- case message
36
+ def translate_exception(exception, message:, sql:, binds:)
37
+ msg = exception.message
38
+ case msg
38
39
  when /Duplicate entry/
39
- RecordNotUnique.new(message)
40
+ RecordNotUnique.new(msg, sql: sql, binds: binds)
40
41
  when /foreign key constraint fails/
41
- InvalidForeignKey.new(message)
42
+ InvalidForeignKey.new(msg, sql: sql, binds: binds)
42
43
  when /Cannot add foreign key constraint/,
43
44
  /referenced column .* in foreign key constraint .* are incompatible/
44
- mismatched_foreign_key(message)
45
+ mismatched_foreign_key(msg, sql: sql, binds: binds)
45
46
  when /Data too long for column/
46
- ValueTooLong.new(message)
47
+ ValueTooLong.new(msg, sql: sql, binds: binds)
47
48
  when /Out of range value for column/
48
- RangeError.new(message)
49
+ RangeError.new(msg, sql: sql, binds: binds)
49
50
  when /Column .* cannot be null/,
50
51
  /Field .* doesn't have a default value/
51
- NotNullViolation.new(message)
52
+ NotNullViolation.new(msg, sql: sql, binds: binds)
52
53
  when /Deadlock found when trying to get lock/
53
- Deadlocked.new(message)
54
+ Deadlocked.new(msg, sql: sql, binds: binds)
54
55
  when /Lock wait timeout exceeded/
55
- LockWaitTimeout.new(message)
56
+ LockWaitTimeout.new(msg, sql: sql, binds: binds)
56
57
  when /max_statement_time exceeded/, /Sort aborted/
57
- StatementTimeout.new(message)
58
+ StatementTimeout.new(msg, sql: sql, binds: binds)
58
59
  when /Query execution was interrupted/
59
- QueryCanceled.new(message)
60
+ QueryCanceled.new(msg, sql: sql, binds: binds)
60
61
  else
61
- ActiveRecord::StatementInvalid.new(message)
62
+ ActiveRecord::StatementInvalid.new(msg, sql: sql, binds: binds)
62
63
  end
63
64
  end
64
65
 
@@ -63,10 +63,6 @@ module ActiveRecord
63
63
  nil
64
64
  end
65
65
 
66
- def more_results?
67
- false
68
- end
69
-
70
66
  end
71
67
  end
72
68
  AuroraServerless::Client.include AuroraServerless::Mysql2::Client
@@ -1,7 +1,7 @@
1
1
  module ActiveRecord
2
2
  module ConnectionAdapters
3
3
  module AuroraServerless
4
- VERSION = "5.2.1"
4
+ VERSION = "6.0.0"
5
5
  end
6
6
  end
7
7
  end
data/lib/mysql2.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  # This is here so the Mysql2 gem require will no-op.
2
2
  #
3
3
  module Mysql2
4
+ VERSION = '0.0.0'
4
5
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-aurora-serverless-adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.2.1
4
+ version: 6.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ken Collins
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-12-29 00:00:00.000000000 Z
11
+ date: 2020-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 5.2.0
19
+ version: '6.0'
20
20
  type: :runtime
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: 5.2.0
26
+ version: '6.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: aws-sdk-rdsdataservice
29
29
  requirement: !ruby/object:Gem::Requirement