rails-pg-extras 5.2.4 → 5.3.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: 60eba950bfa1aecfc9a72ebf5b749314d0de3f9aca589bf315df40f15060163c
4
- data.tar.gz: e22ad418c8ee4540ff572375014f873c33485f30ed1575cf18818139c0441cdf
3
+ metadata.gz: 6b65d13da46887feb4613989005880cccc3f364409196d3e243e2fa741c778f0
4
+ data.tar.gz: 32af66da2e162cc33886c843cd5a9eccf73927557db042de874d4069aa4245a2
5
5
  SHA512:
6
- metadata.gz: 4a9ed9ed4fffe3b50b14fd80bd390c54b1d02cf880367d7aca0e2928dc195bf265b769efa0cbd8b5d3b6e049f4646846019e7ffb6dc09cc5c109d5797d3fe692
7
- data.tar.gz: 4a41aa5be9cd9848d0f18ee969b10f1d5c487b5becc65f2efc751cb454a761e7eae77048d8dbc3c351c249f199025bfdb6eb549b5837f509bbc9a0b9df66a7a2
6
+ metadata.gz: a38495774e883472f92b4c0782de90c2475247fbdc061f4d8c5e3fd10b034429832ac6de09cb214f8af375c70286e83f94eb15af4487319779b8599628122d7f
7
+ data.tar.gz: a6e32c538a51e26647a4373759015dd635c0659e28ad603a4ee1bb80619a450ab8f78b60d54707c487a147767d7d4811cd09808f7aec8e136ce37277a13284ca
@@ -0,0 +1,128 @@
1
+ name: Ruby CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+ pull_request:
7
+ branches: [ main ]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ fail-fast: false
14
+ matrix:
15
+ ruby-version: ['3.2', '3.1', '3.0', '2.7', '2.6']
16
+ steps:
17
+ - uses: actions/checkout@v3
18
+ - name: Run PostgreSQL 11
19
+ run: |
20
+ docker run --env POSTGRES_USER=postgres \
21
+ --env POSTGRES_DB=rails-pg-extras-test \
22
+ --env POSTGRES_PASSWORD=secret \
23
+ -d -p 5432:5432 postgres:11.18-alpine \
24
+ postgres -c shared_preload_libraries=pg_stat_statements
25
+ - name: Run PostgreSQL 12
26
+ run: |
27
+ docker run --env POSTGRES_USER=postgres \
28
+ --env POSTGRES_DB=rails-pg-extras-test \
29
+ --env POSTGRES_PASSWORD=secret \
30
+ -d -p 5433:5432 postgres:12.13-alpine \
31
+ postgres -c shared_preload_libraries=pg_stat_statements
32
+ - name: Run PostgreSQL 13
33
+ run: |
34
+ docker run --env POSTGRES_USER=postgres \
35
+ --env POSTGRES_DB=rails-pg-extras-test \
36
+ --env POSTGRES_PASSWORD=secret \
37
+ -d -p 5434:5432 postgres:13.9-alpine \
38
+ postgres -c shared_preload_libraries=pg_stat_statements
39
+ - name: Run PostgreSQL 14
40
+ run: |
41
+ docker run --env POSTGRES_USER=postgres \
42
+ --env POSTGRES_DB=rails-pg-extras-test \
43
+ --env POSTGRES_PASSWORD=secret \
44
+ -d -p 5435:5432 postgres:14.6-alpine \
45
+ postgres -c shared_preload_libraries=pg_stat_statements
46
+ - name: Run PostgreSQL 15
47
+ run: |
48
+ docker run --env POSTGRES_USER=postgres \
49
+ --env POSTGRES_DB=rails-pg-extras-test \
50
+ --env POSTGRES_PASSWORD=secret \
51
+ -d -p 5436:5432 postgres:15.1-alpine \
52
+ postgres -c shared_preload_libraries=pg_stat_statements
53
+ sleep 15
54
+ - name: Set up Ruby ${{ matrix.ruby-version }}
55
+ uses: ruby/setup-ruby@v1
56
+ with:
57
+ ruby-version: ${{ matrix.ruby-version }}
58
+ - name: Setup dependencies
59
+ run: |
60
+ gem update --system
61
+ gem install bundler
62
+ sudo apt-get update --allow-releaseinfo-change
63
+ sudo apt install postgresql-client
64
+ sudo apt install libpq-dev
65
+ bundle config set --local path 'vendor/bundle'
66
+ bundle install
67
+ sleep 10
68
+ - name: Run tests for PG 11
69
+ env:
70
+ PG_VERSION: 11
71
+ POSTGRES_HOST: localhost
72
+ POSTGRES_USER: postgres
73
+ POSTGRES_DB: rails-pg-extras-test
74
+ POSTGRES_PASSWORD: secret
75
+ DATABASE_URL: postgresql://postgres:secret@localhost:5432/rails-pg-extras-test
76
+ run: |
77
+ bundle exec rspec spec/
78
+ - name: Run tests for PG 11
79
+ env:
80
+ PG_VERSION: 11
81
+ POSTGRES_HOST: localhost
82
+ POSTGRES_USER: postgres
83
+ POSTGRES_DB: rails-pg-extras-test
84
+ POSTGRES_PASSWORD: secret
85
+ DATABASE_URL: postgresql://postgres:secret@localhost:5432/rails-pg-extras-test
86
+ run: |
87
+ bundle exec rspec spec/
88
+ - name: Run tests for PG 12
89
+ env:
90
+ PG_VERSION: 12
91
+ POSTGRES_HOST: localhost
92
+ POSTGRES_USER: postgres
93
+ POSTGRES_DB: rails-pg-extras-test
94
+ POSTGRES_PASSWORD: secret
95
+ DATABASE_URL: postgresql://postgres:secret@localhost:5433/rails-pg-extras-test
96
+ run: |
97
+ bundle exec rspec spec/
98
+ - name: Run tests for PG 13
99
+ env:
100
+ PG_VERSION: 13
101
+ POSTGRES_HOST: localhost
102
+ POSTGRES_USER: postgres
103
+ POSTGRES_DB: rails-pg-extras-test
104
+ POSTGRES_PASSWORD: secret
105
+ DATABASE_URL: postgresql://postgres:secret@localhost:5434/rails-pg-extras-test
106
+ run: |
107
+ bundle exec rspec spec/
108
+ - name: Run tests for PG 14
109
+ env:
110
+ PG_VERSION: 14
111
+ POSTGRES_HOST: localhost
112
+ POSTGRES_USER: postgres
113
+ POSTGRES_DB: rails-pg-extras-test
114
+ POSTGRES_PASSWORD: secret
115
+ DATABASE_URL: postgresql://postgres:secret@localhost:5435/rails-pg-extras-test
116
+ run: |
117
+ bundle exec rspec spec/
118
+ - name: Run tests for PG 15
119
+ env:
120
+ PG_VERSION: 15
121
+ POSTGRES_HOST: localhost
122
+ POSTGRES_USER: postgres
123
+ POSTGRES_DB: rails-pg-extras-test
124
+ POSTGRES_PASSWORD: secret
125
+ DATABASE_URL: postgresql://postgres:secret@localhost:5436/rails-pg-extras-test
126
+ run: |
127
+ bundle exec rspec spec/
128
+
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Rails PG Extras [![Gem Version](https://badge.fury.io/rb/rails-pg-extras.svg)](https://badge.fury.io/rb/rails-pg-extras) [![CircleCI](https://circleci.com/gh/pawurb/rails-pg-extras.svg?style=svg)](https://circleci.com/gh/pawurb/rails-pg-extras)
1
+ # Rails PG Extras [![Gem Version](https://badge.fury.io/rb/rails-pg-extras.svg)](https://badge.fury.io/rb/rails-pg-extras) [![GH Actions](https://github.com/pawurb/rails-pg-extras/actions/workflows/ci.yml/badge.svg)](https://github.com/pawurb/rails-pg-extras/actions)
2
2
 
3
3
  Rails port of [Heroku PG Extras](https://github.com/heroku/heroku-pg-extras) with several additions and improvements. The goal of this project is to provide powerful insights into the PostgreSQL database for Ruby on Rails apps that are not using the Heroku PostgreSQL plugin.
4
4
 
@@ -103,6 +103,12 @@ RailsPgExtras.long_running_queries(args: { threshold: "200 milliseconds" })
103
103
 
104
104
  ```
105
105
 
106
+ By default, queries target the `public` schema of the database. You can specify a different schema by passing the `schema` argument:
107
+
108
+ ```ruby
109
+ RailsPgExtras.table_cache_hit(args: { schema: "my_schema" })
110
+ ```
111
+
106
112
  ## Diagnose report
107
113
 
108
114
  The simplest way to start using pg-extras is to execute a `diagnose` method. It runs a set of checks and prints out a report highlighting areas that may require additional investigation:
@@ -461,18 +467,18 @@ This command displays the total size of all indexes on the database, in MB. It i
461
467
  RailsPgExtras.index_size
462
468
 
463
469
  $ rake pg_extras:index_size
464
- name | size
465
- ---------------------------------------------------------------+---------
466
- idx_activity_attemptable_and_type_lesson_enrollment | 5196 MB
467
- index_enrollment_attemptables_by_attempt_and_last_in_group | 4045 MB
468
- index_attempts_on_student_id | 2611 MB
469
- enrollment_activity_attemptables_pkey | 2513 MB
470
- index_attempts_on_student_id_final_attemptable_type | 2466 MB
471
- attempts_pkey | 2466 MB
472
- index_attempts_on_response_id | 2404 MB
473
- index_attempts_on_enrollment_id | 1957 MB
474
- index_enrollment_attemptables_by_enrollment_activity_id | 1789 MB
475
- enrollment_activities_pkey | 458 MB
470
+ name | size | schema |
471
+ ---------------------------------------------------------------+-------------------
472
+ idx_activity_attemptable_and_type_lesson_enrollment | 5196 MB | public |
473
+ index_enrollment_attemptables_by_attempt_and_last_in_group | 4045 MB | public |
474
+ index_attempts_on_student_id | 2611 MB | public |
475
+ enrollment_activity_attemptables_pkey | 2513 MB | custom |
476
+ index_attempts_on_student_id_final_attemptable_type | 2466 MB | custom |
477
+ attempts_pkey | 2466 MB | custom |
478
+ index_attempts_on_response_id | 2404 MB | public |
479
+ index_attempts_on_enrollment_id | 1957 MB | public |
480
+ index_enrollment_attemptables_by_enrollment_activity_id | 1789 MB | public |
481
+ enrollment_activities_pkey | 458 MB | public |
476
482
  (truncated results for brevity)
477
483
  ```
478
484
 
@@ -485,13 +491,13 @@ RailsPgExtras.table_size
485
491
 
486
492
  $ rake pg_extras:table_size
487
493
 
488
- name | size
489
- ---------------------------------------------------------------+---------
490
- learning_coaches | 196 MB
491
- states | 145 MB
492
- grade_levels | 111 MB
493
- charities_customers | 73 MB
494
- charities | 66 MB
494
+ name | size | schema |
495
+ ---------------------------------------------------------------+-------------------
496
+ learning_coaches | 196 MB | public |
497
+ states | 145 MB | public |
498
+ grade_levels | 111 MB | custom |
499
+ charities_customers | 73 MB | custom |
500
+ charities | 66 MB | public |
495
501
  (truncated results for brevity)
496
502
  ```
497
503
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsPgExtras
4
- VERSION = "5.2.4"
4
+ VERSION = "5.3.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-pg-extras
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.2.4
4
+ version: 5.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - pawurb
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-06 00:00:00.000000000 Z
11
+ date: 2023-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-pg-extras
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 5.2.4
19
+ version: 5.3.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.4
26
+ version: 5.3.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rails
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -75,7 +75,7 @@ executables: []
75
75
  extensions: []
76
76
  extra_rdoc_files: []
77
77
  files:
78
- - ".circleci/config.yml"
78
+ - ".github/workflows/ci.yml"
79
79
  - ".gitignore"
80
80
  - Gemfile
81
81
  - LICENSE.txt
data/.circleci/config.yml DELETED
@@ -1,71 +0,0 @@
1
- version: 2
2
- jobs:
3
- test:
4
- docker:
5
- - image: cimg/ruby:2.7.6
6
- environment:
7
- DATABASE_URL: postgresql://postgres:secret@localhost:5432/rails-pg-extras-test
8
- - image: cimg/postgres:11.15
9
- command: postgres -c shared_preload_libraries=pg_stat_statements
10
- name: postgres11
11
- environment:
12
- POSTGRES_USER: postgres
13
- POSTGRES_DB: rails-pg-extras-test
14
- POSTGRES_PASSWORD: secret
15
- - image: cimg/postgres:12.10
16
- command: postgres -c shared_preload_libraries=pg_stat_statements
17
- name: postgres12
18
- environment:
19
- POSTGRES_USER: postgres
20
- POSTGRES_DB: rails-pg-extras-test
21
- POSTGRES_PASSWORD: secret
22
- - image: cimg/postgres:13.6
23
- command: postgres -c shared_preload_libraries=pg_stat_statements
24
- name: postgres13
25
- environment:
26
- POSTGRES_USER: postgres
27
- POSTGRES_DB: rails-pg-extras-test
28
- POSTGRES_PASSWORD: secret
29
- - image: cimg/postgres:14.2
30
- command: postgres -c shared_preload_libraries=pg_stat_statements
31
- name: postgres14
32
- environment:
33
- POSTGRES_USER: postgres
34
- POSTGRES_DB: rails-pg-extras-test
35
- POSTGRES_PASSWORD: secret
36
- parallelism: 1
37
- steps:
38
- - checkout
39
- - run: gem update --system
40
- - run: gem install bundler
41
- - run: sudo apt-get update --allow-releaseinfo-change
42
- - run: sudo apt install postgresql-client
43
- - run: sudo apt install libpq-dev
44
- - run: bundle config set --local path 'vendor/bundle'
45
- - run: bundle install
46
- - run: dockerize -wait tcp://postgres11:5432 -timeout 1m
47
- - run:
48
- name: Run specs for PG 11
49
- environment:
50
- DATABASE_URL: postgresql://postgres:secret@postgres11:5432/rails-pg-extras-test
51
- command: bundle exec rspec spec/
52
- - run:
53
- name: Run specs for PG 12
54
- environment:
55
- DATABASE_URL: postgresql://postgres:secret@postgres12:5432/rails-pg-extras-test
56
- command: bundle exec rspec spec/
57
- - run:
58
- name: Run specs for PG 13
59
- environment:
60
- DATABASE_URL: postgresql://postgres:secret@postgres13:5432/rails-pg-extras-test
61
- command: bundle exec rspec spec/
62
- - run:
63
- name: Run specs for PG 14
64
- environment:
65
- DATABASE_URL: postgresql://postgres:secret@postgres14:5432/rails-pg-extras-test
66
- command: bundle exec rspec spec/
67
- workflows:
68
- version: 2
69
- test:
70
- jobs:
71
- - test