active_record_proxy_adapters 0.3.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 151caa80f35f53ad02ef3307a55ef0fec4f1a6f369e6afac8d063e4ea2ad5e7f
4
- data.tar.gz: 60213ad52a363c435514038eeb65227bff7132b91a6dbed86b8917459449c39e
3
+ metadata.gz: 6ccf5136620d4473a468a5749886cb74d4a585b6d9b9f3f77c451715a16d9384
4
+ data.tar.gz: a75b44a62192b0cff1741170c9acff251fd19348f3651ff1750446bf8d459596
5
5
  SHA512:
6
- metadata.gz: 7720b6fe6b2d6848d30444f77c71d2567996f2e45011c79e6c4791e043b7d9333c2d92554cdf5f6b5a48c29c6b384509a00b9f9b3b930402d47c98188744daa7
7
- data.tar.gz: b73be535ad798afb4386d4027e4e92df00d9864a196d4cc1d30ad3a0a4e524c87ad12f67d214ef524a1641800ccf5bc2ab4911acf49c5606d867f51981a18fec
6
+ metadata.gz: 9b37879abd9fd61b31bf50d450f50d0721be6251a8da0402732f3dbff1c5e486d728422581e3d95a8c5f4e762ac0a8b2ba364863e84728b3c0f5a5d54fe9eb5e
7
+ data.tar.gz: 553d0c18c4274aab856c3a8f6bcc110d41babd290fe1397ec07f5abfcde810d6b22e734afd33a7035c072f1f5d2b9e1a6f6fd1d29ce19f5bd9b1b89e967f3803
data/.rubocop.yml CHANGED
@@ -4,6 +4,8 @@ require:
4
4
  AllCops:
5
5
  TargetRubyVersion: 3.1
6
6
  NewCops: enable
7
+ Exclude:
8
+ - 'gemfiles/**/*'
7
9
 
8
10
  Style/StringLiterals:
9
11
  EnforcedStyle: double_quotes
data/Appraisals ADDED
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ appraise "rails-7.0" do
4
+ gem "activerecord", "~> 7.0.0"
5
+ gem "activesupport", "~> 7.0.0"
6
+ gem "concurrent-ruby", "1.3.4"
7
+ gem "mutex_m"
8
+ gem "bigdecimal"
9
+ gem "activerecord-trilogy-adapter"
10
+ end
11
+
12
+ appraise "rails-7.1" do
13
+ gem "activerecord", "~> 7.1.0"
14
+ gem "activesupport", "~> 7.1.0"
15
+ end
16
+
17
+ appraise "rails-7.2" do
18
+ gem "activerecord", "~> 7.2.0"
19
+ gem "activesupport", "~> 7.2.0"
20
+ end
21
+
22
+ appraise "rails-8.0" do
23
+ gem "activerecord", "~> 8.0.0"
24
+ gem "activesupport", "~> 8.0.0"
25
+ end
data/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
1
  ## [Unreleased]
2
2
 
3
- - Fix Active Record adapters dependency loading
3
+ - Add load hooks for proxy adapters
4
+ - Add TrilogyProxyAdapter
5
+
6
+ ## [0.3.1] - 2025-02-12
7
+ - Fix Active Record adapters dependency loading https://github.com/Nasdaq/active_record_proxy_adapters/commit/b729f8bdb517cdc80f348c00e1fe4c5b56b76143
4
8
 
5
9
  ## [0.3.0] - 2025-01-17
6
10
 
data/Dockerfile CHANGED
@@ -1,8 +1,8 @@
1
1
  ARG RUBY_VERSION=3.2.3
2
2
  ARG DOCKER_REGISTRY=docker.io
3
3
  FROM $DOCKER_REGISTRY/ruby:$RUBY_VERSION-alpine
4
- ARG RAILS_VERSION="~> 6.1.0"
5
- ENV RAILS_VERSION=$RAILS_VERSION
4
+ ENV RAILS_VERSION="8.0.0"
5
+ ENV RAILS_ENV=test
6
6
 
7
7
  RUN apk --update add \
8
8
  build-base \
@@ -17,4 +17,5 @@ COPY . /app
17
17
  WORKDIR /app
18
18
 
19
19
  RUN bundle install
20
+ RUN bundle exec appraisal install
20
21
 
data/docker-compose.yml CHANGED
@@ -16,29 +16,29 @@ services:
16
16
  build:
17
17
  args:
18
18
  - RUBY_VERSION=${RUBY_VERSION:-3.3.6}
19
- - RAILS_VERSION=${RAILS_VERSION:-8.0.0}
20
19
  container_name: app
21
20
  image: active_record_proxy_adapters-app:${ENV_TAG:-latest}
22
21
  tty: true
23
22
  stdin_open: true
24
23
  environment:
25
- PGHOST: postgres_primary
26
- PG_PRIMARY_USER: postgres_primary_test
27
- PG_PRIMARY_PASSWORD: postgres_primary_test
28
- PG_PRIMARY_HOST: postgres_primary
29
- PG_PRIMARY_PORT: 5432
30
- PG_REPLICA_USER: postgres_primary_test
31
- PG_REPLICA_PASSWORD: postgres_primary_test
32
- PG_REPLICA_HOST: postgres_replica
33
- PG_REPLICA_PORT: 5432
34
- MYSQL_PRIMARY_USER: root
35
- MYSQL_PRIMARY_PASSWORD: mysql
36
- MYSQL_PRIMARY_HOST: mysql_primary
37
- MYSQL_PRIMARY_PORT: 3306
38
- MYSQL_REPLICA_USER: root
39
- MYSQL_REPLICA_PASSWORD: mysql
40
- MYSQL_REPLICA_HOST: mysql_primary
41
- MYSQL_REPLICA_PORT: 3306
24
+ - RAILS_VERSION=${RAILS_VERSION:-8.0.0}
25
+ - PGHOST=postgres_primary
26
+ - PG_PRIMARY_USER=postgres_primary_test
27
+ - PG_PRIMARY_PASSWORD=postgres_primary_test
28
+ - PG_PRIMARY_HOST=postgres_primary
29
+ - PG_PRIMARY_PORT=5432
30
+ - PG_REPLICA_USER=postgres_primary_test
31
+ - PG_REPLICA_PASSWORD=postgres_primary_test
32
+ - PG_REPLICA_HOST=postgres_replica
33
+ - PG_REPLICA_PORT=5432
34
+ - MYSQL_PRIMARY_USER=root
35
+ - MYSQL_PRIMARY_PASSWORD=mysql
36
+ - MYSQL_PRIMARY_HOST=mysql_primary
37
+ - MYSQL_PRIMARY_PORT=3306
38
+ - MYSQL_REPLICA_USER=root
39
+ - MYSQL_REPLICA_PASSWORD=mysql
40
+ - MYSQL_REPLICA_HOST=mysql_primary
41
+ - MYSQL_REPLICA_PORT=3306
42
42
  depends_on:
43
43
  - postgres_primary
44
44
  - postgres_replica
@@ -0,0 +1,25 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "mysql2", "~> 0.5"
6
+ gem "pg", "~> 1.5"
7
+ gem "trilogy", "~> 2.9"
8
+ gem "rake", "~> 13.0"
9
+ gem "appraisal"
10
+ gem "activerecord", "~> 7.0.0"
11
+ gem "activesupport", "~> 7.0.0"
12
+ gem "concurrent-ruby", "1.3.4"
13
+ gem "mutex_m"
14
+ gem "bigdecimal"
15
+ gem "activerecord-trilogy-adapter"
16
+
17
+ group :test do
18
+ gem "rspec", "~> 3.0"
19
+ gem "rubocop", "~> 1.72"
20
+ gem "rubocop-rspec", "~> 3.5.0"
21
+ gem "simplecov"
22
+ gem "simplecov-cobertura"
23
+ end
24
+
25
+ gemspec path: "../"
@@ -0,0 +1,122 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ active_record_proxy_adapters (0.3.1)
5
+ activerecord (>= 7.0.0, < 8.1)
6
+ activesupport (>= 7.0.0, < 8.1)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ activemodel (7.0.8.7)
12
+ activesupport (= 7.0.8.7)
13
+ activerecord (7.0.8.7)
14
+ activemodel (= 7.0.8.7)
15
+ activesupport (= 7.0.8.7)
16
+ activerecord-trilogy-adapter (3.1.2)
17
+ activerecord (>= 6.0.a, < 7.1.a)
18
+ trilogy (>= 2.4.0)
19
+ activesupport (7.0.8.7)
20
+ concurrent-ruby (~> 1.0, >= 1.0.2)
21
+ i18n (>= 1.6, < 2)
22
+ minitest (>= 5.1)
23
+ tzinfo (~> 2.0)
24
+ appraisal (2.5.0)
25
+ bundler
26
+ rake
27
+ thor (>= 0.14.0)
28
+ ast (2.4.2)
29
+ bigdecimal (3.1.9)
30
+ concurrent-ruby (1.3.4)
31
+ diff-lcs (1.6.0)
32
+ docile (1.4.1)
33
+ i18n (1.14.7)
34
+ concurrent-ruby (~> 1.0)
35
+ json (2.10.1)
36
+ language_server-protocol (3.17.0.4)
37
+ lint_roller (1.1.0)
38
+ minitest (5.25.4)
39
+ mutex_m (0.3.0)
40
+ mysql2 (0.5.6)
41
+ parallel (1.26.3)
42
+ parser (3.3.7.1)
43
+ ast (~> 2.4.1)
44
+ racc
45
+ pg (1.5.9)
46
+ racc (1.8.1)
47
+ rainbow (3.1.1)
48
+ rake (13.2.1)
49
+ regexp_parser (2.10.0)
50
+ rexml (3.4.0)
51
+ rspec (3.13.0)
52
+ rspec-core (~> 3.13.0)
53
+ rspec-expectations (~> 3.13.0)
54
+ rspec-mocks (~> 3.13.0)
55
+ rspec-core (3.13.3)
56
+ rspec-support (~> 3.13.0)
57
+ rspec-expectations (3.13.3)
58
+ diff-lcs (>= 1.2.0, < 2.0)
59
+ rspec-support (~> 3.13.0)
60
+ rspec-mocks (3.13.2)
61
+ diff-lcs (>= 1.2.0, < 2.0)
62
+ rspec-support (~> 3.13.0)
63
+ rspec-support (3.13.2)
64
+ rubocop (1.72.2)
65
+ json (~> 2.3)
66
+ language_server-protocol (~> 3.17.0.2)
67
+ lint_roller (~> 1.1.0)
68
+ parallel (~> 1.10)
69
+ parser (>= 3.3.0.2)
70
+ rainbow (>= 2.2.2, < 4.0)
71
+ regexp_parser (>= 2.9.3, < 3.0)
72
+ rubocop-ast (>= 1.38.0, < 2.0)
73
+ ruby-progressbar (~> 1.7)
74
+ unicode-display_width (>= 2.4.0, < 4.0)
75
+ rubocop-ast (1.38.0)
76
+ parser (>= 3.3.1.0)
77
+ rubocop-rspec (3.5.0)
78
+ lint_roller (~> 1.1)
79
+ rubocop (~> 1.72, >= 1.72.1)
80
+ ruby-progressbar (1.13.0)
81
+ simplecov (0.22.0)
82
+ docile (~> 1.1)
83
+ simplecov-html (~> 0.11)
84
+ simplecov_json_formatter (~> 0.1)
85
+ simplecov-cobertura (2.1.0)
86
+ rexml
87
+ simplecov (~> 0.19)
88
+ simplecov-html (0.13.1)
89
+ simplecov_json_formatter (0.1.4)
90
+ thor (1.3.2)
91
+ trilogy (2.9.0)
92
+ tzinfo (2.0.6)
93
+ concurrent-ruby (~> 1.0)
94
+ unicode-display_width (3.1.4)
95
+ unicode-emoji (~> 4.0, >= 4.0.4)
96
+ unicode-emoji (4.0.4)
97
+
98
+ PLATFORMS
99
+ aarch64-linux-musl
100
+ ruby
101
+
102
+ DEPENDENCIES
103
+ active_record_proxy_adapters!
104
+ activerecord (~> 7.0.0)
105
+ activerecord-trilogy-adapter
106
+ activesupport (~> 7.0.0)
107
+ appraisal
108
+ bigdecimal
109
+ concurrent-ruby (= 1.3.4)
110
+ mutex_m
111
+ mysql2 (~> 0.5)
112
+ pg (~> 1.5)
113
+ rake (~> 13.0)
114
+ rspec (~> 3.0)
115
+ rubocop (~> 1.72)
116
+ rubocop-rspec (~> 3.5.0)
117
+ simplecov
118
+ simplecov-cobertura
119
+ trilogy (~> 2.9)
120
+
121
+ BUNDLED WITH
122
+ 2.5.13
@@ -0,0 +1,21 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "mysql2", "~> 0.5"
6
+ gem "pg", "~> 1.5"
7
+ gem "trilogy", "~> 2.9"
8
+ gem "rake", "~> 13.0"
9
+ gem "appraisal"
10
+ gem "activerecord", "~> 7.1.0"
11
+ gem "activesupport", "~> 7.1.0"
12
+
13
+ group :test do
14
+ gem "rspec", "~> 3.0"
15
+ gem "rubocop", "~> 1.72"
16
+ gem "rubocop-rspec", "~> 3.5.0"
17
+ gem "simplecov"
18
+ gem "simplecov-cobertura"
19
+ end
20
+
21
+ gemspec path: "../"
@@ -0,0 +1,131 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ active_record_proxy_adapters (0.3.1)
5
+ activerecord (>= 7.0.0, < 8.1)
6
+ activesupport (>= 7.0.0, < 8.1)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ activemodel (7.1.5.1)
12
+ activesupport (= 7.1.5.1)
13
+ activerecord (7.1.5.1)
14
+ activemodel (= 7.1.5.1)
15
+ activesupport (= 7.1.5.1)
16
+ timeout (>= 0.4.0)
17
+ activesupport (7.1.5.1)
18
+ base64
19
+ benchmark (>= 0.3)
20
+ bigdecimal
21
+ concurrent-ruby (~> 1.0, >= 1.0.2)
22
+ connection_pool (>= 2.2.5)
23
+ drb
24
+ i18n (>= 1.6, < 2)
25
+ logger (>= 1.4.2)
26
+ minitest (>= 5.1)
27
+ mutex_m
28
+ securerandom (>= 0.3)
29
+ tzinfo (~> 2.0)
30
+ appraisal (2.5.0)
31
+ bundler
32
+ rake
33
+ thor (>= 0.14.0)
34
+ ast (2.4.2)
35
+ base64 (0.2.0)
36
+ benchmark (0.4.0)
37
+ bigdecimal (3.1.9)
38
+ concurrent-ruby (1.3.5)
39
+ connection_pool (2.5.0)
40
+ diff-lcs (1.6.0)
41
+ docile (1.4.1)
42
+ drb (2.2.1)
43
+ i18n (1.14.7)
44
+ concurrent-ruby (~> 1.0)
45
+ json (2.10.1)
46
+ language_server-protocol (3.17.0.4)
47
+ lint_roller (1.1.0)
48
+ logger (1.6.6)
49
+ minitest (5.25.4)
50
+ mutex_m (0.3.0)
51
+ mysql2 (0.5.6)
52
+ parallel (1.26.3)
53
+ parser (3.3.7.1)
54
+ ast (~> 2.4.1)
55
+ racc
56
+ pg (1.5.9)
57
+ racc (1.8.1)
58
+ rainbow (3.1.1)
59
+ rake (13.2.1)
60
+ regexp_parser (2.10.0)
61
+ rexml (3.4.0)
62
+ rspec (3.13.0)
63
+ rspec-core (~> 3.13.0)
64
+ rspec-expectations (~> 3.13.0)
65
+ rspec-mocks (~> 3.13.0)
66
+ rspec-core (3.13.3)
67
+ rspec-support (~> 3.13.0)
68
+ rspec-expectations (3.13.3)
69
+ diff-lcs (>= 1.2.0, < 2.0)
70
+ rspec-support (~> 3.13.0)
71
+ rspec-mocks (3.13.2)
72
+ diff-lcs (>= 1.2.0, < 2.0)
73
+ rspec-support (~> 3.13.0)
74
+ rspec-support (3.13.2)
75
+ rubocop (1.72.2)
76
+ json (~> 2.3)
77
+ language_server-protocol (~> 3.17.0.2)
78
+ lint_roller (~> 1.1.0)
79
+ parallel (~> 1.10)
80
+ parser (>= 3.3.0.2)
81
+ rainbow (>= 2.2.2, < 4.0)
82
+ regexp_parser (>= 2.9.3, < 3.0)
83
+ rubocop-ast (>= 1.38.0, < 2.0)
84
+ ruby-progressbar (~> 1.7)
85
+ unicode-display_width (>= 2.4.0, < 4.0)
86
+ rubocop-ast (1.38.0)
87
+ parser (>= 3.3.1.0)
88
+ rubocop-rspec (3.5.0)
89
+ lint_roller (~> 1.1)
90
+ rubocop (~> 1.72, >= 1.72.1)
91
+ ruby-progressbar (1.13.0)
92
+ securerandom (0.4.1)
93
+ simplecov (0.22.0)
94
+ docile (~> 1.1)
95
+ simplecov-html (~> 0.11)
96
+ simplecov_json_formatter (~> 0.1)
97
+ simplecov-cobertura (2.1.0)
98
+ rexml
99
+ simplecov (~> 0.19)
100
+ simplecov-html (0.13.1)
101
+ simplecov_json_formatter (0.1.4)
102
+ thor (1.3.2)
103
+ timeout (0.4.3)
104
+ trilogy (2.9.0)
105
+ tzinfo (2.0.6)
106
+ concurrent-ruby (~> 1.0)
107
+ unicode-display_width (3.1.4)
108
+ unicode-emoji (~> 4.0, >= 4.0.4)
109
+ unicode-emoji (4.0.4)
110
+
111
+ PLATFORMS
112
+ aarch64-linux-musl
113
+ ruby
114
+
115
+ DEPENDENCIES
116
+ active_record_proxy_adapters!
117
+ activerecord (~> 7.1.0)
118
+ activesupport (~> 7.1.0)
119
+ appraisal
120
+ mysql2 (~> 0.5)
121
+ pg (~> 1.5)
122
+ rake (~> 13.0)
123
+ rspec (~> 3.0)
124
+ rubocop (~> 1.72)
125
+ rubocop-rspec (~> 3.5.0)
126
+ simplecov
127
+ simplecov-cobertura
128
+ trilogy (~> 2.9)
129
+
130
+ BUNDLED WITH
131
+ 2.5.13
@@ -0,0 +1,21 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "mysql2", "~> 0.5"
6
+ gem "pg", "~> 1.5"
7
+ gem "trilogy", "~> 2.9"
8
+ gem "rake", "~> 13.0"
9
+ gem "appraisal"
10
+ gem "activerecord", "~> 7.2.0"
11
+ gem "activesupport", "~> 7.2.0"
12
+
13
+ group :test do
14
+ gem "rspec", "~> 3.0"
15
+ gem "rubocop", "~> 1.72"
16
+ gem "rubocop-rspec", "~> 3.5.0"
17
+ gem "simplecov"
18
+ gem "simplecov-cobertura"
19
+ end
20
+
21
+ gemspec path: "../"
@@ -0,0 +1,129 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ active_record_proxy_adapters (0.3.1)
5
+ activerecord (>= 7.0.0, < 8.1)
6
+ activesupport (>= 7.0.0, < 8.1)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ activemodel (7.2.2.1)
12
+ activesupport (= 7.2.2.1)
13
+ activerecord (7.2.2.1)
14
+ activemodel (= 7.2.2.1)
15
+ activesupport (= 7.2.2.1)
16
+ timeout (>= 0.4.0)
17
+ activesupport (7.2.2.1)
18
+ base64
19
+ benchmark (>= 0.3)
20
+ bigdecimal
21
+ concurrent-ruby (~> 1.0, >= 1.3.1)
22
+ connection_pool (>= 2.2.5)
23
+ drb
24
+ i18n (>= 1.6, < 2)
25
+ logger (>= 1.4.2)
26
+ minitest (>= 5.1)
27
+ securerandom (>= 0.3)
28
+ tzinfo (~> 2.0, >= 2.0.5)
29
+ appraisal (2.5.0)
30
+ bundler
31
+ rake
32
+ thor (>= 0.14.0)
33
+ ast (2.4.2)
34
+ base64 (0.2.0)
35
+ benchmark (0.4.0)
36
+ bigdecimal (3.1.9)
37
+ concurrent-ruby (1.3.5)
38
+ connection_pool (2.5.0)
39
+ diff-lcs (1.6.0)
40
+ docile (1.4.1)
41
+ drb (2.2.1)
42
+ i18n (1.14.7)
43
+ concurrent-ruby (~> 1.0)
44
+ json (2.10.1)
45
+ language_server-protocol (3.17.0.4)
46
+ lint_roller (1.1.0)
47
+ logger (1.6.6)
48
+ minitest (5.25.4)
49
+ mysql2 (0.5.6)
50
+ parallel (1.26.3)
51
+ parser (3.3.7.1)
52
+ ast (~> 2.4.1)
53
+ racc
54
+ pg (1.5.9)
55
+ racc (1.8.1)
56
+ rainbow (3.1.1)
57
+ rake (13.2.1)
58
+ regexp_parser (2.10.0)
59
+ rexml (3.4.0)
60
+ rspec (3.13.0)
61
+ rspec-core (~> 3.13.0)
62
+ rspec-expectations (~> 3.13.0)
63
+ rspec-mocks (~> 3.13.0)
64
+ rspec-core (3.13.3)
65
+ rspec-support (~> 3.13.0)
66
+ rspec-expectations (3.13.3)
67
+ diff-lcs (>= 1.2.0, < 2.0)
68
+ rspec-support (~> 3.13.0)
69
+ rspec-mocks (3.13.2)
70
+ diff-lcs (>= 1.2.0, < 2.0)
71
+ rspec-support (~> 3.13.0)
72
+ rspec-support (3.13.2)
73
+ rubocop (1.72.2)
74
+ json (~> 2.3)
75
+ language_server-protocol (~> 3.17.0.2)
76
+ lint_roller (~> 1.1.0)
77
+ parallel (~> 1.10)
78
+ parser (>= 3.3.0.2)
79
+ rainbow (>= 2.2.2, < 4.0)
80
+ regexp_parser (>= 2.9.3, < 3.0)
81
+ rubocop-ast (>= 1.38.0, < 2.0)
82
+ ruby-progressbar (~> 1.7)
83
+ unicode-display_width (>= 2.4.0, < 4.0)
84
+ rubocop-ast (1.38.0)
85
+ parser (>= 3.3.1.0)
86
+ rubocop-rspec (3.5.0)
87
+ lint_roller (~> 1.1)
88
+ rubocop (~> 1.72, >= 1.72.1)
89
+ ruby-progressbar (1.13.0)
90
+ securerandom (0.4.1)
91
+ simplecov (0.22.0)
92
+ docile (~> 1.1)
93
+ simplecov-html (~> 0.11)
94
+ simplecov_json_formatter (~> 0.1)
95
+ simplecov-cobertura (2.1.0)
96
+ rexml
97
+ simplecov (~> 0.19)
98
+ simplecov-html (0.13.1)
99
+ simplecov_json_formatter (0.1.4)
100
+ thor (1.3.2)
101
+ timeout (0.4.3)
102
+ trilogy (2.9.0)
103
+ tzinfo (2.0.6)
104
+ concurrent-ruby (~> 1.0)
105
+ unicode-display_width (3.1.4)
106
+ unicode-emoji (~> 4.0, >= 4.0.4)
107
+ unicode-emoji (4.0.4)
108
+
109
+ PLATFORMS
110
+ aarch64-linux-musl
111
+ ruby
112
+
113
+ DEPENDENCIES
114
+ active_record_proxy_adapters!
115
+ activerecord (~> 7.2.0)
116
+ activesupport (~> 7.2.0)
117
+ appraisal
118
+ mysql2 (~> 0.5)
119
+ pg (~> 1.5)
120
+ rake (~> 13.0)
121
+ rspec (~> 3.0)
122
+ rubocop (~> 1.72)
123
+ rubocop-rspec (~> 3.5.0)
124
+ simplecov
125
+ simplecov-cobertura
126
+ trilogy (~> 2.9)
127
+
128
+ BUNDLED WITH
129
+ 2.5.13
@@ -0,0 +1,21 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "mysql2", "~> 0.5"
6
+ gem "pg", "~> 1.5"
7
+ gem "trilogy", "~> 2.9"
8
+ gem "rake", "~> 13.0"
9
+ gem "appraisal"
10
+ gem "activerecord", "~> 8.0.0"
11
+ gem "activesupport", "~> 8.0.0"
12
+
13
+ group :test do
14
+ gem "rspec", "~> 3.0"
15
+ gem "rubocop", "~> 1.72"
16
+ gem "rubocop-rspec", "~> 3.5.0"
17
+ gem "simplecov"
18
+ gem "simplecov-cobertura"
19
+ end
20
+
21
+ gemspec path: "../"
@@ -0,0 +1,131 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ active_record_proxy_adapters (0.3.1)
5
+ activerecord (>= 7.0.0, < 8.1)
6
+ activesupport (>= 7.0.0, < 8.1)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ activemodel (8.0.1)
12
+ activesupport (= 8.0.1)
13
+ activerecord (8.0.1)
14
+ activemodel (= 8.0.1)
15
+ activesupport (= 8.0.1)
16
+ timeout (>= 0.4.0)
17
+ activesupport (8.0.1)
18
+ base64
19
+ benchmark (>= 0.3)
20
+ bigdecimal
21
+ concurrent-ruby (~> 1.0, >= 1.3.1)
22
+ connection_pool (>= 2.2.5)
23
+ drb
24
+ i18n (>= 1.6, < 2)
25
+ logger (>= 1.4.2)
26
+ minitest (>= 5.1)
27
+ securerandom (>= 0.3)
28
+ tzinfo (~> 2.0, >= 2.0.5)
29
+ uri (>= 0.13.1)
30
+ appraisal (2.5.0)
31
+ bundler
32
+ rake
33
+ thor (>= 0.14.0)
34
+ ast (2.4.2)
35
+ base64 (0.2.0)
36
+ benchmark (0.4.0)
37
+ bigdecimal (3.1.9)
38
+ concurrent-ruby (1.3.5)
39
+ connection_pool (2.5.0)
40
+ diff-lcs (1.6.0)
41
+ docile (1.4.1)
42
+ drb (2.2.1)
43
+ i18n (1.14.7)
44
+ concurrent-ruby (~> 1.0)
45
+ json (2.10.1)
46
+ language_server-protocol (3.17.0.4)
47
+ lint_roller (1.1.0)
48
+ logger (1.6.6)
49
+ minitest (5.25.4)
50
+ mysql2 (0.5.6)
51
+ parallel (1.26.3)
52
+ parser (3.3.7.1)
53
+ ast (~> 2.4.1)
54
+ racc
55
+ pg (1.5.9)
56
+ racc (1.8.1)
57
+ rainbow (3.1.1)
58
+ rake (13.2.1)
59
+ regexp_parser (2.10.0)
60
+ rexml (3.4.0)
61
+ rspec (3.13.0)
62
+ rspec-core (~> 3.13.0)
63
+ rspec-expectations (~> 3.13.0)
64
+ rspec-mocks (~> 3.13.0)
65
+ rspec-core (3.13.3)
66
+ rspec-support (~> 3.13.0)
67
+ rspec-expectations (3.13.3)
68
+ diff-lcs (>= 1.2.0, < 2.0)
69
+ rspec-support (~> 3.13.0)
70
+ rspec-mocks (3.13.2)
71
+ diff-lcs (>= 1.2.0, < 2.0)
72
+ rspec-support (~> 3.13.0)
73
+ rspec-support (3.13.2)
74
+ rubocop (1.72.2)
75
+ json (~> 2.3)
76
+ language_server-protocol (~> 3.17.0.2)
77
+ lint_roller (~> 1.1.0)
78
+ parallel (~> 1.10)
79
+ parser (>= 3.3.0.2)
80
+ rainbow (>= 2.2.2, < 4.0)
81
+ regexp_parser (>= 2.9.3, < 3.0)
82
+ rubocop-ast (>= 1.38.0, < 2.0)
83
+ ruby-progressbar (~> 1.7)
84
+ unicode-display_width (>= 2.4.0, < 4.0)
85
+ rubocop-ast (1.38.0)
86
+ parser (>= 3.3.1.0)
87
+ rubocop-rspec (3.5.0)
88
+ lint_roller (~> 1.1)
89
+ rubocop (~> 1.72, >= 1.72.1)
90
+ ruby-progressbar (1.13.0)
91
+ securerandom (0.4.1)
92
+ simplecov (0.22.0)
93
+ docile (~> 1.1)
94
+ simplecov-html (~> 0.11)
95
+ simplecov_json_formatter (~> 0.1)
96
+ simplecov-cobertura (2.1.0)
97
+ rexml
98
+ simplecov (~> 0.19)
99
+ simplecov-html (0.13.1)
100
+ simplecov_json_formatter (0.1.4)
101
+ thor (1.3.2)
102
+ timeout (0.4.3)
103
+ trilogy (2.9.0)
104
+ tzinfo (2.0.6)
105
+ concurrent-ruby (~> 1.0)
106
+ unicode-display_width (3.1.4)
107
+ unicode-emoji (~> 4.0, >= 4.0.4)
108
+ unicode-emoji (4.0.4)
109
+ uri (1.0.2)
110
+
111
+ PLATFORMS
112
+ aarch64-linux-musl
113
+ ruby
114
+
115
+ DEPENDENCIES
116
+ active_record_proxy_adapters!
117
+ activerecord (~> 8.0.0)
118
+ activesupport (~> 8.0.0)
119
+ appraisal
120
+ mysql2 (~> 0.5)
121
+ pg (~> 1.5)
122
+ rake (~> 13.0)
123
+ rspec (~> 3.0)
124
+ rubocop (~> 1.72)
125
+ rubocop-rspec (~> 3.5.0)
126
+ simplecov
127
+ simplecov-cobertura
128
+ trilogy (~> 2.9)
129
+
130
+ BUNDLED WITH
131
+ 2.5.13
@@ -37,3 +37,5 @@ if ActiveRecordProxyAdapters::ActiveRecordContext.active_record_v7_2_or_greater?
37
37
  "active_record/connection_adapters/mysql2_proxy_adapter"
38
38
  )
39
39
  end
40
+
41
+ ActiveSupport.run_load_hooks(:active_record_mysql2proxyadapter, ActiveRecord::ConnectionAdapters::Mysql2ProxyAdapter)
@@ -41,3 +41,6 @@ if ActiveRecordProxyAdapters::ActiveRecordContext.active_record_v7_2_or_greater?
41
41
  "active_record/connection_adapters/postgresql_proxy_adapter"
42
42
  )
43
43
  end
44
+
45
+ ActiveSupport.run_load_hooks(:active_record_postgresqlproxyadapter,
46
+ ActiveRecord::ConnectionAdapters::PostgreSQLProxyAdapter)
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "active_record/tasks/trilogy_proxy_database_tasks"
4
+ require "active_record/connection_adapters/trilogy_adapter"
5
+ require "active_record_proxy_adapters/active_record_context"
6
+ require "active_record_proxy_adapters/hijackable"
7
+ require "active_record_proxy_adapters/trilogy_proxy"
8
+
9
+ module ActiveRecord
10
+ module ConnectionAdapters
11
+ # This adapter is a proxy to the original TrilogyAdapter, allowing the use of the
12
+ # ActiveRecordProxyAdapters::PrimaryReplicaProxy.
13
+ class TrilogyProxyAdapter < TrilogyAdapter
14
+ include ActiveRecordProxyAdapters::Hijackable
15
+
16
+ ADAPTER_NAME = "TrilogyProxy"
17
+
18
+ delegate_to_proxy :execute, :exec_query
19
+
20
+ def initialize(...)
21
+ @proxy = ActiveRecordProxyAdapters::TrilogyProxy.new(self)
22
+
23
+ super
24
+ end
25
+
26
+ private
27
+
28
+ attr_reader :proxy
29
+ end
30
+ end
31
+ end
32
+
33
+ if ActiveRecordProxyAdapters::ActiveRecordContext.active_record_v7_2_or_greater?
34
+ ActiveRecord::ConnectionAdapters.register(
35
+ "trilogy_proxy",
36
+ "ActiveRecord::ConnectionAdapters::TrilogyProxyAdapter",
37
+ "active_record/connection_adapters/trilogy_proxy_adapter"
38
+ )
39
+ end
40
+
41
+ ActiveSupport.run_load_hooks(:active_record_trilogyproxyadapter, ActiveRecord::ConnectionAdapters::TrilogyProxyAdapter)
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "active_record_proxy_adapters/database_tasks"
4
+
5
+ module ActiveRecord
6
+ module Tasks
7
+ # Defines the trilogy tasks for dropping, creating, loading schema and dumping schema.
8
+ # Bypasses all the proxy logic to send all requests to primary.
9
+ class TrilogyProxyDatabaseTasks < MySQLDatabaseTasks
10
+ include ActiveRecordProxyAdapters::DatabaseTasks
11
+ end
12
+ end
13
+ end
14
+
15
+ # Allow proxy adapter to run rake tasks, i.e. db:drop, db:create, db:schema:load db:migrate, etc...
16
+ ActiveRecord::Tasks::DatabaseTasks.register_task(
17
+ /trilogy_proxy/,
18
+ "ActiveRecord::Tasks::TrilogyProxyDatabaseTasks"
19
+ )
@@ -8,32 +8,38 @@ rescue LoadError
8
8
  end
9
9
 
10
10
  module ActiveRecordProxyAdapters
11
- # Module to extend ActiveRecord::Base with the connection handling methods.
12
- # Required to make adapter work in ActiveRecord versions <= 7.2.x
13
- module ConnectionHandling
14
- def mysql2_proxy_adapter_class
15
- ::ActiveRecord::ConnectionAdapters::Mysql2ProxyAdapter
16
- end
11
+ module Mysql2
12
+ # Module to extend ActiveRecord::Base with the connection handling methods.
13
+ # Required to make adapter work in ActiveRecord versions <= 7.2.x
14
+ module ConnectionHandling
15
+ def mysql2_proxy_adapter_class
16
+ ::ActiveRecord::ConnectionAdapters::Mysql2ProxyAdapter
17
+ end
17
18
 
18
- # This method is a copy and paste from Rails' mysql2_connection,
19
- # replacing Mysql2Adapter by Mysql2ProxyAdapter
20
- # This is required by ActiveRecord versions <= 7.2.x to establish a connection using the adapter.
21
- def mysql2_proxy_connection(config) # rubocop:disable Metrics/MethodLength
22
- config = config.symbolize_keys
23
- config[:flags] ||= 0
19
+ # This method is a copy and paste from Rails' mysql2_connection,
20
+ # replacing Mysql2Adapter by Mysql2ProxyAdapter
21
+ # This is required by ActiveRecord versions <= 7.2.x to establish a connection using the adapter.
22
+ def mysql2_proxy_connection(config) # rubocop:disable Metrics/MethodLength
23
+ config = config.symbolize_keys
24
+ config[:flags] ||= 0
24
25
 
25
- if config[:flags].is_a? Array
26
- config[:flags].push "FOUND_ROWS"
27
- else
28
- config[:flags] |= Mysql2::Client::FOUND_ROWS
29
- end
26
+ if config[:flags].is_a? Array
27
+ config[:flags].push "FOUND_ROWS"
28
+ else
29
+ config[:flags] |= ::Mysql2::Client::FOUND_ROWS
30
+ end
30
31
 
31
- mysql2_proxy_adapter_class.new(
32
- mysql2_proxy_adapter_class.new_client(config),
33
- logger,
34
- nil,
35
- config
36
- )
32
+ mysql2_proxy_adapter_class.new(
33
+ mysql2_proxy_adapter_class.new_client(config),
34
+ logger,
35
+ nil,
36
+ config
37
+ )
38
+ end
37
39
  end
38
40
  end
39
41
  end
42
+
43
+ ActiveSupport.on_load(:active_record) do
44
+ ActiveRecord::Base.extend(ActiveRecordProxyAdapters::Mysql2::ConnectionHandling)
45
+ end
@@ -10,31 +10,37 @@ end
10
10
  module ActiveRecordProxyAdapters
11
11
  # Module to extend ActiveRecord::Base with the connection handling methods.
12
12
  # Required to make adapter work in ActiveRecord versions <= 7.2.x
13
- module ConnectionHandling
14
- def postgresql_proxy_adapter_class
15
- ::ActiveRecord::ConnectionAdapters::PostgreSQLProxyAdapter
16
- end
13
+ module PostgreSQL
14
+ module ConnectionHandling # rubocop:disable Style/Documentation
15
+ def postgresql_proxy_adapter_class
16
+ ::ActiveRecord::ConnectionAdapters::PostgreSQLProxyAdapter
17
+ end
17
18
 
18
- # This method is a copy and paste from Rails' postgresql_connection,
19
- # replacing PostgreSQLAdapter by PostgreSQLProxyAdapter
20
- # This is required by ActiveRecord versions <= 7.2.x to establish a connection using the adapter.
21
- def postgresql_proxy_connection(config) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
22
- conn_params = config.symbolize_keys.compact
19
+ # This method is a copy and paste from Rails' postgresql_connection,
20
+ # replacing PostgreSQLAdapter by PostgreSQLProxyAdapter
21
+ # This is required by ActiveRecord versions <= 7.2.x to establish a connection using the adapter.
22
+ def postgresql_proxy_connection(config) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
23
+ conn_params = config.symbolize_keys.compact
23
24
 
24
- # Map ActiveRecords param names to PGs.
25
- conn_params[:user] = conn_params.delete(:username) if conn_params[:username]
26
- conn_params[:dbname] = conn_params.delete(:database) if conn_params[:database]
25
+ # Map ActiveRecords param names to PGs.
26
+ conn_params[:user] = conn_params.delete(:username) if conn_params[:username]
27
+ conn_params[:dbname] = conn_params.delete(:database) if conn_params[:database]
27
28
 
28
- # Forward only valid config params to PG::Connection.connect.
29
- valid_conn_param_keys = PG::Connection.conndefaults_hash.keys + [:requiressl]
30
- conn_params.slice!(*valid_conn_param_keys)
29
+ # Forward only valid config params to PG::Connection.connect.
30
+ valid_conn_param_keys = PG::Connection.conndefaults_hash.keys + [:requiressl]
31
+ conn_params.slice!(*valid_conn_param_keys)
31
32
 
32
- postgresql_proxy_adapter_class.new(
33
- postgresql_proxy_adapter_class.new_client(conn_params),
34
- logger,
35
- conn_params,
36
- config
37
- )
33
+ postgresql_proxy_adapter_class.new(
34
+ postgresql_proxy_adapter_class.new_client(conn_params),
35
+ logger,
36
+ conn_params,
37
+ config
38
+ )
39
+ end
38
40
  end
39
41
  end
40
42
  end
43
+
44
+ ActiveSupport.on_load(:active_record) do
45
+ ActiveRecord::Base.extend(ActiveRecordProxyAdapters::PostgreSQL::ConnectionHandling)
46
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ begin
4
+ require "active_record/connection_adapters/trilogy_proxy_adapter"
5
+ rescue LoadError
6
+ # trilogy not available
7
+ return
8
+ end
9
+
10
+ module ActiveRecordProxyAdapters
11
+ module Trilogy
12
+ # Module to extend ActiveRecord::Base with the connection handling methods.
13
+ # Required to make adapter work in ActiveRecord versions <= 7.2.x
14
+ module ConnectionHandling
15
+ def trilogy_proxy_adapter_class
16
+ ActiveRecord::ConnectionAdapters::TrilogyProxyAdapter
17
+ end
18
+
19
+ def trilogy_proxy_connection(config) # rubocop:disable Metrics/MethodLength
20
+ configuration = config.dup
21
+
22
+ # Set FOUND_ROWS capability on the connection so UPDATE queries returns number of rows
23
+ # matched rather than number of rows updated.
24
+ configuration[:found_rows] = true
25
+
26
+ options = [
27
+ configuration[:host],
28
+ configuration[:port],
29
+ configuration[:database],
30
+ configuration[:username],
31
+ configuration[:password],
32
+ configuration[:socket],
33
+ 0
34
+ ]
35
+
36
+ trilogy_proxy_adapter_class.new nil, logger, options, configuration
37
+ end
38
+ end
39
+ end
40
+ end
41
+
42
+ ActiveSupport.on_load(:active_record) do
43
+ ActiveRecord::Base.extend(ActiveRecordProxyAdapters::Trilogy::ConnectionHandling)
44
+ end
@@ -2,10 +2,4 @@
2
2
 
3
3
  require "active_record_proxy_adapters/connection_handling/postgresql"
4
4
  require "active_record_proxy_adapters/connection_handling/mysql2"
5
-
6
- module ActiveRecordProxyAdapters
7
- # Module to extend ActiveRecord::Base with the connection handling methods.
8
- # Required to make adapter work in ActiveRecord versions <= 7.2.x
9
- module ConnectionHandling
10
- end
11
- end
5
+ require "active_record_proxy_adapters/connection_handling/trilogy"
@@ -5,10 +5,7 @@ require "active_support"
5
5
  module ActiveRecordProxyAdapters
6
6
  # Hooks into rails boot process to extend ActiveRecord with the proxy adapter.
7
7
  class Railtie < Rails::Railtie
8
- ActiveSupport.on_load :active_record do
9
- require "active_record_proxy_adapters/connection_handling"
10
- ActiveRecord::Base.extend(ActiveRecordProxyAdapters::ConnectionHandling)
11
- end
8
+ require "active_record_proxy_adapters/connection_handling"
12
9
 
13
10
  config.to_prepare do
14
11
  Rails.autoloaders.each do |autoloader|
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "active_record_proxy_adapters/mysql2_proxy"
4
+
5
+ module ActiveRecordProxyAdapters
6
+ # Proxy to the Mysql2Proxy, allowing the use of the ActiveRecordProxyAdapters::PrimaryReplicaProxy.
7
+ class TrilogyProxy < Mysql2Proxy
8
+ end
9
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveRecordProxyAdapters
4
- VERSION = "0.3.1"
4
+ VERSION = "0.4.0"
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_record_proxy_adapters
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Cruz
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-02-12 00:00:00.000000000 Z
10
+ date: 2025-02-25 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: activerecord
@@ -61,6 +61,7 @@ extra_rdoc_files: []
61
61
  files:
62
62
  - ".rspec"
63
63
  - ".rubocop.yml"
64
+ - Appraisals
64
65
  - CHANGELOG.md
65
66
  - CODE_OF_CONDUCT.md
66
67
  - Dockerfile
@@ -70,16 +71,27 @@ files:
70
71
  - db/postgresql_structure.sql
71
72
  - docker-compose.yml
72
73
  - docker/postgres_replica/cmd.sh
74
+ - gemfiles/rails_7.0.gemfile
75
+ - gemfiles/rails_7.0.gemfile.lock
76
+ - gemfiles/rails_7.1.gemfile
77
+ - gemfiles/rails_7.1.gemfile.lock
78
+ - gemfiles/rails_7.2.gemfile
79
+ - gemfiles/rails_7.2.gemfile.lock
80
+ - gemfiles/rails_8.0.gemfile
81
+ - gemfiles/rails_8.0.gemfile.lock
73
82
  - lib/active_record/connection_adapters/mysql2_proxy_adapter.rb
74
83
  - lib/active_record/connection_adapters/postgresql_proxy_adapter.rb
84
+ - lib/active_record/connection_adapters/trilogy_proxy_adapter.rb
75
85
  - lib/active_record/tasks/mysql2_proxy_database_tasks.rb
76
86
  - lib/active_record/tasks/postgresql_proxy_database_tasks.rb
87
+ - lib/active_record/tasks/trilogy_proxy_database_tasks.rb
77
88
  - lib/active_record_proxy_adapters.rb
78
89
  - lib/active_record_proxy_adapters/active_record_context.rb
79
90
  - lib/active_record_proxy_adapters/configuration.rb
80
91
  - lib/active_record_proxy_adapters/connection_handling.rb
81
92
  - lib/active_record_proxy_adapters/connection_handling/mysql2.rb
82
93
  - lib/active_record_proxy_adapters/connection_handling/postgresql.rb
94
+ - lib/active_record_proxy_adapters/connection_handling/trilogy.rb
83
95
  - lib/active_record_proxy_adapters/database_tasks.rb
84
96
  - lib/active_record_proxy_adapters/hijackable.rb
85
97
  - lib/active_record_proxy_adapters/log_subscriber.rb
@@ -87,6 +99,7 @@ files:
87
99
  - lib/active_record_proxy_adapters/postgresql_proxy.rb
88
100
  - lib/active_record_proxy_adapters/primary_replica_proxy.rb
89
101
  - lib/active_record_proxy_adapters/railtie.rb
102
+ - lib/active_record_proxy_adapters/trilogy_proxy.rb
90
103
  - lib/active_record_proxy_adapters/version.rb
91
104
  - postgres_primary.dockerfile
92
105
  - postgres_replica.dockerfile