pg_types 0.2.1 → 0.2.3

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: e20908d841705a0d9aff62529d44d0b12d0490d51b254c49424601ddd01aa6ce
4
- data.tar.gz: 0aef0b9dd97da00bd122395c039c3e82a6ad25606abaf76fe903c13dade199d5
3
+ metadata.gz: f65d6a21e7030989efd4f4ddf73704eb0641f76cd88de55f53c418319142c053
4
+ data.tar.gz: b294112de32425347e1d2aa09e17d513a2fef339a47916b8d8bc7a5dc87f5d12
5
5
  SHA512:
6
- metadata.gz: b19210b13c1c77c22daf9a321be40e41ebbde543958d4c0cef1f8cebc1c109712744c26dae3b03de383a9945c2ffd5da7cdf4efcecec0573a6ede338d29aa2d0
7
- data.tar.gz: a95652c5c2c07a3fb70314ad9dddd0d62f08716382fd403937daac15b71c242f8eee06cedcd481d66e7d74935272eb33a5dbebfc752b064eb5350686b8a9387e
6
+ metadata.gz: 79dac23f338422a5f9a7f6021ce2c0ed46fc24fecd6c89fc99ebd67900cb109daba5fb799d21079413cfcf46b971acd736d5705904fdc18a3fcf36bf3728e8e7
7
+ data.tar.gz: 8f3317139c337979e9e6c61df0e0952bfaefc3410ca9675004620befd1e930e85f33bc184e5054011cce7f8678cf1fd8cd4eea5dd58664f4812b2b5f9dc75b47
data/Appraisals CHANGED
@@ -3,6 +3,7 @@
3
3
  appraise "rails-6.1" do
4
4
  gem "activerecord", "~> 6.1.0"
5
5
  gem "railties", "~> 6.1.0"
6
+ gem "logger", ">= 1.5.0"
6
7
  end
7
8
 
8
9
  appraise "rails-7.0" do
@@ -14,3 +15,8 @@ appraise "rails-7.1" do
14
15
  gem "activerecord", "~> 7.1.0"
15
16
  gem "railties", "~> 7.1.0"
16
17
  end
18
+
19
+ appraise "rails-8.0" do
20
+ gem "activerecord", "~> 8.0.0"
21
+ gem "railties", "~> 8.0.0"
22
+ end
@@ -12,12 +12,13 @@ gem "bigdecimal"
12
12
  gem "database_cleaner"
13
13
  gem "drb"
14
14
  gem "gem-release"
15
- gem "logger"
15
+ gem "logger", ">= 1.5.0"
16
16
  gem "mutex_m"
17
17
  gem "railties", "~> 6.1.0"
18
18
  gem "rake"
19
19
  gem "rspec"
20
- gem "rubocop-mhenrixon"
20
+ gem "rubocop"
21
+ gem "rubocop-performance"
21
22
  gem "rubocop-rake"
22
23
  gem "rubocop-rspec"
23
24
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- pg_types (0.2.0)
4
+ pg_types (0.2.2)
5
5
  activerecord (>= 6.1)
6
6
  pg (>= 1.1)
7
7
  railties (>= 6.1)
@@ -41,11 +41,11 @@ GEM
41
41
  bundler
42
42
  rake
43
43
  thor (>= 0.14.0)
44
- ast (2.4.2)
44
+ ast (2.4.3)
45
45
  base64 (0.2.0)
46
- bigdecimal (3.1.8)
46
+ bigdecimal (3.1.9)
47
47
  builder (3.3.0)
48
- concurrent-ruby (1.3.4)
48
+ concurrent-ruby (1.3.5)
49
49
  crass (1.0.6)
50
50
  database_cleaner (2.1.0)
51
51
  database_cleaner-active_record (>= 2, < 3)
@@ -53,39 +53,55 @@ GEM
53
53
  activerecord (>= 5.a)
54
54
  database_cleaner-core (~> 2.0.0)
55
55
  database_cleaner-core (2.0.1)
56
- diff-lcs (1.5.1)
56
+ diff-lcs (1.6.1)
57
57
  drb (2.2.1)
58
- erubi (1.13.0)
59
- gem-release (2.2.2)
60
- i18n (1.14.6)
58
+ erubi (1.13.1)
59
+ gem-release (2.2.4)
60
+ i18n (1.14.7)
61
61
  concurrent-ruby (~> 1.0)
62
- json (2.7.6)
63
- language_server-protocol (3.17.0.3)
64
- logger (1.6.1)
65
- loofah (2.23.1)
62
+ json (2.10.2)
63
+ language_server-protocol (3.17.0.4)
64
+ lint_roller (1.1.0)
65
+ logger (1.7.0)
66
+ loofah (2.24.0)
66
67
  crass (~> 1.0.2)
67
68
  nokogiri (>= 1.12.0)
68
69
  method_source (1.1.0)
69
- minitest (5.25.1)
70
- mutex_m (0.2.0)
71
- nokogiri (1.16.7-arm64-darwin)
70
+ minitest (5.25.5)
71
+ mutex_m (0.3.0)
72
+ nokogiri (1.18.7-aarch64-linux-gnu)
72
73
  racc (~> 1.4)
73
- parallel (1.26.3)
74
- parser (3.3.5.1)
74
+ nokogiri (1.18.7-aarch64-linux-musl)
75
+ racc (~> 1.4)
76
+ nokogiri (1.18.7-arm-linux-gnu)
77
+ racc (~> 1.4)
78
+ nokogiri (1.18.7-arm-linux-musl)
79
+ racc (~> 1.4)
80
+ nokogiri (1.18.7-arm64-darwin)
81
+ racc (~> 1.4)
82
+ nokogiri (1.18.7-x86_64-darwin)
83
+ racc (~> 1.4)
84
+ nokogiri (1.18.7-x86_64-linux-gnu)
85
+ racc (~> 1.4)
86
+ nokogiri (1.18.7-x86_64-linux-musl)
87
+ racc (~> 1.4)
88
+ parallel (1.27.0)
89
+ parser (3.3.8.0)
75
90
  ast (~> 2.4.1)
76
91
  racc
77
92
  pg (1.5.9)
93
+ prism (1.4.0)
78
94
  racc (1.8.1)
79
- rack (2.2.10)
80
- rack-test (2.1.0)
95
+ rack (2.2.13)
96
+ rack-test (2.2.0)
81
97
  rack (>= 1.3)
82
98
  rails-dom-testing (2.2.0)
83
99
  activesupport (>= 5.0.0)
84
100
  minitest
85
101
  nokogiri (>= 1.6)
86
- rails-html-sanitizer (1.6.0)
102
+ rails-html-sanitizer (1.6.2)
87
103
  loofah (~> 2.21)
88
- nokogiri (~> 1.14)
104
+ nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
89
105
  railties (6.1.7.10)
90
106
  actionpack (= 6.1.7.10)
91
107
  activesupport (= 6.1.7.10)
@@ -94,12 +110,12 @@ GEM
94
110
  thor (~> 1.0)
95
111
  rainbow (3.1.1)
96
112
  rake (13.2.1)
97
- regexp_parser (2.9.2)
113
+ regexp_parser (2.10.0)
98
114
  rspec (3.13.0)
99
115
  rspec-core (~> 3.13.0)
100
116
  rspec-expectations (~> 3.13.0)
101
117
  rspec-mocks (~> 3.13.0)
102
- rspec-core (3.13.2)
118
+ rspec-core (3.13.3)
103
119
  rspec-support (~> 3.13.0)
104
120
  rspec-expectations (3.13.3)
105
121
  diff-lcs (>= 1.2.0, < 2.0)
@@ -115,43 +131,49 @@ GEM
115
131
  rspec-expectations (~> 3.13)
116
132
  rspec-mocks (~> 3.13)
117
133
  rspec-support (~> 3.13)
118
- rspec-support (3.13.1)
119
- rubocop (1.68.0)
134
+ rspec-support (3.13.2)
135
+ rubocop (1.75.2)
120
136
  json (~> 2.3)
121
- language_server-protocol (>= 3.17.0)
137
+ language_server-protocol (~> 3.17.0.2)
138
+ lint_roller (~> 1.1.0)
122
139
  parallel (~> 1.10)
123
140
  parser (>= 3.3.0.2)
124
141
  rainbow (>= 2.2.2, < 4.0)
125
- regexp_parser (>= 2.4, < 3.0)
126
- rubocop-ast (>= 1.32.2, < 2.0)
142
+ regexp_parser (>= 2.9.3, < 3.0)
143
+ rubocop-ast (>= 1.44.0, < 2.0)
127
144
  ruby-progressbar (~> 1.7)
128
- unicode-display_width (>= 2.4.0, < 3.0)
129
- rubocop-ast (1.34.0)
130
- parser (>= 3.3.1.0)
131
- rubocop-mhenrixon (3.0.0)
132
- rubocop
133
- rubocop-performance
134
- rubocop-rake
135
- rubocop-rspec
136
- rubocop-thread_safety
137
- rubocop-performance (1.22.1)
138
- rubocop (>= 1.48.1, < 2.0)
139
- rubocop-ast (>= 1.31.1, < 2.0)
140
- rubocop-rake (0.6.0)
141
- rubocop (~> 1.0)
142
- rubocop-rspec (3.2.0)
143
- rubocop (~> 1.61)
144
- rubocop-thread_safety (0.5.1)
145
- rubocop (>= 0.90.0)
145
+ unicode-display_width (>= 2.4.0, < 4.0)
146
+ rubocop-ast (1.44.1)
147
+ parser (>= 3.3.7.2)
148
+ prism (~> 1.4)
149
+ rubocop-performance (1.25.0)
150
+ lint_roller (~> 1.1)
151
+ rubocop (>= 1.75.0, < 2.0)
152
+ rubocop-ast (>= 1.38.0, < 2.0)
153
+ rubocop-rake (0.7.1)
154
+ lint_roller (~> 1.1)
155
+ rubocop (>= 1.72.1)
156
+ rubocop-rspec (3.5.0)
157
+ lint_roller (~> 1.1)
158
+ rubocop (~> 1.72, >= 1.72.1)
146
159
  ruby-progressbar (1.13.0)
147
160
  thor (1.3.2)
148
161
  tzinfo (2.0.6)
149
162
  concurrent-ruby (~> 1.0)
150
- unicode-display_width (2.6.0)
151
- zeitwerk (2.7.1)
163
+ unicode-display_width (3.1.4)
164
+ unicode-emoji (~> 4.0, >= 4.0.4)
165
+ unicode-emoji (4.0.4)
166
+ zeitwerk (2.7.2)
152
167
 
153
168
  PLATFORMS
169
+ aarch64-linux-gnu
170
+ aarch64-linux-musl
171
+ arm-linux-gnu
172
+ arm-linux-musl
154
173
  arm64-darwin
174
+ x86_64-darwin
175
+ x86_64-linux-gnu
176
+ x86_64-linux-musl
155
177
 
156
178
  DEPENDENCIES
157
179
  activerecord (~> 6.1.0)
@@ -162,15 +184,16 @@ DEPENDENCIES
162
184
  database_cleaner
163
185
  drb
164
186
  gem-release
165
- logger
187
+ logger (>= 1.5.0)
166
188
  mutex_m
167
189
  pg_types!
168
190
  railties (~> 6.1.0)
169
191
  rake
170
192
  rspec
171
- rubocop-mhenrixon
193
+ rubocop
194
+ rubocop-performance
172
195
  rubocop-rake
173
196
  rubocop-rspec
174
197
 
175
198
  BUNDLED WITH
176
- 2.5.20
199
+ 2.6.8
@@ -17,7 +17,8 @@ gem "mutex_m"
17
17
  gem "railties", "~> 7.0.0"
18
18
  gem "rake"
19
19
  gem "rspec"
20
- gem "rubocop-mhenrixon"
20
+ gem "rubocop"
21
+ gem "rubocop-performance"
21
22
  gem "rubocop-rake"
22
23
  gem "rubocop-rspec"
23
24
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- pg_types (0.2.0)
4
+ pg_types (0.2.2)
5
5
  activerecord (>= 6.1)
6
6
  pg (>= 1.1)
7
7
  railties (>= 6.1)
@@ -9,25 +9,25 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- actionpack (7.0.8.6)
13
- actionview (= 7.0.8.6)
14
- activesupport (= 7.0.8.6)
12
+ actionpack (7.0.8.7)
13
+ actionview (= 7.0.8.7)
14
+ activesupport (= 7.0.8.7)
15
15
  rack (~> 2.0, >= 2.2.4)
16
16
  rack-test (>= 0.6.3)
17
17
  rails-dom-testing (~> 2.0)
18
18
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
19
- actionview (7.0.8.6)
20
- activesupport (= 7.0.8.6)
19
+ actionview (7.0.8.7)
20
+ activesupport (= 7.0.8.7)
21
21
  builder (~> 3.1)
22
22
  erubi (~> 1.4)
23
23
  rails-dom-testing (~> 2.0)
24
24
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
25
- activemodel (7.0.8.6)
26
- activesupport (= 7.0.8.6)
27
- activerecord (7.0.8.6)
28
- activemodel (= 7.0.8.6)
29
- activesupport (= 7.0.8.6)
30
- activesupport (7.0.8.6)
25
+ activemodel (7.0.8.7)
26
+ activesupport (= 7.0.8.7)
27
+ activerecord (7.0.8.7)
28
+ activemodel (= 7.0.8.7)
29
+ activesupport (= 7.0.8.7)
30
+ activesupport (7.0.8.7)
31
31
  concurrent-ruby (~> 1.0, >= 1.0.2)
32
32
  i18n (>= 1.6, < 2)
33
33
  minitest (>= 5.1)
@@ -40,11 +40,11 @@ GEM
40
40
  bundler
41
41
  rake
42
42
  thor (>= 0.14.0)
43
- ast (2.4.2)
43
+ ast (2.4.3)
44
44
  base64 (0.2.0)
45
- bigdecimal (3.1.8)
45
+ bigdecimal (3.1.9)
46
46
  builder (3.3.0)
47
- concurrent-ruby (1.3.4)
47
+ concurrent-ruby (1.3.5)
48
48
  crass (1.0.6)
49
49
  database_cleaner (2.1.0)
50
50
  database_cleaner-active_record (>= 2, < 3)
@@ -52,54 +52,70 @@ GEM
52
52
  activerecord (>= 5.a)
53
53
  database_cleaner-core (~> 2.0.0)
54
54
  database_cleaner-core (2.0.1)
55
- diff-lcs (1.5.1)
55
+ diff-lcs (1.6.1)
56
56
  drb (2.2.1)
57
- erubi (1.13.0)
58
- gem-release (2.2.2)
59
- i18n (1.14.6)
57
+ erubi (1.13.1)
58
+ gem-release (2.2.4)
59
+ i18n (1.14.7)
60
60
  concurrent-ruby (~> 1.0)
61
- json (2.7.6)
62
- language_server-protocol (3.17.0.3)
63
- logger (1.6.1)
64
- loofah (2.23.1)
61
+ json (2.10.2)
62
+ language_server-protocol (3.17.0.4)
63
+ lint_roller (1.1.0)
64
+ logger (1.7.0)
65
+ loofah (2.24.0)
65
66
  crass (~> 1.0.2)
66
67
  nokogiri (>= 1.12.0)
67
68
  method_source (1.1.0)
68
- minitest (5.25.1)
69
- mutex_m (0.2.0)
70
- nokogiri (1.16.7-arm64-darwin)
69
+ minitest (5.25.5)
70
+ mutex_m (0.3.0)
71
+ nokogiri (1.18.7-aarch64-linux-gnu)
71
72
  racc (~> 1.4)
72
- parallel (1.26.3)
73
- parser (3.3.5.1)
73
+ nokogiri (1.18.7-aarch64-linux-musl)
74
+ racc (~> 1.4)
75
+ nokogiri (1.18.7-arm-linux-gnu)
76
+ racc (~> 1.4)
77
+ nokogiri (1.18.7-arm-linux-musl)
78
+ racc (~> 1.4)
79
+ nokogiri (1.18.7-arm64-darwin)
80
+ racc (~> 1.4)
81
+ nokogiri (1.18.7-x86_64-darwin)
82
+ racc (~> 1.4)
83
+ nokogiri (1.18.7-x86_64-linux-gnu)
84
+ racc (~> 1.4)
85
+ nokogiri (1.18.7-x86_64-linux-musl)
86
+ racc (~> 1.4)
87
+ parallel (1.27.0)
88
+ parser (3.3.8.0)
74
89
  ast (~> 2.4.1)
75
90
  racc
76
91
  pg (1.5.9)
92
+ prism (1.4.0)
77
93
  racc (1.8.1)
78
- rack (2.2.10)
79
- rack-test (2.1.0)
94
+ rack (2.2.13)
95
+ rack-test (2.2.0)
80
96
  rack (>= 1.3)
81
97
  rails-dom-testing (2.2.0)
82
98
  activesupport (>= 5.0.0)
83
99
  minitest
84
100
  nokogiri (>= 1.6)
85
- rails-html-sanitizer (1.6.0)
101
+ rails-html-sanitizer (1.6.2)
86
102
  loofah (~> 2.21)
87
- nokogiri (~> 1.14)
88
- railties (7.0.8.6)
89
- actionpack (= 7.0.8.6)
90
- activesupport (= 7.0.8.6)
103
+ nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
104
+ railties (7.0.8.7)
105
+ actionpack (= 7.0.8.7)
106
+ activesupport (= 7.0.8.7)
91
107
  method_source
92
108
  rake (>= 12.2)
93
109
  thor (~> 1.0)
94
110
  zeitwerk (~> 2.5)
95
111
  rainbow (3.1.1)
96
112
  rake (13.2.1)
97
- regexp_parser (2.9.2)
113
+ regexp_parser (2.10.0)
98
114
  rspec (3.13.0)
99
115
  rspec-core (~> 3.13.0)
100
116
  rspec-expectations (~> 3.13.0)
101
117
  rspec-mocks (~> 3.13.0)
102
- rspec-core (3.13.2)
118
+ rspec-core (3.13.3)
103
119
  rspec-support (~> 3.13.0)
104
120
  rspec-expectations (3.13.3)
105
121
  diff-lcs (>= 1.2.0, < 2.0)
@@ -107,7 +123,7 @@ GEM
107
123
  rspec-mocks (3.13.2)
108
124
  diff-lcs (>= 1.2.0, < 2.0)
109
125
  rspec-support (~> 3.13.0)
110
- rspec-rails (7.0.1)
126
+ rspec-rails (7.1.1)
111
127
  actionpack (>= 7.0)
112
128
  activesupport (>= 7.0)
113
129
  railties (>= 7.0)
@@ -115,43 +131,49 @@ GEM
115
131
  rspec-expectations (~> 3.13)
116
132
  rspec-mocks (~> 3.13)
117
133
  rspec-support (~> 3.13)
118
- rspec-support (3.13.1)
119
- rubocop (1.68.0)
134
+ rspec-support (3.13.2)
135
+ rubocop (1.75.2)
120
136
  json (~> 2.3)
121
- language_server-protocol (>= 3.17.0)
137
+ language_server-protocol (~> 3.17.0.2)
138
+ lint_roller (~> 1.1.0)
122
139
  parallel (~> 1.10)
123
140
  parser (>= 3.3.0.2)
124
141
  rainbow (>= 2.2.2, < 4.0)
125
- regexp_parser (>= 2.4, < 3.0)
126
- rubocop-ast (>= 1.32.2, < 2.0)
142
+ regexp_parser (>= 2.9.3, < 3.0)
143
+ rubocop-ast (>= 1.44.0, < 2.0)
127
144
  ruby-progressbar (~> 1.7)
128
- unicode-display_width (>= 2.4.0, < 3.0)
129
- rubocop-ast (1.34.0)
130
- parser (>= 3.3.1.0)
131
- rubocop-mhenrixon (3.0.0)
132
- rubocop
133
- rubocop-performance
134
- rubocop-rake
135
- rubocop-rspec
136
- rubocop-thread_safety
137
- rubocop-performance (1.22.1)
138
- rubocop (>= 1.48.1, < 2.0)
139
- rubocop-ast (>= 1.31.1, < 2.0)
140
- rubocop-rake (0.6.0)
141
- rubocop (~> 1.0)
142
- rubocop-rspec (3.2.0)
143
- rubocop (~> 1.61)
144
- rubocop-thread_safety (0.5.1)
145
- rubocop (>= 0.90.0)
145
+ unicode-display_width (>= 2.4.0, < 4.0)
146
+ rubocop-ast (1.44.1)
147
+ parser (>= 3.3.7.2)
148
+ prism (~> 1.4)
149
+ rubocop-performance (1.25.0)
150
+ lint_roller (~> 1.1)
151
+ rubocop (>= 1.75.0, < 2.0)
152
+ rubocop-ast (>= 1.38.0, < 2.0)
153
+ rubocop-rake (0.7.1)
154
+ lint_roller (~> 1.1)
155
+ rubocop (>= 1.72.1)
156
+ rubocop-rspec (3.5.0)
157
+ lint_roller (~> 1.1)
158
+ rubocop (~> 1.72, >= 1.72.1)
146
159
  ruby-progressbar (1.13.0)
147
160
  thor (1.3.2)
148
161
  tzinfo (2.0.6)
149
162
  concurrent-ruby (~> 1.0)
150
- unicode-display_width (2.6.0)
151
- zeitwerk (2.7.1)
163
+ unicode-display_width (3.1.4)
164
+ unicode-emoji (~> 4.0, >= 4.0.4)
165
+ unicode-emoji (4.0.4)
166
+ zeitwerk (2.7.2)
152
167
 
153
168
  PLATFORMS
169
+ aarch64-linux-gnu
170
+ aarch64-linux-musl
171
+ arm-linux-gnu
172
+ arm-linux-musl
154
173
  arm64-darwin
174
+ x86_64-darwin
175
+ x86_64-linux-gnu
176
+ x86_64-linux-musl
155
177
 
156
178
  DEPENDENCIES
157
179
  activerecord (~> 7.0.0)
@@ -168,9 +190,10 @@ DEPENDENCIES
168
190
  railties (~> 7.0.0)
169
191
  rake
170
192
  rspec
171
- rubocop-mhenrixon
193
+ rubocop
194
+ rubocop-performance
172
195
  rubocop-rake
173
196
  rubocop-rspec
174
197
 
175
198
  BUNDLED WITH
176
- 2.5.20
199
+ 2.6.8
@@ -17,7 +17,8 @@ gem "mutex_m"
17
17
  gem "railties", "~> 7.1.0"
18
18
  gem "rake"
19
19
  gem "rspec"
20
- gem "rubocop-mhenrixon"
20
+ gem "rubocop"
21
+ gem "rubocop-performance"
21
22
  gem "rubocop-rake"
22
23
  gem "rubocop-rspec"
23
24
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- pg_types (0.2.0)
4
+ pg_types (0.2.2)
5
5
  activerecord (>= 6.1)
6
6
  pg (>= 1.1)
7
7
  railties (>= 6.1)
@@ -9,9 +9,9 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- actionpack (7.1.5)
13
- actionview (= 7.1.5)
14
- activesupport (= 7.1.5)
12
+ actionpack (7.1.5.1)
13
+ actionview (= 7.1.5.1)
14
+ activesupport (= 7.1.5.1)
15
15
  nokogiri (>= 1.8.5)
16
16
  racc
17
17
  rack (>= 2.2.4)
@@ -19,19 +19,19 @@ GEM
19
19
  rack-test (>= 0.6.3)
20
20
  rails-dom-testing (~> 2.2)
21
21
  rails-html-sanitizer (~> 1.6)
22
- actionview (7.1.5)
23
- activesupport (= 7.1.5)
22
+ actionview (7.1.5.1)
23
+ activesupport (= 7.1.5.1)
24
24
  builder (~> 3.1)
25
25
  erubi (~> 1.11)
26
26
  rails-dom-testing (~> 2.2)
27
27
  rails-html-sanitizer (~> 1.6)
28
- activemodel (7.1.5)
29
- activesupport (= 7.1.5)
30
- activerecord (7.1.5)
31
- activemodel (= 7.1.5)
32
- activesupport (= 7.1.5)
28
+ activemodel (7.1.5.1)
29
+ activesupport (= 7.1.5.1)
30
+ activerecord (7.1.5.1)
31
+ activemodel (= 7.1.5.1)
32
+ activesupport (= 7.1.5.1)
33
33
  timeout (>= 0.4.0)
34
- activesupport (7.1.5)
34
+ activesupport (7.1.5.1)
35
35
  base64
36
36
  benchmark (>= 0.3)
37
37
  bigdecimal
@@ -52,13 +52,13 @@ GEM
52
52
  bundler
53
53
  rake
54
54
  thor (>= 0.14.0)
55
- ast (2.4.2)
55
+ ast (2.4.3)
56
56
  base64 (0.2.0)
57
- benchmark (0.3.0)
58
- bigdecimal (3.1.8)
57
+ benchmark (0.4.0)
58
+ bigdecimal (3.1.9)
59
59
  builder (3.3.0)
60
- concurrent-ruby (1.3.4)
61
- connection_pool (2.4.1)
60
+ concurrent-ruby (1.3.5)
61
+ connection_pool (2.5.1)
62
62
  crass (1.0.6)
63
63
  database_cleaner (2.1.0)
64
64
  database_cleaner-active_record (>= 2, < 3)
@@ -66,51 +66,74 @@ GEM
66
66
  activerecord (>= 5.a)
67
67
  database_cleaner-core (~> 2.0.0)
68
68
  database_cleaner-core (2.0.1)
69
- diff-lcs (1.5.1)
69
+ date (3.4.1)
70
+ diff-lcs (1.6.1)
70
71
  drb (2.2.1)
71
- erubi (1.13.0)
72
- gem-release (2.2.2)
73
- i18n (1.14.6)
72
+ erubi (1.13.1)
73
+ gem-release (2.2.4)
74
+ i18n (1.14.7)
74
75
  concurrent-ruby (~> 1.0)
75
- io-console (0.7.2)
76
- irb (1.14.1)
76
+ io-console (0.8.0)
77
+ irb (1.15.2)
78
+ pp (>= 0.6.0)
77
79
  rdoc (>= 4.0.0)
78
80
  reline (>= 0.4.2)
79
- json (2.7.6)
80
- language_server-protocol (3.17.0.3)
81
- logger (1.6.1)
82
- loofah (2.23.1)
81
+ json (2.10.2)
82
+ language_server-protocol (3.17.0.4)
83
+ lint_roller (1.1.0)
84
+ logger (1.7.0)
85
+ loofah (2.24.0)
83
86
  crass (~> 1.0.2)
84
87
  nokogiri (>= 1.12.0)
85
- minitest (5.25.1)
86
- mutex_m (0.2.0)
87
- nokogiri (1.16.7-arm64-darwin)
88
+ minitest (5.25.5)
89
+ mutex_m (0.3.0)
90
+ nokogiri (1.18.7-aarch64-linux-gnu)
88
91
  racc (~> 1.4)
89
- parallel (1.26.3)
90
- parser (3.3.5.1)
92
+ nokogiri (1.18.7-aarch64-linux-musl)
93
+ racc (~> 1.4)
94
+ nokogiri (1.18.7-arm-linux-gnu)
95
+ racc (~> 1.4)
96
+ nokogiri (1.18.7-arm-linux-musl)
97
+ racc (~> 1.4)
98
+ nokogiri (1.18.7-arm64-darwin)
99
+ racc (~> 1.4)
100
+ nokogiri (1.18.7-x86_64-darwin)
101
+ racc (~> 1.4)
102
+ nokogiri (1.18.7-x86_64-linux-gnu)
103
+ racc (~> 1.4)
104
+ nokogiri (1.18.7-x86_64-linux-musl)
105
+ racc (~> 1.4)
106
+ parallel (1.27.0)
107
+ parser (3.3.8.0)
91
108
  ast (~> 2.4.1)
92
109
  racc
93
110
  pg (1.5.9)
94
- psych (5.1.2)
111
+ pp (0.6.2)
112
+ prettyprint
113
+ prettyprint (0.2.0)
114
+ prism (1.4.0)
115
+ psych (5.2.3)
116
+ date
95
117
  stringio
96
118
  racc (1.8.1)
97
- rack (3.1.8)
98
- rack-session (2.0.0)
119
+ rack (3.1.13)
120
+ rack-session (2.1.0)
121
+ base64 (>= 0.1.0)
99
122
  rack (>= 3.0.0)
100
- rack-test (2.1.0)
123
+ rack-test (2.2.0)
101
124
  rack (>= 1.3)
102
- rackup (2.2.0)
125
+ rackup (2.2.1)
103
126
  rack (>= 3)
104
127
  rails-dom-testing (2.2.0)
105
128
  activesupport (>= 5.0.0)
106
129
  minitest
107
130
  nokogiri (>= 1.6)
108
- rails-html-sanitizer (1.6.0)
131
+ rails-html-sanitizer (1.6.2)
109
132
  loofah (~> 2.21)
110
- nokogiri (~> 1.14)
111
- railties (7.1.5)
112
- actionpack (= 7.1.5)
113
- activesupport (= 7.1.5)
133
+ nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
134
+ railties (7.1.5.1)
135
+ actionpack (= 7.1.5.1)
136
+ activesupport (= 7.1.5.1)
114
137
  irb
115
138
  rackup (>= 1.0.0)
116
139
  rake (>= 12.2)
@@ -118,16 +141,16 @@ GEM
118
141
  zeitwerk (~> 2.6)
119
142
  rainbow (3.1.1)
120
143
  rake (13.2.1)
121
- rdoc (6.7.0)
144
+ rdoc (6.13.1)
122
145
  psych (>= 4.0.0)
123
- regexp_parser (2.9.2)
124
- reline (0.5.10)
146
+ regexp_parser (2.10.0)
147
+ reline (0.6.1)
125
148
  io-console (~> 0.5)
126
149
  rspec (3.13.0)
127
150
  rspec-core (~> 3.13.0)
128
151
  rspec-expectations (~> 3.13.0)
129
152
  rspec-mocks (~> 3.13.0)
130
- rspec-core (3.13.2)
153
+ rspec-core (3.13.3)
131
154
  rspec-support (~> 3.13.0)
132
155
  rspec-expectations (3.13.3)
133
156
  diff-lcs (>= 1.2.0, < 2.0)
@@ -135,7 +158,7 @@ GEM
135
158
  rspec-mocks (3.13.2)
136
159
  diff-lcs (>= 1.2.0, < 2.0)
137
160
  rspec-support (~> 3.13.0)
138
- rspec-rails (7.0.1)
161
+ rspec-rails (7.1.1)
139
162
  actionpack (>= 7.0)
140
163
  activesupport (>= 7.0)
141
164
  railties (>= 7.0)
@@ -143,46 +166,52 @@ GEM
143
166
  rspec-expectations (~> 3.13)
144
167
  rspec-mocks (~> 3.13)
145
168
  rspec-support (~> 3.13)
146
- rspec-support (3.13.1)
147
- rubocop (1.68.0)
169
+ rspec-support (3.13.2)
170
+ rubocop (1.75.2)
148
171
  json (~> 2.3)
149
- language_server-protocol (>= 3.17.0)
172
+ language_server-protocol (~> 3.17.0.2)
173
+ lint_roller (~> 1.1.0)
150
174
  parallel (~> 1.10)
151
175
  parser (>= 3.3.0.2)
152
176
  rainbow (>= 2.2.2, < 4.0)
153
- regexp_parser (>= 2.4, < 3.0)
154
- rubocop-ast (>= 1.32.2, < 2.0)
177
+ regexp_parser (>= 2.9.3, < 3.0)
178
+ rubocop-ast (>= 1.44.0, < 2.0)
155
179
  ruby-progressbar (~> 1.7)
156
- unicode-display_width (>= 2.4.0, < 3.0)
157
- rubocop-ast (1.34.0)
158
- parser (>= 3.3.1.0)
159
- rubocop-mhenrixon (3.0.0)
160
- rubocop
161
- rubocop-performance
162
- rubocop-rake
163
- rubocop-rspec
164
- rubocop-thread_safety
165
- rubocop-performance (1.22.1)
166
- rubocop (>= 1.48.1, < 2.0)
167
- rubocop-ast (>= 1.31.1, < 2.0)
168
- rubocop-rake (0.6.0)
169
- rubocop (~> 1.0)
170
- rubocop-rspec (3.2.0)
171
- rubocop (~> 1.61)
172
- rubocop-thread_safety (0.5.1)
173
- rubocop (>= 0.90.0)
180
+ unicode-display_width (>= 2.4.0, < 4.0)
181
+ rubocop-ast (1.44.1)
182
+ parser (>= 3.3.7.2)
183
+ prism (~> 1.4)
184
+ rubocop-performance (1.25.0)
185
+ lint_roller (~> 1.1)
186
+ rubocop (>= 1.75.0, < 2.0)
187
+ rubocop-ast (>= 1.38.0, < 2.0)
188
+ rubocop-rake (0.7.1)
189
+ lint_roller (~> 1.1)
190
+ rubocop (>= 1.72.1)
191
+ rubocop-rspec (3.5.0)
192
+ lint_roller (~> 1.1)
193
+ rubocop (~> 1.72, >= 1.72.1)
174
194
  ruby-progressbar (1.13.0)
175
- securerandom (0.3.1)
176
- stringio (3.1.1)
195
+ securerandom (0.4.1)
196
+ stringio (3.1.6)
177
197
  thor (1.3.2)
178
- timeout (0.4.1)
198
+ timeout (0.4.3)
179
199
  tzinfo (2.0.6)
180
200
  concurrent-ruby (~> 1.0)
181
- unicode-display_width (2.6.0)
182
- zeitwerk (2.7.1)
201
+ unicode-display_width (3.1.4)
202
+ unicode-emoji (~> 4.0, >= 4.0.4)
203
+ unicode-emoji (4.0.4)
204
+ zeitwerk (2.7.2)
183
205
 
184
206
  PLATFORMS
207
+ aarch64-linux-gnu
208
+ aarch64-linux-musl
209
+ arm-linux-gnu
210
+ arm-linux-musl
185
211
  arm64-darwin
212
+ x86_64-darwin
213
+ x86_64-linux-gnu
214
+ x86_64-linux-musl
186
215
 
187
216
  DEPENDENCIES
188
217
  activerecord (~> 7.1.0)
@@ -199,9 +228,10 @@ DEPENDENCIES
199
228
  railties (~> 7.1.0)
200
229
  rake
201
230
  rspec
202
- rubocop-mhenrixon
231
+ rubocop
232
+ rubocop-performance
203
233
  rubocop-rake
204
234
  rubocop-rspec
205
235
 
206
236
  BUNDLED WITH
207
- 2.5.20
237
+ 2.6.8
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file was generated by Appraisal
4
+
5
+ source "https://rubygems.org"
6
+
7
+ gem "activerecord", "~> 8.0.0"
8
+ gem "ammeter"
9
+ gem "appraisal"
10
+ gem "base64"
11
+ gem "bigdecimal"
12
+ gem "database_cleaner"
13
+ gem "drb"
14
+ gem "gem-release"
15
+ gem "logger"
16
+ gem "mutex_m"
17
+ gem "railties", "~> 8.0.0"
18
+ gem "rake"
19
+ gem "rspec"
20
+ gem "rubocop"
21
+ gem "rubocop-performance"
22
+ gem "rubocop-rake"
23
+ gem "rubocop-rspec"
24
+
25
+ gemspec path: "../"
@@ -0,0 +1,218 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ pg_types (0.2.2)
5
+ activerecord (>= 6.1)
6
+ pg (>= 1.1)
7
+ railties (>= 6.1)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ actionpack (8.0.2)
13
+ actionview (= 8.0.2)
14
+ activesupport (= 8.0.2)
15
+ nokogiri (>= 1.8.5)
16
+ rack (>= 2.2.4)
17
+ rack-session (>= 1.0.1)
18
+ rack-test (>= 0.6.3)
19
+ rails-dom-testing (~> 2.2)
20
+ rails-html-sanitizer (~> 1.6)
21
+ useragent (~> 0.16)
22
+ actionview (8.0.2)
23
+ activesupport (= 8.0.2)
24
+ builder (~> 3.1)
25
+ erubi (~> 1.11)
26
+ rails-dom-testing (~> 2.2)
27
+ rails-html-sanitizer (~> 1.6)
28
+ activemodel (8.0.2)
29
+ activesupport (= 8.0.2)
30
+ activerecord (8.0.2)
31
+ activemodel (= 8.0.2)
32
+ activesupport (= 8.0.2)
33
+ timeout (>= 0.4.0)
34
+ activesupport (8.0.2)
35
+ base64
36
+ benchmark (>= 0.3)
37
+ bigdecimal
38
+ concurrent-ruby (~> 1.0, >= 1.3.1)
39
+ connection_pool (>= 2.2.5)
40
+ drb
41
+ i18n (>= 1.6, < 2)
42
+ logger (>= 1.4.2)
43
+ minitest (>= 5.1)
44
+ securerandom (>= 0.3)
45
+ tzinfo (~> 2.0, >= 2.0.5)
46
+ uri (>= 0.13.1)
47
+ ammeter (1.1.7)
48
+ activesupport (>= 3.0)
49
+ railties (>= 3.0)
50
+ rspec-rails (>= 2.2)
51
+ appraisal (2.5.0)
52
+ bundler
53
+ rake
54
+ thor (>= 0.14.0)
55
+ ast (2.4.3)
56
+ base64 (0.2.0)
57
+ benchmark (0.4.0)
58
+ bigdecimal (3.1.9)
59
+ builder (3.3.0)
60
+ concurrent-ruby (1.3.5)
61
+ connection_pool (2.5.1)
62
+ crass (1.0.6)
63
+ database_cleaner (2.1.0)
64
+ database_cleaner-active_record (>= 2, < 3)
65
+ database_cleaner-active_record (2.2.0)
66
+ activerecord (>= 5.a)
67
+ database_cleaner-core (~> 2.0.0)
68
+ database_cleaner-core (2.0.1)
69
+ date (3.4.1)
70
+ diff-lcs (1.6.1)
71
+ drb (2.2.1)
72
+ erubi (1.13.1)
73
+ gem-release (2.2.4)
74
+ i18n (1.14.7)
75
+ concurrent-ruby (~> 1.0)
76
+ io-console (0.8.0)
77
+ irb (1.15.2)
78
+ pp (>= 0.6.0)
79
+ rdoc (>= 4.0.0)
80
+ reline (>= 0.4.2)
81
+ json (2.10.2)
82
+ language_server-protocol (3.17.0.4)
83
+ lint_roller (1.1.0)
84
+ logger (1.7.0)
85
+ loofah (2.24.0)
86
+ crass (~> 1.0.2)
87
+ nokogiri (>= 1.12.0)
88
+ minitest (5.25.5)
89
+ mutex_m (0.3.0)
90
+ nokogiri (1.18.7-arm64-darwin)
91
+ racc (~> 1.4)
92
+ parallel (1.27.0)
93
+ parser (3.3.8.0)
94
+ ast (~> 2.4.1)
95
+ racc
96
+ pg (1.5.9)
97
+ pp (0.6.2)
98
+ prettyprint
99
+ prettyprint (0.2.0)
100
+ prism (1.4.0)
101
+ psych (5.2.3)
102
+ date
103
+ stringio
104
+ racc (1.8.1)
105
+ rack (3.1.13)
106
+ rack-session (2.1.0)
107
+ base64 (>= 0.1.0)
108
+ rack (>= 3.0.0)
109
+ rack-test (2.2.0)
110
+ rack (>= 1.3)
111
+ rackup (2.2.1)
112
+ rack (>= 3)
113
+ rails-dom-testing (2.2.0)
114
+ activesupport (>= 5.0.0)
115
+ minitest
116
+ nokogiri (>= 1.6)
117
+ rails-html-sanitizer (1.6.2)
118
+ loofah (~> 2.21)
119
+ nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
120
+ railties (8.0.2)
121
+ actionpack (= 8.0.2)
122
+ activesupport (= 8.0.2)
123
+ irb (~> 1.13)
124
+ rackup (>= 1.0.0)
125
+ rake (>= 12.2)
126
+ thor (~> 1.0, >= 1.2.2)
127
+ zeitwerk (~> 2.6)
128
+ rainbow (3.1.1)
129
+ rake (13.2.1)
130
+ rdoc (6.13.1)
131
+ psych (>= 4.0.0)
132
+ regexp_parser (2.10.0)
133
+ reline (0.6.1)
134
+ io-console (~> 0.5)
135
+ rspec (3.13.0)
136
+ rspec-core (~> 3.13.0)
137
+ rspec-expectations (~> 3.13.0)
138
+ rspec-mocks (~> 3.13.0)
139
+ rspec-core (3.13.3)
140
+ rspec-support (~> 3.13.0)
141
+ rspec-expectations (3.13.3)
142
+ diff-lcs (>= 1.2.0, < 2.0)
143
+ rspec-support (~> 3.13.0)
144
+ rspec-mocks (3.13.2)
145
+ diff-lcs (>= 1.2.0, < 2.0)
146
+ rspec-support (~> 3.13.0)
147
+ rspec-rails (7.1.1)
148
+ actionpack (>= 7.0)
149
+ activesupport (>= 7.0)
150
+ railties (>= 7.0)
151
+ rspec-core (~> 3.13)
152
+ rspec-expectations (~> 3.13)
153
+ rspec-mocks (~> 3.13)
154
+ rspec-support (~> 3.13)
155
+ rspec-support (3.13.2)
156
+ rubocop (1.75.2)
157
+ json (~> 2.3)
158
+ language_server-protocol (~> 3.17.0.2)
159
+ lint_roller (~> 1.1.0)
160
+ parallel (~> 1.10)
161
+ parser (>= 3.3.0.2)
162
+ rainbow (>= 2.2.2, < 4.0)
163
+ regexp_parser (>= 2.9.3, < 3.0)
164
+ rubocop-ast (>= 1.44.0, < 2.0)
165
+ ruby-progressbar (~> 1.7)
166
+ unicode-display_width (>= 2.4.0, < 4.0)
167
+ rubocop-ast (1.44.1)
168
+ parser (>= 3.3.7.2)
169
+ prism (~> 1.4)
170
+ rubocop-performance (1.25.0)
171
+ lint_roller (~> 1.1)
172
+ rubocop (>= 1.75.0, < 2.0)
173
+ rubocop-ast (>= 1.38.0, < 2.0)
174
+ rubocop-rake (0.7.1)
175
+ lint_roller (~> 1.1)
176
+ rubocop (>= 1.72.1)
177
+ rubocop-rspec (3.5.0)
178
+ lint_roller (~> 1.1)
179
+ rubocop (~> 1.72, >= 1.72.1)
180
+ ruby-progressbar (1.13.0)
181
+ securerandom (0.4.1)
182
+ stringio (3.1.6)
183
+ thor (1.3.2)
184
+ timeout (0.4.3)
185
+ tzinfo (2.0.6)
186
+ concurrent-ruby (~> 1.0)
187
+ unicode-display_width (3.1.4)
188
+ unicode-emoji (~> 4.0, >= 4.0.4)
189
+ unicode-emoji (4.0.4)
190
+ uri (1.0.3)
191
+ useragent (0.16.11)
192
+ zeitwerk (2.7.2)
193
+
194
+ PLATFORMS
195
+ arm64-darwin
196
+
197
+ DEPENDENCIES
198
+ activerecord (~> 8.0.0)
199
+ ammeter
200
+ appraisal
201
+ base64
202
+ bigdecimal
203
+ database_cleaner
204
+ drb
205
+ gem-release
206
+ logger
207
+ mutex_m
208
+ pg_types!
209
+ railties (~> 8.0.0)
210
+ rake
211
+ rspec
212
+ rubocop
213
+ rubocop-performance
214
+ rubocop-rake
215
+ rubocop-rspec
216
+
217
+ BUNDLED WITH
218
+ 2.5.20
@@ -2,11 +2,9 @@
2
2
 
3
3
  module PgTypes
4
4
  class Railtie < Rails::Railtie
5
- initializer "postgres_aggregates.load" do
5
+ initializer "pg_types.load", after: "pg_aggregates.load" do
6
6
  ActiveSupport.on_load(:active_record) do
7
- ActiveRecord::ConnectionAdapters::AbstractAdapter.include PgTypes::SchemaStatements
8
- ActiveRecord::Migration::CommandRecorder.include PgTypes::CommandRecorder
9
- ActiveRecord::SchemaDumper.prepend PgTypes::SchemaDumper
7
+ PgTypes.load
10
8
  end
11
9
  end
12
10
  end
@@ -2,49 +2,82 @@
2
2
 
3
3
  module PgTypes
4
4
  module SchemaDumper
5
+ # Define a Struct for type information
6
+ TypeDefinition = Struct.new(:name, :definition)
7
+
8
+ # Override the types method from ActiveRecord's PostgreSQL schema dumper
9
+ # This will run at the right time in the schema dump process (after extensions, before tables)
5
10
  def tables(stream)
6
- # First dump types
11
+ # Then add our custom composite types
7
12
  dump_custom_types(stream)
8
- stream.puts
9
13
 
14
+ # Call the original types method first (for enum types)
10
15
  super
11
16
  end
12
17
 
13
18
  private
14
19
 
15
20
  def dump_custom_types(stream)
16
- type_versions = {}
17
- Dir.glob(File.join(Dir.pwd, "db/types/*_v*.sql")).each do |file|
18
- file_version = FileVersion.new(file)
19
- type_versions[file_version.name] ||= []
20
- type_versions[file_version.name] << file_version
21
- end
21
+ types = dumpable_types_in_database
22
22
 
23
- return if type_versions.empty?
23
+ return if types.empty?
24
24
 
25
25
  stream.puts " # These are custom PostgreSQL types that were defined"
26
26
 
27
- latest_versions = type_versions.transform_values do |versions|
28
- versions.max_by(&:version)
27
+ # Sort by name to ensure consistent ordering
28
+ types.sort_by(&:name).each do |type|
29
+ stream.puts <<-TYPE
30
+ create_type "#{type.name}", sql_definition: <<-SQL
31
+ #{type.definition}
32
+ SQL
33
+ TYPE
29
34
  end
35
+ end
30
36
 
31
- latest_versions.keys.sort.each do |type_name|
32
- file_version = latest_versions[type_name]
33
- all_versions = type_versions[type_name].map(&:version).sort
34
- version_comment = all_versions.size > 1 ? " -- versions: #{all_versions.join(", ")}" : ""
35
-
36
- # Remove any leading/trailing whitespace from SQL definition
37
- sql_def = file_version.sql_definition.strip
37
+ # Fetches all custom types from the database
38
+ def dumpable_types_in_database
39
+ @dumpable_types_in_database ||= begin
40
+ # SQL query to fetch custom types from PostgreSQL
41
+ sql = <<~SQL
42
+ SELECT#{" "}
43
+ t.typname AS name,
44
+ format(
45
+ 'CREATE TYPE %s AS (%s);',
46
+ t.typname,
47
+ array_to_string(
48
+ array_agg(
49
+ format(
50
+ '%s %s',
51
+ a.attname,
52
+ pg_catalog.format_type(a.atttypid, a.atttypmod)
53
+ ) ORDER BY a.attnum
54
+ ),
55
+ E',\n '
56
+ )
57
+ ) AS definition
58
+ FROM pg_type t
59
+ JOIN pg_class c ON (c.relname = t.typname)
60
+ JOIN pg_attribute a ON (a.attrelid = c.oid)
61
+ JOIN pg_namespace n ON (n.oid = t.typnamespace)
62
+ WHERE n.nspname = 'public'
63
+ AND c.relkind = 'c'
64
+ AND a.attnum > 0
65
+ AND NOT a.attisdropped
66
+ GROUP BY t.typname, n.nspname
67
+ ORDER BY t.typname;
68
+ SQL
38
69
 
39
- stream.puts <<-TYPE
40
- create_type "#{type_name}", sql_definition: <<-SQL#{version_comment}
41
- #{sql_def}
42
- SQL
70
+ # Get the appropriate connection
71
+ connection = ActiveRecord::Base.connection
43
72
 
44
- TYPE
73
+ # Execute the query and transform results into type objects
74
+ connection.execute(sql).map do |result|
75
+ TypeDefinition.new(
76
+ result["name"],
77
+ result["definition"].strip
78
+ )
79
+ end
45
80
  end
46
-
47
- stream.puts
48
81
  end
49
82
  end
50
83
  end
@@ -5,6 +5,9 @@ module PgTypes
5
5
  def create_type(name, version: nil, sql_definition: nil)
6
6
  raise ArgumentError, "Must provide either sql_definition or version" if sql_definition.nil? && version.nil?
7
7
 
8
+ # First, check if the type already exists to avoid duplicate creation attempts
9
+ return if type_exists?(name)
10
+
8
11
  if sql_definition
9
12
  execute sql_definition
10
13
  else
@@ -21,6 +24,10 @@ module PgTypes
21
24
 
22
25
  execute File.read(sql_file)
23
26
  end
27
+ rescue ActiveRecord::StatementInvalid => e
28
+ puts "WARNING: Failed to create type #{name}."
29
+ puts " Error: #{e.message}"
30
+ raise
24
31
  end
25
32
 
26
33
  def drop_type(name, force: false)
@@ -39,5 +46,22 @@ module PgTypes
39
46
  $$;
40
47
  SQL
41
48
  end
49
+
50
+ private
51
+
52
+ def type_exists?(name)
53
+ sql = <<-SQL
54
+ SELECT 1
55
+ FROM pg_catalog.pg_type t
56
+ JOIN pg_catalog.pg_namespace n ON n.oid = t.typnamespace
57
+ WHERE t.typname = '#{name}'
58
+ AND n.nspname = 'public'
59
+ SQL
60
+
61
+ result = execute(sql)
62
+ result.any?
63
+ rescue StandardError
64
+ false
65
+ end
42
66
  end
43
67
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PgTypes
4
- VERSION = "0.2.1"
4
+ VERSION = "0.2.3"
5
5
  end
data/lib/pg_types.rb CHANGED
@@ -10,11 +10,20 @@ require_relative "pg_types/schema_dumper"
10
10
  require_relative "pg_types/railtie"
11
11
 
12
12
  module PgTypes
13
+ module_function
14
+
13
15
  class Error < StandardError; end
14
16
 
15
- class << self
16
- def database
17
- ActiveRecord::Base.connection
18
- end
17
+ def load
18
+ # Add schema statements and command recorder
19
+ ActiveRecord::ConnectionAdapters::AbstractAdapter.include PgTypes::SchemaStatements
20
+ ActiveRecord::Migration::CommandRecorder.include PgTypes::CommandRecorder
21
+
22
+ # Hook into the schema dumper
23
+ ActiveRecord::SchemaDumper.prepend PgTypes::SchemaDumper
24
+ end
25
+
26
+ def database
27
+ ActiveRecord::Base.connection
19
28
  end
20
29
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_types
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - mhenrixon
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2024-11-05 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: activerecord
@@ -72,6 +71,8 @@ files:
72
71
  - gemfiles/rails_7.0.gemfile.lock
73
72
  - gemfiles/rails_7.1.gemfile
74
73
  - gemfiles/rails_7.1.gemfile.lock
74
+ - gemfiles/rails_8.0.gemfile
75
+ - gemfiles/rails_8.0.gemfile.lock
75
76
  - lib/generators/pg/type/aggregate_generator.rb
76
77
  - lib/generators/pg/type/templates/migration.rb.erb
77
78
  - lib/generators/pg/type/templates/type.sql.erb
@@ -97,7 +98,6 @@ metadata:
97
98
  rubygems_mfa_required: 'true'
98
99
  github_repo: ssh://github.com/mhenrixon/pg_types
99
100
  funding_uri: https://github.com/sponsors/mhenrixon
100
- post_install_message:
101
101
  rdoc_options: []
102
102
  require_paths:
103
103
  - lib
@@ -112,8 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
112
  - !ruby/object:Gem::Version
113
113
  version: '0'
114
114
  requirements: []
115
- rubygems_version: 3.5.22
116
- signing_key:
115
+ rubygems_version: 3.6.7
117
116
  specification_version: 4
118
117
  summary: Rails integration for PostgreSQL custom types
119
118
  test_files: []