active_record_proxy_adapters 0.1.1 → 0.1.2

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: 265cb32e99a265497548122846934c46405747109fa3bee34d1e2e66203b14a3
4
- data.tar.gz: d9de3faf7274a0a94166637032c0a967e083edf55fc275b2456123d3f9a7ee79
3
+ metadata.gz: 2b23e66bd5df6d979b9efad29a52139552950f29774935cc91fffdbc87805a4c
4
+ data.tar.gz: 5b3206ee7420635f2f76432a1bbe728e161a9ea434db42da22ac5290ae561e3d
5
5
  SHA512:
6
- metadata.gz: 871504b4290e8304effa5e30962a8db9fdab6663c73b4f9d9e99edf403af630755ddaaafa557619a86430812b7e54e19931274ec71dd4f86a7b4dc32b73fc669
7
- data.tar.gz: f7605b374452517ae3346d896d043e092539abd0a86445eb1a04defbd7516628a70bcd5157fca10c730b7ee6fe047733d1e8e4d65a016c49651cbb12f7e8dcee
6
+ metadata.gz: cb98f62ce8a62ef0d71364491d1686186c527adc0c6a8612fd5ee118710fe9360166f14ae06b348856548c8b507ef90edf413113e93a9afa56c82e84c267df1e
7
+ data.tar.gz: 75f30a3ce9473415be91a51acc9fc39a5aacc31b6623943a007b3fb0c41e330752c6f6b470ee759d141b6c84feb96d3b24a015939bb0b053d82ac50a22adb447
data/CHANGELOG.md CHANGED
@@ -1,9 +1,17 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.2] - 2024-12-16
4
+
5
+ Fix CTE regex matcher (4b1d10b)
6
+
7
+ ## [0.1.1] - 2024-11-27
8
+
9
+ - Enable RubyGems MFA (2a71b1f)
10
+
1
11
  ## [0.1.0] - 2024-11-19
2
12
 
3
- - Add PostgreSQLProxyAdapter
13
+ - Add PostgreSQLProxyAdapter (2b3bb9f)
4
14
 
5
15
  ## [0.1.0.rc2] - 2024-10-28
6
16
 
7
- - Add PostgreSQLProxyAdapter
8
-
9
- ## [Unreleased]
17
+ - Add PostgreSQLProxyAdapter (2b3bb9f)
data/Rakefile CHANGED
@@ -10,3 +10,16 @@ require "rubocop/rake_task"
10
10
  RuboCop::RakeTask.new
11
11
 
12
12
  task default: %i[spec rubocop]
13
+
14
+ namespace :coverage do
15
+ desc "Collates all result sets generated by the different test runners"
16
+ task :report do
17
+ require "simplecov"
18
+
19
+ SimpleCov.collate Dir["coverage/**/.resultset.json"] do
20
+ add_group "PostgreSQL" do |src_file|
21
+ [/postgresql/, /postgre_sql/].any? { |pattern| pattern.match?(src_file.filename) }
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,9 @@
1
+ until pg_basebackup --pgdata=/var/lib/postgresql/data -R --slot=$PRIMARY_REPLICATION_SLOT --host=$PRIMARY_DATABASE_HOST --port=$PRIMARY_DATABASE_PORT
2
+ do
3
+ echo 'Waiting for primary to connect...'
4
+ sleep 1s
5
+ done
6
+
7
+ echo 'Backup done, starting replica...'
8
+ chmod 0700 /var/lib/postgresql/data
9
+ postgres
data/docker-compose.yml CHANGED
@@ -15,8 +15,8 @@ services:
15
15
  app:
16
16
  build:
17
17
  args:
18
- - RUBY_VERSION=${RUBY_VERSION:-3.2.3}
19
- - RAILS_VERSION=${RAILS_VERSION:-~> 6.1.0}
18
+ - RUBY_VERSION=${RUBY_VERSION:-3.3.6}
19
+ - RAILS_VERSION=${RAILS_VERSION:-8.0.0}
20
20
  container_name: app
21
21
  image: active_record_proxy_adapters-app:${ENV_TAG:-latest}
22
22
  tty: true
@@ -16,7 +16,7 @@ module ActiveRecordProxyAdapters
16
16
  /\A\s*select.+(nextval|currval|lastval|get_lock|release_lock|pg_advisory_lock|pg_advisory_unlock)\(/i
17
17
  ].map(&:freeze).freeze
18
18
  # All queries that match these patterns should be sent to the replica database
19
- SQL_REPLICA_MATCHERS = [/\A\s*(select|with.+\)\s*select)\s/i].map(&:freeze).freeze
19
+ SQL_REPLICA_MATCHERS = [/\A\s*(select|with\s[\s\S]*\)\s*select)\s/i].map(&:freeze).freeze
20
20
  # All queries that match these patterns should be sent to all databases
21
21
  SQL_ALL_MATCHERS = [/\A\s*set\s/i].map(&:freeze).freeze
22
22
  # Local sets queries should not be sent to all datbases
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveRecordProxyAdapters
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
@@ -4,20 +4,12 @@ ENV PRIMARY_DATABASE_HOST=localhost
4
4
  ENV PRIMARY_DATABASE_PORT=5432
5
5
  ENV PRIMARY_REPLICATION_SLOT=replication_slot
6
6
 
7
- USER root
8
- RUN printf '' > cmd.sh
9
7
 
10
- RUN echo 'until pg_basebackup --pgdata=/var/lib/postgresql/data -R --slot=$PRIMARY_REPLICATION_SLOT --host=$PRIMARY_DATABASE_HOST --port=$PRIMARY_DATABASE_PORT' >> cmd.sh
11
- RUN echo 'do' >> cmd.sh
12
- RUN echo "echo 'Waiting for primary to connect...'" >> cmd.sh
13
- RUN echo 'sleep 1s' >> cmd.sh
14
- RUN echo 'done' >> cmd.sh
15
- RUN echo "echo 'Backup done, starting replica...'" >> cmd.sh
16
- RUN echo 'chmod 0700 /var/lib/postgresql/data' >> cmd.sh
17
- RUN echo 'postgres' >> cmd.sh
8
+ COPY docker/postgres_replica/cmd.sh cmd.sh
18
9
 
10
+ USER root
19
11
  RUN chown -R postgres:postgres cmd.sh
20
12
  USER postgres
21
- RUN chmod u+rwx cmd.sh
13
+ RUN chmod u+x cmd.sh
22
14
 
23
15
  CMD [ "./cmd.sh" ]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_record_proxy_adapters
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Cruz
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-11-28 00:00:00.000000000 Z
11
+ date: 2024-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -69,6 +69,7 @@ files:
69
69
  - README.md
70
70
  - Rakefile
71
71
  - docker-compose.yml
72
+ - docker/postgres_replica/cmd.sh
72
73
  - lib/active_record/connection_adapters/postgresql_proxy_adapter.rb
73
74
  - lib/active_record/tasks/postgresql_proxy_database_tasks.rb
74
75
  - lib/active_record_proxy_adapters.rb