wt_activerecord_index_spy 0.4.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/main.yml +3 -0
  3. data/.rubocop.yml +3 -0
  4. data/CHANGELOG.md +3 -0
  5. data/Rakefile +0 -14
  6. data/lib/wt_activerecord_index_spy/aggregator.rb +29 -4
  7. data/lib/wt_activerecord_index_spy/notification_listener.rb +3 -2
  8. data/lib/wt_activerecord_index_spy/query_analyser/mysql.rb +1 -0
  9. data/lib/wt_activerecord_index_spy/query_analyser/postgres.rb +1 -0
  10. data/lib/wt_activerecord_index_spy/query_analyser.rb +1 -0
  11. data/lib/wt_activerecord_index_spy/test_helpers.rb +1 -0
  12. data/lib/wt_activerecord_index_spy/test_models.rb +1 -0
  13. data/lib/wt_activerecord_index_spy/version.rb +2 -1
  14. data/lib/wt_activerecord_index_spy.rb +2 -0
  15. data/sorbet/config +3 -0
  16. data/sorbet/rbi/gems/activemodel.rbi +839 -0
  17. data/sorbet/rbi/gems/activerecord.rbi +5324 -0
  18. data/sorbet/rbi/gems/activesupport.rbi +1783 -0
  19. data/sorbet/rbi/gems/ast.rbi +49 -0
  20. data/sorbet/rbi/gems/byebug.rbi +1041 -0
  21. data/sorbet/rbi/gems/coderay.rbi +92 -0
  22. data/sorbet/rbi/gems/concurrent-ruby.rbi +1590 -0
  23. data/sorbet/rbi/gems/dotenv.rbi +68 -0
  24. data/sorbet/rbi/gems/faraday.rbi +544 -0
  25. data/sorbet/rbi/gems/gemfury.rbi +135 -0
  26. data/sorbet/rbi/gems/highline.rbi +567 -0
  27. data/sorbet/rbi/gems/i18n.rbi +445 -0
  28. data/sorbet/rbi/gems/method_source.rbi +64 -0
  29. data/sorbet/rbi/gems/minitest.rbi +420 -0
  30. data/sorbet/rbi/gems/multi_json.rbi +62 -0
  31. data/sorbet/rbi/gems/multipart-post.rbi +53 -0
  32. data/sorbet/rbi/gems/mysql2.rbi +114 -0
  33. data/sorbet/rbi/gems/netrc.rbi +51 -0
  34. data/sorbet/rbi/gems/parallel.rbi +83 -0
  35. data/sorbet/rbi/gems/parser.rbi +1431 -0
  36. data/sorbet/rbi/gems/pg.rbi +546 -0
  37. data/sorbet/rbi/gems/progressbar.rbi +14 -0
  38. data/sorbet/rbi/gems/pry-byebug.rbi +155 -0
  39. data/sorbet/rbi/gems/pry.rbi +1949 -0
  40. data/sorbet/rbi/gems/rainbow.rbi +118 -0
  41. data/sorbet/rbi/gems/rake.rbi +662 -0
  42. data/sorbet/rbi/gems/regexp_parser.rbi +926 -0
  43. data/sorbet/rbi/gems/rexml.rbi +599 -0
  44. data/sorbet/rbi/gems/rspec-core.rbi +1961 -0
  45. data/sorbet/rbi/gems/rspec-expectations.rbi +1148 -0
  46. data/sorbet/rbi/gems/rspec-mocks.rbi +1091 -0
  47. data/sorbet/rbi/gems/rspec-support.rbi +280 -0
  48. data/sorbet/rbi/gems/rspec.rbi +15 -0
  49. data/sorbet/rbi/gems/rubocop-ast.rbi +1372 -0
  50. data/sorbet/rbi/gems/rubocop-sorbet.rbi +197 -0
  51. data/sorbet/rbi/gems/rubocop.rbi +8089 -0
  52. data/sorbet/rbi/gems/ruby-progressbar.rbi +303 -0
  53. data/sorbet/rbi/gems/thor.rbi +525 -0
  54. data/sorbet/rbi/gems/tzinfo.rbi +588 -0
  55. data/sorbet/rbi/gems/unicode-display_width.rbi +20 -0
  56. data/sorbet/rbi/gems/zeitwerk.rbi +139 -0
  57. data/sorbet/rbi/hidden-definitions/errors.txt +15220 -0
  58. data/sorbet/rbi/hidden-definitions/hidden.rbi +28001 -0
  59. data/sorbet/rbi/sorbet-typed/lib/activemodel/all/activemodel.rbi +715 -0
  60. data/sorbet/rbi/sorbet-typed/lib/activerecord/>=5/activerecord.rbi +97 -0
  61. data/sorbet/rbi/sorbet-typed/lib/activerecord/>=5.2/activerecord.rbi +29 -0
  62. data/sorbet/rbi/sorbet-typed/lib/activerecord/all/activerecord.rbi +1674 -0
  63. data/sorbet/rbi/sorbet-typed/lib/activerecord/all/model_schema.rbi +79 -0
  64. data/sorbet/rbi/sorbet-typed/lib/activerecord/all/sanitization.rbi +36 -0
  65. data/sorbet/rbi/sorbet-typed/lib/activerecord/~>6.1.0.rc1/activerecord.rbi +502 -0
  66. data/sorbet/rbi/sorbet-typed/lib/activesupport/>=6/activesupport.rbi +37 -0
  67. data/sorbet/rbi/sorbet-typed/lib/activesupport/all/activesupport.rbi +1850 -0
  68. data/sorbet/rbi/sorbet-typed/lib/faraday/all/faraday.rbi +756 -0
  69. data/sorbet/rbi/sorbet-typed/lib/minitest/all/minitest.rbi +108 -0
  70. data/sorbet/rbi/sorbet-typed/lib/rainbow/all/rainbow.rbi +276 -0
  71. data/sorbet/rbi/sorbet-typed/lib/rake/all/rake.rbi +645 -0
  72. data/sorbet/rbi/sorbet-typed/lib/rspec-core/all/rspec-core.rbi +1891 -0
  73. data/sorbet/rbi/sorbet-typed/lib/rubocop/>=1.8/rubocop.rbi +12 -0
  74. data/sorbet/rbi/sorbet-typed/lib/thor/all/thor.rbi +905 -0
  75. data/sorbet/rbi/todo.rbi +10 -0
  76. data/sorbet.md +23 -0
  77. data/wt_activerecord_index_spy.gemspec +3 -0
  78. metadata +106 -2
@@ -0,0 +1,97 @@
1
+ # This file is autogenerated. Do not edit it by hand. Regenerate it with:
2
+ # srb rbi sorbet-typed
3
+ #
4
+ # If you would like to make changes to this file, great! Please upstream any changes you make here:
5
+ #
6
+ # https://github.com/sorbet/sorbet-typed/edit/master/lib/activerecord/>=5/activerecord.rbi
7
+ #
8
+ # typed: strict
9
+
10
+ class ActiveRecord::Base
11
+
12
+ sig do
13
+ params(
14
+ args: T.any(Symbol, T.proc.returns(T.untyped)),
15
+ if: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
16
+ unless: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
17
+ block: T.nilable(T.proc.bind(T.untyped).void)
18
+ ).void
19
+ end
20
+ def self.after_create_commit(
21
+ *args,
22
+ if: nil,
23
+ unless: nil,
24
+ &block
25
+ ); end
26
+
27
+ sig do
28
+ params(
29
+ args: T.any(Symbol, T.proc.returns(T.untyped)),
30
+ if: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
31
+ unless: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
32
+ block: T.nilable(T.proc.bind(T.untyped).void)
33
+ ).void
34
+ end
35
+ def self.after_update_commit(
36
+ *args,
37
+ if: nil,
38
+ unless: nil,
39
+ &block
40
+ ); end
41
+
42
+ sig do
43
+ params(
44
+ args: T.any(Symbol, T.proc.returns(T.untyped)),
45
+ if: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
46
+ unless: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
47
+ block: T.nilable(T.proc.bind(T.untyped).void)
48
+ ).void
49
+ end
50
+ def self.after_destroy_commit(
51
+ *args,
52
+ if: nil,
53
+ unless: nil,
54
+ &block
55
+ ); end
56
+
57
+ sig { params(attribute: T.any(Symbol, String)).void }
58
+ def self.has_secure_token(attribute); end
59
+ end
60
+
61
+ module ActiveRecord::SecureToken
62
+ extend(::ActiveSupport::Concern)
63
+
64
+ mixes_in_class_methods(::ActiveRecord::SecureToken::ClassMethods)
65
+ end
66
+
67
+ module ActiveRecord::Suppressor
68
+ extend(::ActiveSupport::Concern)
69
+
70
+ mixes_in_class_methods(::ActiveRecord::Suppressor::ClassMethods)
71
+
72
+ def save(*_, **_); end
73
+ def save!(*_, **_); end
74
+ end
75
+
76
+ module ActiveRecord::Suppressor::ClassMethods
77
+ def suppress(&block); end
78
+ end
79
+
80
+ module ActiveRecord::SecureToken::ClassMethods
81
+ def generate_unique_secure_token; end
82
+ def has_secure_token(attribute = T.unsafe(nil)); end
83
+ end
84
+
85
+ module ActiveRecord::TouchLater
86
+ extend(::ActiveSupport::Concern)
87
+
88
+ def touch(*names, time: T.unsafe(nil)); end
89
+ def touch_later(*names, **_); end
90
+
91
+ private
92
+
93
+ def belongs_to_touch_method; end
94
+ def has_defer_touch_attrs?; end
95
+ def surreptitiously_touch(attrs); end
96
+ def touch_deferred_attributes; end
97
+ end
@@ -0,0 +1,29 @@
1
+ # This file is autogenerated. Do not edit it by hand. Regenerate it with:
2
+ # srb rbi sorbet-typed
3
+ #
4
+ # If you would like to make changes to this file, great! Please upstream any changes you make here:
5
+ #
6
+ # https://github.com/sorbet/sorbet-typed/edit/master/lib/activerecord/>=5.2/activerecord.rbi
7
+ #
8
+ # typed: strong
9
+
10
+ class ActiveRecord::Base
11
+ extend ActiveRecord::Delegation::DelegateCache
12
+ include ActiveRecord::DefineCallbacks
13
+ include ActiveRecord::TouchLater
14
+ include ActiveRecord::SecureToken
15
+ include ActiveRecord::Suppressor
16
+ end
17
+
18
+ module ActiveRecord::DefineCallbacks
19
+ extend(::ActiveSupport::Concern)
20
+
21
+ include(::ActiveSupport::Callbacks)
22
+ include(::ActiveModel::Validations::Callbacks)
23
+
24
+ mixes_in_class_methods(::ActiveRecord::DefineCallbacks::ClassMethods)
25
+ end
26
+
27
+ module ActiveRecord::DefineCallbacks::ClassMethods
28
+ include(::ActiveModel::Callbacks)
29
+ end
@@ -0,0 +1,1674 @@
1
+ # This file is autogenerated. Do not edit it by hand. Regenerate it with:
2
+ # srb rbi sorbet-typed
3
+ #
4
+ # If you would like to make changes to this file, great! Please upstream any changes you make here:
5
+ #
6
+ # https://github.com/sorbet/sorbet-typed/edit/master/lib/activerecord/all/activerecord.rbi
7
+ #
8
+ # typed: strong
9
+
10
+ VariadicUntypedFunction = T.type_alias { Proc }
11
+ AssociationCallback = T.type_alias do
12
+ # docs in https://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html - jump to "Association callbacks"
13
+ T.nilable(
14
+ T.any(
15
+ Symbol, # reference to a method
16
+ String, # reference to a method? not clear: no string examples in docs
17
+ T.proc.void, # a lambda that contains the callback
18
+ Proc, # a proc that contains the callback
19
+ T::Array[T.any(Symbol, Proc, T.proc.void)] # multiple callbacks
20
+ )
21
+ )
22
+ end
23
+
24
+ class ActiveRecord::ConnectionAdapters::AbstractAdapter; end
25
+ module ActiveRecord::QueryCache::ClassMethods; end
26
+ module ActiveRecord::Querying; end
27
+ module ActiveRecord::Translation; end
28
+ module ActiveRecord::DynamicMatchers; end
29
+ module ActiveRecord::Explain; end
30
+ module ActiveRecord::AttributeAssignment; end
31
+ module ActiveRecord::Integration; end
32
+ module ActiveRecord::CounterCache; end
33
+ module ActiveRecord::Attributes; end
34
+ module ActiveRecord::AttributeDecorators; end
35
+ module ActiveRecord::Locking::Optimistic; end
36
+ module ActiveRecord::Callbacks; end
37
+ module ActiveRecord::Timestamp; end
38
+ module ActiveRecord::Aggregations; end
39
+ module ActiveRecord::NoTouching; end
40
+ module ActiveRecord::Reflection; end
41
+ module ActiveRecord::Serialization; end
42
+ module ActiveRecord::Store; end
43
+
44
+ module ActiveRecord::Associations
45
+ mixes_in_class_methods(::ActiveRecord::Associations::ClassMethods)
46
+ end
47
+
48
+ module ActiveRecord::Associations::ClassMethods
49
+ sig do
50
+ params(
51
+ name: Symbol,
52
+ scope: T.any(T.nilable(T.proc.void), T.nilable(T.proc.params(arg: T.untyped).void)),
53
+ after_add: AssociationCallback,
54
+ after_remove: AssociationCallback,
55
+ anonymous_class: T.nilable(T.any(Symbol, String)),
56
+ as: T.nilable(T.any(Symbol, String)),
57
+ autosave: T.nilable(T::Boolean),
58
+ before_add: AssociationCallback,
59
+ before_remove: AssociationCallback,
60
+ class_name: T.nilable(T.any(Symbol, String)),
61
+ counter_cache: T.nilable(T.any(Symbol, String)),
62
+ dependent: T.nilable(T.any(Symbol, String)),
63
+ extend: T.nilable(T.any(Module, T::Array[Module])),
64
+ foreign_key: T.nilable(T.any(Symbol, String)),
65
+ foreign_type: T.nilable(T.any(Symbol, String)),
66
+ index_errors: T.nilable(T::Boolean),
67
+ inverse_of: T.nilable(T.any(Symbol, String, FalseClass)),
68
+ join_table: T.nilable(T.any(Symbol, String)),
69
+ primary_key: T.nilable(T.any(Symbol, String)),
70
+ source: T.nilable(T.any(Symbol, String)),
71
+ source_type: T.nilable(T.any(Symbol, String)),
72
+ table_name: T.nilable(T.any(Symbol, String)),
73
+ through: T.nilable(T.any(Symbol, String)),
74
+ validate: T.nilable(T::Boolean),
75
+ blk: T.nilable(T.proc.void)
76
+ ).void
77
+ end
78
+ def has_many(
79
+ name,
80
+ scope = nil,
81
+ after_add: nil,
82
+ after_remove: nil,
83
+ anonymous_class: nil,
84
+ as: nil,
85
+ autosave: nil,
86
+ before_add: nil,
87
+ before_remove: nil,
88
+ class_name: nil,
89
+ counter_cache: nil,
90
+ dependent: nil,
91
+ extend: nil,
92
+ foreign_key: nil,
93
+ foreign_type: nil,
94
+ index_errors: nil,
95
+ inverse_of: nil,
96
+ join_table: nil,
97
+ primary_key: nil,
98
+ source: nil,
99
+ source_type: nil,
100
+ table_name: nil,
101
+ through: nil,
102
+ validate: nil,
103
+ &blk
104
+ ); end
105
+
106
+ sig do
107
+ params(
108
+ name: Symbol,
109
+ scope: T.nilable(T.proc.void),
110
+ anonymous_class: T.nilable(T.any(Symbol, String)),
111
+ as: T.nilable(T.any(Symbol, String)),
112
+ autosave: T.nilable(T::Boolean),
113
+ class_name: T.nilable(T.any(Symbol, String)),
114
+ dependent: T.nilable(T.any(Symbol, String)),
115
+ foreign_key: T.nilable(T.any(Symbol, String)),
116
+ foreign_type: T.nilable(T.any(Symbol, String)),
117
+ inverse_of: T.nilable(T.any(Symbol, String, FalseClass)),
118
+ primary_key: T.nilable(T.any(Symbol, String)),
119
+ required: T.nilable(T::Boolean),
120
+ source: T.nilable(T.any(Symbol, String)),
121
+ source_type: T.nilable(T.any(Symbol, String)),
122
+ through: T.nilable(T.any(Symbol, String)),
123
+ validate: T.nilable(T::Boolean),
124
+ touch: T.nilable(T.any(T::Boolean, Symbol)),
125
+ blk: T.nilable(T.proc.void)
126
+ ).void
127
+ end
128
+ def has_one(
129
+ name,
130
+ scope = nil,
131
+ anonymous_class: nil,
132
+ as: nil,
133
+ autosave: nil,
134
+ class_name: nil,
135
+ dependent: nil,
136
+ foreign_key: nil,
137
+ foreign_type: nil,
138
+ inverse_of: nil,
139
+ primary_key: nil,
140
+ required: nil,
141
+ source: nil,
142
+ source_type: nil,
143
+ through: nil,
144
+ validate: nil,
145
+ touch: nil,
146
+ &blk
147
+ ); end
148
+
149
+ sig do
150
+ params(
151
+ name: T.nilable(T.any(Symbol, String)),
152
+ scope: T.nilable(T.proc.void),
153
+ autosave: T.nilable(T::Boolean),
154
+ class_name: T.nilable(T.any(Symbol, String)),
155
+ counter_cache: T.nilable(T.any(Symbol, String, T::Boolean)),
156
+ dependent: T.nilable(T.any(Symbol, String)),
157
+ foreign_key: T.nilable(T.any(Symbol, String)),
158
+ foreign_type: T.nilable(T.any(Symbol, String)),
159
+ inverse_of: T.nilable(T.any(Symbol, String, FalseClass)),
160
+ optional: T.nilable(T::Boolean),
161
+ polymorphic: T.nilable(T::Boolean),
162
+ primary_key: T.nilable(T.any(Symbol, String)),
163
+ required: T.nilable(T::Boolean),
164
+ touch: T.nilable(T.any(T::Boolean, Symbol)),
165
+ validate: T.nilable(T::Boolean),
166
+ default: T.nilable(T.proc.returns(T.untyped))
167
+ ).void
168
+ end
169
+ def belongs_to(
170
+ name,
171
+ scope = nil,
172
+ autosave: nil,
173
+ class_name: nil,
174
+ counter_cache: nil,
175
+ dependent: nil,
176
+ foreign_key: nil,
177
+ foreign_type: nil,
178
+ inverse_of: nil,
179
+ optional: nil,
180
+ polymorphic: nil,
181
+ primary_key: nil,
182
+ required: nil,
183
+ touch: nil,
184
+ validate: nil,
185
+ default: nil
186
+ ); end
187
+
188
+ sig do
189
+ params(
190
+ name: T.nilable(T.any(Symbol, String)),
191
+ scope: T.nilable(T.proc.void),
192
+ after_add: AssociationCallback,
193
+ after_remove: AssociationCallback,
194
+ association_foreign_key: T.nilable(T.any(Symbol, String)),
195
+ autosave: T.nilable(T::Boolean),
196
+ before_add: AssociationCallback,
197
+ before_remove: AssociationCallback,
198
+ class_name: T.nilable(T.any(Symbol, String)),
199
+ extend: T.nilable(T.any(Module, T::Array[Module])),
200
+ foreign_key: T.nilable(T.any(Symbol, String)),
201
+ inverse_of: T.nilable(T.any(Symbol, String, FalseClass)),
202
+ join_table: T.nilable(T.any(Symbol, String)),
203
+ validate: T.nilable(T::Boolean),
204
+ blk: T.nilable(T.proc.void)
205
+ ).void
206
+ end
207
+ def has_and_belongs_to_many(
208
+ name,
209
+ scope = nil,
210
+ after_add: nil,
211
+ after_remove: nil,
212
+ association_foreign_key: nil,
213
+ autosave: nil,
214
+ before_add: nil,
215
+ before_remove: nil,
216
+ class_name: nil,
217
+ extend: nil,
218
+ foreign_key: nil,
219
+ inverse_of: nil,
220
+ join_table: nil,
221
+ validate: nil,
222
+ &blk
223
+ ); end
224
+ end
225
+
226
+ module ActiveRecord::AttributeMethods
227
+ include ActiveModel::AttributeMethods
228
+ end
229
+
230
+ module ActiveRecord::AttributeMethods::Serialization::ClassMethods
231
+ sig { params(attr_name: Symbol, class_name_or_coder: T.untyped).void }
232
+ def serialize(attr_name, class_name_or_coder = Object); end
233
+ end
234
+
235
+ module ActiveRecord::AttributeMethods
236
+ mixes_in_class_methods(::ActiveRecord::AttributeMethods::ClassMethods)
237
+ end
238
+
239
+ module ActiveRecord::AttributeMethods::ClassMethods; end
240
+
241
+ module ActiveRecord::AttributeMethods::PrimaryKey
242
+ mixes_in_class_methods(::ActiveRecord::AttributeMethods::PrimaryKey::ClassMethods)
243
+ end
244
+
245
+ module ActiveRecord::AttributeMethods::PrimaryKey::ClassMethods; end
246
+
247
+ ActiveRecord::AttributeMethods::PrimaryKey::ClassMethods::ID_ATTRIBUTE_METHODS = T.let(T.unsafe(nil), T::Set[T.untyped])
248
+
249
+ ActiveRecord::AttributeMethods::RESTRICTED_CLASS_METHODS = T.let(T.unsafe(nil), T::Array[T.untyped])
250
+
251
+ module ActiveRecord::AttributeMethods::Read
252
+ mixes_in_class_methods(::ActiveRecord::AttributeMethods::Read::ClassMethods)
253
+ end
254
+
255
+ module ActiveRecord::AttributeMethods::Read::ClassMethods; end
256
+
257
+ module ActiveRecord::AttributeMethods::Serialization
258
+ mixes_in_class_methods(::ActiveRecord::AttributeMethods::Serialization::ClassMethods)
259
+ end
260
+
261
+ module ActiveRecord::AttributeMethods::Serialization::ClassMethods; end
262
+
263
+ module ActiveRecord::AttributeMethods::TimeZoneConversion
264
+ mixes_in_class_methods(::ActiveRecord::AttributeMethods::TimeZoneConversion::ClassMethods)
265
+ end
266
+
267
+ module ActiveRecord::AttributeMethods::TimeZoneConversion::ClassMethods; end
268
+
269
+ module ActiveRecord::AttributeMethods::Write
270
+ mixes_in_class_methods(::ActiveRecord::AttributeMethods::Write::ClassMethods)
271
+ end
272
+
273
+ module ActiveRecord::AttributeMethods::Write::ClassMethods; end
274
+
275
+ module ActiveRecord::AutosaveAssociation
276
+ mixes_in_class_methods(::ActiveRecord::AutosaveAssociation::ClassMethods)
277
+ end
278
+
279
+ module ActiveRecord::AutosaveAssociation::ClassMethods; end
280
+
281
+ module ActiveRecord::Core
282
+ mixes_in_class_methods(::ActiveRecord::Core::ClassMethods)
283
+ end
284
+
285
+ module ActiveRecord::Core::ClassMethods; end
286
+
287
+ module ActiveRecord::Tasks::DatabaseTasks
288
+ extend(::ActiveRecord::Tasks::DatabaseTasks)
289
+ end
290
+
291
+ ActiveRecord::Tasks::DatabaseTasks::LOCAL_HOSTS = T.let(T.unsafe(nil), T::Array[T.untyped])
292
+
293
+ module ActiveRecord::Delegation
294
+ mixes_in_class_methods(::ActiveRecord::Delegation::ClassMethods)
295
+ end
296
+
297
+ module ActiveRecord::Delegation::ClassMethods; end
298
+
299
+ module ActiveRecord::Delegation::ClassSpecificRelation
300
+ mixes_in_class_methods(::ActiveRecord::Delegation::ClassSpecificRelation::ClassMethods)
301
+ end
302
+
303
+ module ActiveRecord::Delegation::ClassSpecificRelation::ClassMethods; end
304
+
305
+ ActiveRecord::Migrator::MIGRATOR_SALT = T.let(T.unsafe(nil), Integer)
306
+
307
+ module ActiveRecord::NestedAttributes::ClassMethods
308
+ sig do
309
+ params(
310
+ attr_names: T.any(Symbol, String),
311
+ allow_destroy: T.nilable(T::Boolean),
312
+ reject_if: T.any(Symbol, Proc, T.proc.params(
313
+ attributes: T.any(
314
+ T::Hash[T.any(Symbol, String), T.untyped],
315
+ ActionController::Parameters
316
+ )
317
+ ).returns(T::Boolean)),
318
+ limit: T.any(Integer, Symbol, Proc, T.proc.returns(Integer)),
319
+ update_only: T.nilable(T::Boolean),
320
+ ).void
321
+ end
322
+ def accepts_nested_attributes_for(
323
+ *attr_names,
324
+ allow_destroy: nil,
325
+ reject_if: nil,
326
+ limit: nil,
327
+ update_only: nil
328
+ ); end
329
+ end
330
+
331
+ module ActiveRecord::ReadonlyAttributes
332
+ mixes_in_class_methods(::ActiveRecord::ReadonlyAttributes::ClassMethods)
333
+ end
334
+
335
+ module ActiveRecord::ReadonlyAttributes::ClassMethods; end
336
+ module ActiveRecord::Scoping::Named
337
+ mixes_in_class_methods(::ActiveRecord::Scoping::Named::ClassMethods)
338
+ end
339
+
340
+ module ActiveRecord::Scoping::Named::ClassMethods
341
+ sig do
342
+ params(
343
+ name: T.nilable(T.any(Symbol, String)),
344
+ body: VariadicUntypedFunction,
345
+ block: T.nilable(VariadicUntypedFunction)
346
+ ).void
347
+ end
348
+ def scope(name, body, &block); end
349
+ end
350
+
351
+ module ActiveRecord::Inheritance
352
+ mixes_in_class_methods(ActiveRecord::Inheritance::ClassMethods)
353
+ end
354
+
355
+ module ActiveRecord::Transactions
356
+ mixes_in_class_methods(ActiveRecord::Transactions::ClassMethods)
357
+ end
358
+
359
+ class ActiveRecord::Base
360
+ extend ActiveModel::Naming
361
+
362
+ extend ActiveSupport::Benchmarkable
363
+ extend ActiveSupport::DescendantsTracker
364
+
365
+ extend ActiveRecord::ConnectionHandling
366
+ extend ActiveRecord::QueryCache::ClassMethods
367
+ extend ActiveRecord::Querying
368
+ extend ActiveRecord::Translation
369
+ extend ActiveRecord::DynamicMatchers
370
+ extend ActiveRecord::Explain
371
+ extend ActiveRecord::Enum
372
+
373
+ include ActiveRecord::Core
374
+ include ActiveRecord::Persistence
375
+ include ActiveRecord::ReadonlyAttributes
376
+ include ActiveRecord::ModelSchema
377
+ extend ActiveRecord::ModelSchema::ClassMethods # via ActiveRecord::ModelSchema concern inclusion
378
+ include ActiveRecord::Sanitization
379
+ extend ActiveRecord::Sanitization::ClassMethods # via ActiveRecord::Sanitization concern inclusion
380
+ include ActiveRecord::Inheritance
381
+ include ActiveRecord::Scoping
382
+ include ActiveRecord::Scoping::Default # via ActiveRecord::Scoping#included hook
383
+ include ActiveRecord::Scoping::Named # via ActiveRecord::Scoping#included hook
384
+ extend ActiveRecord::Scoping::Named::ClassMethods # via ActiveRecord::Scoping::Named Concern inclusion
385
+ include ActiveRecord::AttributeAssignment
386
+ include ActiveModel::Conversion
387
+ include ActiveRecord::Integration
388
+ include ActiveModel::Validations
389
+ include ActiveModel::Validations::HelperMethods
390
+ include ActiveRecord::CounterCache
391
+ include ActiveRecord::Attributes
392
+ include ActiveRecord::AttributeDecorators
393
+ include ActiveRecord::Locking::Optimistic
394
+ include ActiveRecord::Locking::Pessimistic
395
+ include ActiveRecord::AttributeMethods
396
+ include ActiveRecord::AttributeMethods::Read # via ActiveRecord::AttributeMethods#included hook
397
+ include ActiveRecord::AttributeMethods::Write # via ActiveRecord::AttributeMethods#included hook
398
+ include ActiveRecord::AttributeMethods::BeforeTypeCast # via ActiveRecord::AttributeMethods#included hook
399
+ include ActiveRecord::AttributeMethods::Query # via ActiveRecord::AttributeMethods#included hook
400
+ include ActiveRecord::AttributeMethods::PrimaryKey # via ActiveRecord::AttributeMethods#included hook
401
+ include ActiveRecord::AttributeMethods::TimeZoneConversion # via ActiveRecord::AttributeMethods#included hook
402
+ include ActiveRecord::AttributeMethods::Dirty # via ActiveRecord::AttributeMethods#included hook
403
+ include ActiveRecord::AttributeMethods::Serialization # via ActiveRecord::AttributeMethods#included hook
404
+ extend ActiveRecord::AttributeMethods::Serialization::ClassMethods # via ActiveRecord::AttributeMethods::Serialization Concern inclusion
405
+ include ActiveRecord::Callbacks
406
+ include ActiveRecord::Timestamp
407
+ include ActiveRecord::Associations
408
+ include ActiveModel::SecurePassword
409
+ include ActiveRecord::AutosaveAssociation
410
+ include ActiveRecord::NestedAttributes
411
+ extend ActiveRecord::NestedAttributes::ClassMethods # via ActiveRecord::NestedAttributes Concern inclusion
412
+ include ActiveRecord::Aggregations
413
+ include ActiveRecord::Transactions
414
+ include ActiveRecord::NoTouching
415
+ include ActiveRecord::Reflection
416
+ include ActiveRecord::Serialization
417
+ include ActiveRecord::Store
418
+
419
+ sig do
420
+ params(
421
+ args: T.any(Symbol, T.proc.returns(T.untyped)),
422
+ if: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
423
+ on: T.nilable(T.any(Symbol, T::Array[Symbol])),
424
+ unless: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
425
+ block: T.nilable(T.proc.bind(T.untyped).void)
426
+ ).void
427
+ end
428
+ def self.after_commit(
429
+ *args,
430
+ if: nil,
431
+ on: nil,
432
+ unless: nil,
433
+ &block
434
+ ); end
435
+
436
+ sig do
437
+ params(
438
+ args: Symbol,
439
+ if: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
440
+ unless: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
441
+ block: T.nilable(T.proc.bind(T.untyped).void)
442
+ ).void
443
+ end
444
+ def self.after_create(
445
+ *args,
446
+ if: nil,
447
+ unless: nil,
448
+ &block
449
+ ); end
450
+
451
+ sig do
452
+ params(
453
+ args: Symbol,
454
+ if: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
455
+ unless: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
456
+ block: T.nilable(T.proc.bind(T.untyped).void)
457
+ ).void
458
+ end
459
+ def self.after_destroy(
460
+ *args,
461
+ if: nil,
462
+ unless: nil,
463
+ &block
464
+ ); end
465
+
466
+ sig do
467
+ params(
468
+ args: Symbol,
469
+ if: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
470
+ unless: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
471
+ block: T.nilable(T.proc.bind(T.untyped).void)
472
+ ).void
473
+ end
474
+ def self.after_rollback(
475
+ *args,
476
+ if: nil,
477
+ unless: nil,
478
+ &block
479
+ ); end
480
+
481
+ sig do
482
+ params(
483
+ args: Symbol,
484
+ if: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
485
+ unless: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
486
+ block: T.nilable(T.proc.bind(T.untyped).void)
487
+ ).void
488
+ end
489
+ def self.after_save(
490
+ *args,
491
+ if: nil,
492
+ unless: nil,
493
+ &block
494
+ ); end
495
+
496
+ sig do
497
+ params(
498
+ args: Symbol,
499
+ if: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
500
+ unless: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
501
+ block: T.nilable(T.proc.bind(T.untyped).void)
502
+ ).void
503
+ end
504
+ def self.after_update(
505
+ *args,
506
+ if: nil,
507
+ unless: nil,
508
+ &block
509
+ ); end
510
+
511
+ sig do
512
+ params(
513
+ args: Symbol,
514
+ if: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
515
+ unless: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
516
+ on: T.nilable(T.any(Symbol, T::Array[Symbol])),
517
+ block: T.nilable(T.proc.bind(T.untyped).void)
518
+ ).void
519
+ end
520
+ def self.after_validation(
521
+ *args,
522
+ if: nil,
523
+ unless: nil,
524
+ on: nil,
525
+ &block
526
+ ); end
527
+
528
+ sig do
529
+ params(
530
+ args: Symbol,
531
+ if: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
532
+ unless: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
533
+ block: T.nilable(T.proc.bind(T.untyped).void)
534
+ ).void
535
+ end
536
+ def self.around_create(
537
+ *args,
538
+ if: nil,
539
+ unless: nil,
540
+ &block
541
+ ); end
542
+
543
+ sig do
544
+ params(
545
+ args: Symbol,
546
+ if: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
547
+ unless: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
548
+ block: T.nilable(T.proc.bind(T.untyped).void)
549
+ ).void
550
+ end
551
+ def self.around_destroy(
552
+ *args,
553
+ if: nil,
554
+ unless: nil,
555
+ &block
556
+ ); end
557
+
558
+ sig do
559
+ params(
560
+ args: Symbol,
561
+ if: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
562
+ unless: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
563
+ block: T.nilable(T.proc.bind(T.untyped).void)
564
+ ).void
565
+ end
566
+ def self.around_save(
567
+ *args,
568
+ if: nil,
569
+ unless: nil,
570
+ &block
571
+ ); end
572
+
573
+ sig do
574
+ params(
575
+ args: Symbol,
576
+ if: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
577
+ unless: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
578
+ block: T.nilable(T.proc.bind(T.untyped).void)
579
+ ).void
580
+ end
581
+ def self.around_update(
582
+ *args,
583
+ if: nil,
584
+ unless: nil,
585
+ &block
586
+ ); end
587
+
588
+ sig do
589
+ params(
590
+ args: Symbol,
591
+ if: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
592
+ unless: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
593
+ block: T.nilable(T.proc.bind(T.untyped).void)
594
+ ).void
595
+ end
596
+ def self.before_create(
597
+ *args,
598
+ if: nil,
599
+ unless: nil,
600
+ &block
601
+ ); end
602
+
603
+ sig do
604
+ params(
605
+ args: Symbol,
606
+ if: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
607
+ unless: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
608
+ prepend: T::Boolean,
609
+ block: T.nilable(T.proc.bind(T.untyped).void)
610
+ ).void
611
+ end
612
+ def self.before_destroy(
613
+ *args,
614
+ if: nil,
615
+ unless: nil,
616
+ prepend: false,
617
+ &block
618
+ ); end
619
+
620
+ sig do
621
+ params(
622
+ args: Symbol,
623
+ if: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
624
+ unless: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
625
+ block: T.nilable(T.proc.bind(T.untyped).void)
626
+ ).void
627
+ end
628
+ def self.before_save(
629
+ *args,
630
+ if: nil,
631
+ unless: nil,
632
+ &block
633
+ ); end
634
+
635
+ sig do
636
+ params(
637
+ args: Symbol,
638
+ if: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
639
+ unless: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
640
+ block: T.nilable(T.proc.bind(T.untyped).void)
641
+ ).void
642
+ end
643
+ def self.before_update(
644
+ *args,
645
+ if: nil,
646
+ unless: nil,
647
+ &block
648
+ ); end
649
+
650
+ sig do
651
+ params(
652
+ args: Symbol,
653
+ if: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
654
+ unless: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
655
+ on: T.nilable(T.any(Symbol, T::Array[Symbol])),
656
+ block: T.nilable(T.proc.bind(T.untyped).void)
657
+ ).void
658
+ end
659
+ def self.before_validation(
660
+ *args,
661
+ if: nil,
662
+ unless: nil,
663
+ on: nil,
664
+ &block
665
+ ); end
666
+
667
+ sig { params(comparison_object: T.untyped).returns(T::Boolean) }
668
+ def ==(comparison_object); end
669
+ end
670
+
671
+ module ActiveRecord::Inheritance::ClassMethods
672
+ sig { params(value: T::Boolean).void }
673
+ def abstract_class=(value); end
674
+
675
+ sig { returns(T::Boolean) }
676
+ def abstract_class; end
677
+ end
678
+
679
+ module ActiveRecord::Transactions::ClassMethods
680
+ sig do
681
+ params(
682
+ options: T.nilable(T::Hash[T.any(Symbol, String), T.untyped]),
683
+ block: T.proc.returns(T.untyped)
684
+ ).returns(T.untyped)
685
+ end
686
+ def transaction(options = {}, &block); end
687
+ end
688
+
689
+ module ActiveRecord::Persistence
690
+ mixes_in_class_methods(ActiveRecord::Persistence::ClassMethods)
691
+
692
+ sig { params(klass: Class).returns(T.untyped) }
693
+ def becomes!(klass); end
694
+
695
+ sig { params(klass: Class).returns(T.untyped) }
696
+ def becomes(klass); end
697
+
698
+ sig do
699
+ params(
700
+ attribute: T.any(Symbol, String),
701
+ by: T.nilable(Integer),
702
+ touch: T.nilable(T::Boolean)
703
+ ).returns(T.self_type)
704
+ end
705
+ def decrement!(attribute, by = 1, touch: nil); end
706
+
707
+ sig do
708
+ params(
709
+ attribute: T.any(Symbol, String),
710
+ by: T.nilable(Integer)
711
+ ).returns(T.self_type)
712
+ end
713
+ def decrement(attribute, by = 1); end
714
+
715
+ sig { returns(T.self_type) }
716
+ def delete; end
717
+
718
+ sig { returns(T.any(T.self_type, FalseClass)) }
719
+ def destroy; end
720
+
721
+ sig { returns(T.self_type) }
722
+ def destroy!; end
723
+
724
+ sig { returns(T::Boolean) }
725
+ def destroyed?(); end
726
+
727
+ sig do
728
+ params(
729
+ attribute: T.any(Symbol, String),
730
+ by: T.nilable(Integer),
731
+ touch: T.nilable(T::Boolean)
732
+ ).returns(T.self_type)
733
+ end
734
+ def increment!(attribute, by = 1, touch: nil); end
735
+
736
+ sig do
737
+ params(
738
+ attribute: T.any(Symbol, String),
739
+ by: T.nilable(Integer)
740
+ ).returns(T.self_type)
741
+ end
742
+ def increment(attribute, by = 1); end
743
+
744
+ sig { returns(T::Boolean) }
745
+ def new_record?(); end
746
+
747
+ sig { returns(T::Boolean) }
748
+ def persisted?(); end
749
+
750
+ sig do
751
+ params(
752
+ options: T.nilable({ lock: T.nilable(T::Boolean) })
753
+ ).returns(T.self_type)
754
+ end
755
+ def reload(options = nil); end
756
+
757
+ sig do
758
+ params(
759
+ args: T.untyped,
760
+ blk: T.nilable(T.proc.void),
761
+ ).returns(TrueClass)
762
+ end
763
+ def save!(*args, &blk); end
764
+
765
+ sig do
766
+ params(
767
+ args: T.untyped,
768
+ blk: T.nilable(T.proc.void),
769
+ ).returns(T::Boolean)
770
+ end
771
+ def save(*args, &blk); end
772
+
773
+ sig { params(attribute: T.any(Symbol, String)).returns(TrueClass) }
774
+ def toggle!(attribute); end
775
+
776
+ sig { params(attribute: T.any(Symbol, String)).returns(T.self_type) }
777
+ def toggle(attribute); end
778
+
779
+ sig do
780
+ params(
781
+ names: T.any(
782
+ Symbol,
783
+ String,
784
+ T::Array[T.any(Symbol, String)]
785
+ ),
786
+ time: T.nilable(Time)
787
+ ).returns(T::Boolean)
788
+ end
789
+ def touch(*names, time: nil); end
790
+
791
+ sig do
792
+ params(
793
+ name: T.any(Symbol, String),
794
+ value: T.untyped,
795
+ ).returns(T::Boolean)
796
+ end
797
+ def update_attribute(name, value); end
798
+
799
+ sig do
800
+ params(
801
+ name: T.any(Symbol, String),
802
+ value: T.untyped,
803
+ ).returns(T::Boolean)
804
+ end
805
+ def update_column(name, value); end
806
+
807
+ sig do
808
+ params(
809
+ attributes: T::Hash[T.any(Symbol, String), T.untyped]
810
+ ).returns(T::Boolean)
811
+ end
812
+ def update_columns(attributes); end
813
+
814
+ sig do
815
+ params(
816
+ attributes: T.any(
817
+ T::Hash[T.any(Symbol, String), T.untyped],
818
+ ActionController::Parameters
819
+ )
820
+ ).returns(TrueClass)
821
+ end
822
+ def update!(attributes); end
823
+
824
+ # update_attributes! is an alias of update!
825
+ sig do
826
+ params(
827
+ attributes: T.any(
828
+ T::Hash[T.any(Symbol, String), T.untyped],
829
+ ActionController::Parameters
830
+ )
831
+ ).returns(TrueClass)
832
+ end
833
+ def update_attributes!(attributes); end
834
+
835
+ sig do
836
+ params(
837
+ attributes: T.any(
838
+ T::Hash[T.any(Symbol, String), T.untyped],
839
+ ActionController::Parameters
840
+ )
841
+ ).returns(T::Boolean)
842
+ end
843
+ def update(attributes); end
844
+
845
+ # update_attributes is an alias of update
846
+ sig do
847
+ params(
848
+ attributes: T.any(
849
+ T::Hash[T.any(Symbol, String), T.untyped],
850
+ ActionController::Parameters
851
+ )
852
+ ).returns(T::Boolean)
853
+ end
854
+ def update_attributes(attributes); end
855
+
856
+ sig do
857
+ params(
858
+ attributes: T.any(
859
+ T::Hash[T.any(Symbol, String), T.untyped],
860
+ ActionController::Parameters
861
+ )
862
+ ).void
863
+ end
864
+ def assign_attributes(attributes); end
865
+ end
866
+
867
+ module ActiveRecord::Persistence::ClassMethods
868
+ sig do
869
+ params(
870
+ attributes: T.nilable(T.any(
871
+ T::Hash[T.any(Symbol, String), T.untyped],
872
+ T::Array[T::Hash[T.any(Symbol, String), T.untyped]]
873
+ )),
874
+ blk: T.nilable(T.proc.params(arg0: T.untyped).returns(T.untyped))
875
+ ).returns(T.untyped)
876
+ end
877
+ def create!(attributes = nil, &blk); end
878
+
879
+ sig do
880
+ params(
881
+ attributes: T.nilable(T.any(
882
+ T::Hash[T.any(Symbol, String), T.untyped],
883
+ T::Array[T::Hash[T.any(Symbol, String), T.untyped]]
884
+ )),
885
+ blk: T.nilable(T.proc.params(arg0: T.untyped).returns(T.untyped))
886
+ ).returns(T.untyped)
887
+ end
888
+ def create(attributes = nil, &blk); end
889
+
890
+ sig do
891
+ params(
892
+ id_or_array: T.any(T.untyped, T::Array[T.untyped])
893
+ ).returns(T.untyped)
894
+ end
895
+ def delete(id_or_array); end
896
+
897
+ sig do
898
+ params(
899
+ id_or_array: T.any(T.untyped, T::Array[T.untyped])
900
+ ).returns(T.untyped)
901
+ end
902
+ def destroy!(id_or_array); end
903
+
904
+ sig do
905
+ params(
906
+ id_or_array: T.any(T.untyped, T::Array[T.untyped])
907
+ ).returns(T.untyped)
908
+ end
909
+ def destroy(id_or_array); end
910
+
911
+ sig do
912
+ params(
913
+ attributes: T::Array[T::Hash[T.any(Symbol, String), T.untyped]],
914
+ returning: T.nilable(T.any(FalseClass, T::Array[T.any(Symbol, String)]))
915
+ ).returns(ActiveRecord::Result)
916
+ end
917
+ def insert_all!(attributes, returning: nil); end
918
+
919
+ sig do
920
+ params(
921
+ attributes: T::Array[T::Hash[T.any(Symbol, String), T.untyped]],
922
+ returning: T.nilable(T.any(FalseClass, T::Array[T.any(Symbol, String)])),
923
+ unique_by: T.nilable(T.untyped)
924
+ ).returns(ActiveRecord::Result)
925
+ end
926
+ def insert_all(attributes, returning: nil, unique_by: nil); end
927
+
928
+ sig do
929
+ params(
930
+ attributes: T::Hash[T.any(Symbol, String), T.untyped],
931
+ returning: T.nilable(T.any(FalseClass, T::Array[T.any(Symbol, String)])),
932
+ unique_by: T.nilable(T.untyped)
933
+ ).returns(ActiveRecord::Result)
934
+ end
935
+ def insert!(attributes, returning: nil, unique_by: nil); end
936
+
937
+ sig do
938
+ params(
939
+ attributes: T::Hash[T.any(Symbol, String), T.untyped],
940
+ returning: T.nilable(T.any(FalseClass, T::Array[T.any(Symbol, String)])),
941
+ unique_by: T.nilable(T.untyped)
942
+ ).returns(ActiveRecord::Result)
943
+ end
944
+ def insert(attributes, returning: nil, unique_by: nil); end
945
+
946
+ sig { params(attributes: T.untyped, column_types: T::Hash[T.untyped, T.untyped], blk: T.proc.void).returns(T.untyped) }
947
+ def instantiate(attributes, column_types = {}, &blk); end
948
+
949
+ # The 'attributes' parameter can take either a hash or an array of hashes.
950
+ sig do
951
+ params(
952
+ id: T.any(T.untyped, T::Array[T.untyped], Symbol),
953
+ attributes: T.any(
954
+ T::Hash[T.any(Symbol, String), T.untyped],
955
+ T::Array[T::Hash[T.any(Symbol, String), T.untyped]]
956
+ )
957
+ ).returns(T.any(T::Array[T.untyped], T.untyped))
958
+ end
959
+ def update(id = :all, attributes); end
960
+
961
+ sig do
962
+ params(
963
+ attributes: T::Array[T::Hash[T.any(Symbol, String), T.untyped]],
964
+ returning: T.nilable(T.any(FalseClass, T::Array[T.any(Symbol, String)])),
965
+ unique_by: T.nilable(T.untyped)
966
+ ).returns(ActiveRecord::Result)
967
+ end
968
+ def upsert_all(attributes, returning: nil, unique_by: nil); end
969
+
970
+ sig do
971
+ params(
972
+ attributes: T::Hash[T.any(Symbol, String), T.untyped],
973
+ returning: T.nilable(T.any(FalseClass, T::Array[T.any(Symbol, String)])),
974
+ unique_by: T.nilable(T.untyped)
975
+ ).returns(ActiveRecord::Result)
976
+ end
977
+ def upsert(attributes, returning: nil, unique_by: nil); end
978
+ end
979
+
980
+ class ActiveRecord::Result
981
+ include(::Enumerable)
982
+ Elem = type_member(fixed: T.untyped)
983
+ end
984
+
985
+ ActiveRecord::Type::BigInteger = ActiveModel::Type::BigInteger
986
+ ActiveRecord::Type::Binary = ActiveModel::Type::Binary
987
+ ActiveRecord::Type::Boolean = ActiveModel::Type::Boolean
988
+ ActiveRecord::Type::Boolean = ActiveModel::Type::Boolean
989
+ ActiveRecord::Type::Decimal = ActiveModel::Type::Decimal
990
+ ActiveRecord::Type::Float = ActiveModel::Type::Float
991
+ ActiveRecord::Type::Integer = ActiveModel::Type::Integer
992
+ ActiveRecord::Type::String = ActiveModel::Type::String
993
+ ActiveRecord::Type::String = ActiveModel::Type::String
994
+ ActiveRecord::Type::Value = ActiveModel::Type::Value
995
+ ActiveRecord::Type::Value = ActiveModel::Type::Value
996
+
997
+ module ActiveRecord
998
+ class ActiveRecordError < StandardError; end
999
+ class AdapterNotFound < ActiveRecordError; end
1000
+ class AdapterNotSpecified < ActiveRecordError; end
1001
+ class AmbiguousSourceReflectionForThroughAssociation < ActiveRecordError; end
1002
+ class AssociationNotFoundError < ConfigurationError; end
1003
+ class AssociationTypeMismatch < ActiveRecordError; end
1004
+ class AttributeAssignmentError < ActiveRecordError; end
1005
+ class ConcurrentMigrationError < MigrationError; end
1006
+ class ConfigurationError < ActiveRecordError; end
1007
+ class ConnectionNotEstablished < ActiveRecordError; end
1008
+ class ConnectionTimeoutError < ConnectionNotEstablished; end
1009
+ class DangerousAttributeError < ActiveRecordError; end
1010
+ class Deadlocked < TransactionRollbackError; end
1011
+ class DeleteRestrictionError < ActiveRecordError; end
1012
+ class DuplicateMigrationNameError < MigrationError; end
1013
+ class DuplicateMigrationVersionError < MigrationError; end
1014
+ class EagerLoadPolymorphicError < ActiveRecordError; end
1015
+ class EnvironmentMismatchError < ActiveRecordError; end
1016
+ class ExclusiveConnectionTimeoutError < ConnectionTimeoutError; end
1017
+ class FixtureClassNotFound < ActiveRecordError; end
1018
+ class HasManyThroughAssociationNotFoundError < ActiveRecordError; end
1019
+ class HasManyThroughAssociationPointlessSourceTypeError < ActiveRecordError; end
1020
+ class HasManyThroughAssociationPolymorphicSourceError < ActiveRecordError; end
1021
+ class HasManyThroughAssociationPolymorphicThroughError < ActiveRecordError; end
1022
+ class HasManyThroughCantAssociateThroughHasOneOrManyReflection < ThroughCantAssociateThroughHasOneOrManyReflection; end
1023
+ class HasManyThroughNestedAssociationsAreReadonly < ThroughNestedAssociationsAreReadonly; end
1024
+ class HasManyThroughOrderError < ActiveRecordError; end
1025
+ class HasManyThroughSourceAssociationNotFoundError < ActiveRecordError; end
1026
+ class HasOneAssociationPolymorphicThroughError < ActiveRecordError; end
1027
+ class HasOneThroughCantAssociateThroughCollection < ActiveRecordError; end
1028
+ class HasOneThroughCantAssociateThroughHasOneOrManyReflection < ThroughCantAssociateThroughHasOneOrManyReflection; end
1029
+ class HasOneThroughNestedAssociationsAreReadonly < ThroughNestedAssociationsAreReadonly; end
1030
+ class IllegalMigrationNameError < MigrationError; end
1031
+ class ImmutableRelation < ActiveRecordError; end
1032
+ class InvalidForeignKey < WrappedDatabaseException; end
1033
+ class InverseOfAssociationNotFoundError < ActiveRecordError; end
1034
+ class IrreversibleMigration < MigrationError; end
1035
+ class IrreversibleOrderError < ActiveRecordError; end
1036
+ class LockWaitTimeout < StatementInvalid; end
1037
+ class MigrationError < ActiveRecordError; end
1038
+ class MismatchedForeignKey < StatementInvalid; end
1039
+ class MultiparameterAssignmentErrors < ActiveRecordError; end
1040
+ class NoDatabaseError < StatementInvalid; end
1041
+ class NoEnvironmentInSchemaError < MigrationError; end
1042
+ class NotNullViolation < StatementInvalid; end
1043
+ class PendingMigrationError < MigrationError; end
1044
+ class PreparedStatementCacheExpired < StatementInvalid; end
1045
+ class PreparedStatementInvalid < ActiveRecordError; end
1046
+ class ProtectedEnvironmentError < ActiveRecordError; end
1047
+ class RangeError < StatementInvalid; end
1048
+ class ReadOnlyRecord < ActiveRecordError; end
1049
+
1050
+ class RecordInvalid < ActiveRecordError
1051
+ def record; end
1052
+ end
1053
+
1054
+ class RecordNotDestroyed < ActiveRecordError; end
1055
+ class RecordNotFound < ActiveRecordError; end
1056
+ class RecordNotSaved < ActiveRecordError; end
1057
+ class RecordNotUnique < WrappedDatabaseException; end
1058
+ class Rollback < ActiveRecordError; end
1059
+ class SerializationFailure < TransactionRollbackError; end
1060
+ class SerializationTypeMismatch < ActiveRecordError; end
1061
+ class StaleObjectError < ActiveRecordError; end
1062
+ class StatementInvalid < ActiveRecordError; end
1063
+ class SubclassNotFound < ActiveRecordError; end
1064
+ class ThroughCantAssociateThroughHasOneOrManyReflection < ActiveRecordError; end
1065
+ class ThroughNestedAssociationsAreReadonly < ActiveRecordError; end
1066
+ class TransactionIsolationError < ActiveRecordError; end
1067
+ class TransactionRollbackError < StatementInvalid; end
1068
+ class TypeConflictError < StandardError; end
1069
+ UnknownAttributeError = ActiveModel::UnknownAttributeError
1070
+ class UnknownAttributeReference < ActiveRecordError; end
1071
+ class UnknownMigrationVersionError < MigrationError; end
1072
+ class UnknownPrimaryKey < ActiveRecordError; end
1073
+ class ValueTooLong < StatementInvalid; end
1074
+ class WrappedDatabaseException < StatementInvalid; end
1075
+ end
1076
+
1077
+ class ActiveRecord::Migration
1078
+ MigrationFilenameRegexp = T.let(T.unsafe(nil), Regexp)
1079
+ end
1080
+
1081
+ class ActiveRecord::Schema < ActiveRecord::Migration::Current
1082
+ sig {params(info: T::Hash[T.untyped, T.untyped], blk: T.proc.bind(ActiveRecord::Schema).void).void}
1083
+ def self.define(info = nil, &blk); end
1084
+ end
1085
+
1086
+ module ActiveRecord::AttributeMethods::Dirty
1087
+ extend T::Sig
1088
+ sig { params(attr_name: T.any(String, Symbol), options: T.untyped).returns(T::Boolean) }
1089
+ def saved_change_to_attribute?(attr_name, **options); end
1090
+ end
1091
+
1092
+ module ActiveRecord::Associations
1093
+ mixes_in_class_methods(ActiveRecord::Associations::ClassMethods)
1094
+ end
1095
+
1096
+ # Represents the schema of an SQL table in an abstract way. This class
1097
+ # provides methods for manipulating the schema representation.
1098
+ #
1099
+ # Inside migration files, the `t` object in `create_table`
1100
+ # is actually of this type:
1101
+ #
1102
+ # ```ruby
1103
+ # class SomeMigration < ActiveRecord::Migration[5.0]
1104
+ # def up
1105
+ # create_table :foo do |t|
1106
+ # puts t.class # => "ActiveRecord::ConnectionAdapters::TableDefinition"
1107
+ # end
1108
+ # end
1109
+ #
1110
+ # def down
1111
+ # # ...
1112
+ # end
1113
+ # end
1114
+ # ```
1115
+ class ActiveRecord::ConnectionAdapters::TableDefinition
1116
+ include ActiveRecord::ConnectionAdapters::ColumnMethods
1117
+
1118
+ # Returns an array of ColumnDefinition objects for the columns of the table.
1119
+ sig { returns(T::Array[ActiveRecord::ConnectionAdapters::ColumnDefinition]) }
1120
+ def columns; end
1121
+
1122
+ # Returns a ColumnDefinition for the column with name `name`.
1123
+ sig { params(name: T.any(String, Symbol)).returns(ActiveRecord::ConnectionAdapters::ColumnDefinition) }
1124
+ def [](name); end
1125
+
1126
+ sig do
1127
+ params(
1128
+ name: T.any(String, Symbol),
1129
+ type: T.untyped,
1130
+ index: T.any(T::Hash[T.untyped, T.untyped], T::Boolean),
1131
+ default: T.untyped,
1132
+ options: T.untyped
1133
+ ).returns(T.self_type)
1134
+ end
1135
+ def column(
1136
+ name,
1137
+ type,
1138
+ index: nil,
1139
+ default: nil,
1140
+ **options
1141
+ ); end
1142
+
1143
+ # Remove the column `name` from the table.
1144
+ #
1145
+ # ```ruby
1146
+ # remove_column(:account_id)
1147
+ # ```
1148
+ sig { params(name: T.any(String, Symbol)).void }
1149
+ def remove_column(name); end
1150
+
1151
+ # Adds index options to the indexes hash, keyed by column name
1152
+ # This is primarily used to track indexes that need to be created after the table
1153
+ #
1154
+ # ```ruby
1155
+ # index(:account_id, name: 'index_projects_on_account_id')
1156
+ # ```
1157
+ sig do
1158
+ params(
1159
+ column_name: T.any(String, Symbol, T::Array[T.any(String, Symbol)]),
1160
+ options: T.untyped
1161
+ ).void
1162
+ end
1163
+ def index(column_name, options = {}); end
1164
+
1165
+ # Appends `:datetime` columns `:created_at` and
1166
+ # `:updated_at` to the table.
1167
+ #
1168
+ # ```ruby
1169
+ # t.timestamps null: false
1170
+ # ```
1171
+ sig { params(options: T.untyped).void }
1172
+ def timestamps(**options); end
1173
+
1174
+ # Adds a reference.
1175
+ #
1176
+ # ```ruby
1177
+ # t.references(:user)
1178
+ # t.belongs_to(:supplier, foreign_key: true)
1179
+ # t.belongs_to(:supplier, foreign_key: true, type: :integer)
1180
+ # ```
1181
+ sig { params(args: T.untyped, options: T.untyped).void }
1182
+ def references(*args, **options); end
1183
+
1184
+ # Adds a reference.
1185
+ #
1186
+ # ```ruby
1187
+ # t.references(:user)
1188
+ # t.belongs_to(:supplier, foreign_key: true)
1189
+ # t.belongs_to(:supplier, foreign_key: true, type: :integer)
1190
+ # ```
1191
+ sig { params(args: T.untyped, options: T.untyped).void }
1192
+ def belongs_to(*args, **options); end
1193
+ end
1194
+
1195
+ module ActiveRecord::ConnectionAdapters::ColumnMethods
1196
+ # Appends a primary key definition to the table definition.
1197
+ # Can be called multiple times, but this is probably not a good idea.
1198
+ sig do
1199
+ params(
1200
+ name: T.any(String, Symbol),
1201
+ type: T.any(String, Symbol),
1202
+ options: T.untyped
1203
+ ).void
1204
+ end
1205
+ def primary_key(name, type = :primary_key, **options); end
1206
+
1207
+ ########
1208
+ # NOTE: The following methods are all generated dynamically and have the same parameters.
1209
+ # See https://github.com/rails/rails/blob/v6.0.0/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb#L217
1210
+ ########
1211
+
1212
+ sig do
1213
+ params(
1214
+ names: T.any(String, Symbol),
1215
+ index: T.any(T::Hash[T.untyped, T.untyped], T::Boolean),
1216
+ default: T.untyped,
1217
+ options: T.untyped
1218
+ ).void
1219
+ end
1220
+ def bigint(*names, index: nil, default: nil, **options); end
1221
+
1222
+ sig do
1223
+ params(
1224
+ names: T.any(String, Symbol),
1225
+ index: T.any(T::Hash[T.untyped, T.untyped], T::Boolean),
1226
+ default: T.untyped,
1227
+ options: T.untyped
1228
+ ).void
1229
+ end
1230
+ def binary(*names, index: nil, default: nil, **options); end
1231
+
1232
+ sig do
1233
+ params(
1234
+ names: T.any(String, Symbol),
1235
+ index: T.any(T::Hash[T.untyped, T.untyped], T::Boolean),
1236
+ default: T.untyped,
1237
+ options: T.untyped
1238
+ ).void
1239
+ end
1240
+ def boolean(*names, index: nil, default: nil, **options); end
1241
+
1242
+ sig do
1243
+ params(
1244
+ names: T.any(String, Symbol),
1245
+ index: T.any(T::Hash[T.untyped, T.untyped], T::Boolean),
1246
+ default: T.untyped,
1247
+ options: T.untyped
1248
+ ).void
1249
+ end
1250
+ def date(*names, index: nil, default: nil, **options); end
1251
+
1252
+ sig do
1253
+ params(
1254
+ names: T.any(String, Symbol),
1255
+ index: T.any(T::Hash[T.untyped, T.untyped], T::Boolean),
1256
+ default: T.untyped,
1257
+ options: T.untyped
1258
+ ).void
1259
+ end
1260
+ def datetime(*names, index: nil, default: nil, **options); end
1261
+
1262
+ sig do
1263
+ params(
1264
+ names: T.any(String, Symbol),
1265
+ index: T.any(T::Hash[T.untyped, T.untyped], T::Boolean),
1266
+ default: T.untyped,
1267
+ options: T.untyped
1268
+ ).void
1269
+ end
1270
+ def decimal(*names, index: nil, default: nil, **options); end
1271
+
1272
+ sig do
1273
+ params(
1274
+ names: T.any(String, Symbol),
1275
+ index: T.any(T::Hash[T.untyped, T.untyped], T::Boolean),
1276
+ default: T.untyped,
1277
+ options: T.untyped
1278
+ ).void
1279
+ end
1280
+ def numeric(*names, index: nil, default: nil, **options); end
1281
+
1282
+ sig do
1283
+ params(
1284
+ names: T.any(String, Symbol),
1285
+ index: T.any(T::Hash[T.untyped, T.untyped], T::Boolean),
1286
+ default: T.untyped,
1287
+ options: T.untyped
1288
+ ).void
1289
+ end
1290
+ def float(*names, index: nil, default: nil, **options); end
1291
+
1292
+ sig do
1293
+ params(
1294
+ names: T.any(String, Symbol),
1295
+ index: T.any(T::Hash[T.untyped, T.untyped], T::Boolean),
1296
+ default: T.untyped,
1297
+ options: T.untyped
1298
+ ).void
1299
+ end
1300
+ def integer(*names, index: nil, default: nil, **options); end
1301
+
1302
+ sig do
1303
+ params(
1304
+ names: T.any(String, Symbol),
1305
+ index: T.any(T::Hash[T.untyped, T.untyped], T::Boolean),
1306
+ default: T.untyped,
1307
+ options: T.untyped
1308
+ ).void
1309
+ end
1310
+ def json(*names, index: nil, default: nil, **options); end
1311
+
1312
+ sig do
1313
+ params(
1314
+ names: T.any(String, Symbol),
1315
+ index: T.any(T::Hash[T.untyped, T.untyped], T::Boolean),
1316
+ default: T.untyped,
1317
+ options: T.untyped
1318
+ ).void
1319
+ end
1320
+ def string(*names, index: nil, default: nil, **options); end
1321
+
1322
+ sig do
1323
+ params(
1324
+ names: T.any(String, Symbol),
1325
+ index: T.any(T::Hash[T.untyped, T.untyped], T::Boolean),
1326
+ default: T.untyped,
1327
+ options: T.untyped
1328
+ ).void
1329
+ end
1330
+ def text(*names, index: nil, default: nil, **options); end
1331
+
1332
+ sig do
1333
+ params(
1334
+ names: T.any(String, Symbol),
1335
+ index: T.any(T::Hash[T.untyped, T.untyped], T::Boolean),
1336
+ default: T.untyped,
1337
+ options: T.untyped
1338
+ ).void
1339
+ end
1340
+ def time(*names, index: nil, default: nil, **options); end
1341
+
1342
+ sig do
1343
+ params(
1344
+ names: T.any(String, Symbol),
1345
+ index: T.any(T::Hash[T.untyped, T.untyped], T::Boolean),
1346
+ default: T.untyped,
1347
+ options: T.untyped
1348
+ ).void
1349
+ end
1350
+ def timestamp(*names, index: nil, default: nil, **options); end
1351
+
1352
+ sig do
1353
+ params(
1354
+ names: T.any(String, Symbol),
1355
+ index: T.any(T::Hash[T.untyped, T.untyped], T::Boolean),
1356
+ default: T.untyped,
1357
+ options: T.untyped
1358
+ ).void
1359
+ end
1360
+ def virtual(*names, index: nil, default: nil, **options); end
1361
+ end
1362
+
1363
+ # Represents an SQL table in an abstract way for updating a table.
1364
+ #
1365
+ # Available transformations are:
1366
+ #
1367
+ # ```ruby
1368
+ # change_table :table do |t|
1369
+ # t.primary_key
1370
+ # t.column
1371
+ # t.index
1372
+ # t.rename_index
1373
+ # t.timestamps
1374
+ # t.change
1375
+ # t.change_default
1376
+ # t.rename
1377
+ # t.references
1378
+ # t.belongs_to
1379
+ # t.string
1380
+ # t.text
1381
+ # t.integer
1382
+ # t.bigint
1383
+ # t.float
1384
+ # t.decimal
1385
+ # t.numeric
1386
+ # t.datetime
1387
+ # t.timestamp
1388
+ # t.time
1389
+ # t.date
1390
+ # t.binary
1391
+ # t.boolean
1392
+ # t.foreign_key
1393
+ # t.json
1394
+ # t.virtual
1395
+ # t.remove
1396
+ # t.remove_foreign_key
1397
+ # t.remove_references
1398
+ # t.remove_belongs_to
1399
+ # t.remove_index
1400
+ # t.remove_timestamps
1401
+ # end
1402
+ # ```
1403
+ class ActiveRecord::ConnectionAdapters::Table
1404
+ include ActiveRecord::ConnectionAdapters::ColumnMethods
1405
+
1406
+ # Adds a new column to the named table.
1407
+ #
1408
+ # ```ruby
1409
+ # t.column(:name, :string)
1410
+ # ```
1411
+ sig { params(column_name: T.any(String, Symbol), type: Symbol, options: T.untyped).void }
1412
+ def column(column_name, type, **options); end
1413
+
1414
+ # Checks to see if a column exists.
1415
+ #
1416
+ # ```ruby
1417
+ # t.string(:name) unless t.column_exists?(:name, :string)
1418
+ # ```
1419
+ sig { params(column_name: T.any(String, Symbol), type: Symbol, options: T.untyped).returns(T::Boolean) }
1420
+ def column_exists?(column_name, type = nil, options = {}); end
1421
+
1422
+ # Adds a new index to the table. `column_name` can be a single Symbol, or
1423
+ # an Array of Symbols.
1424
+ #
1425
+ # ```ruby
1426
+ # t.index(:name)
1427
+ # t.index([:branch_id, :party_id], unique: true)
1428
+ # t.index([:branch_id, :party_id], unique: true, name: 'by_branch_party')
1429
+ # ```
1430
+ sig do
1431
+ params(
1432
+ column_name: T.any(String, Symbol, T::Array[T.any(String, Symbol)]),
1433
+ options: T.untyped
1434
+ ).void
1435
+ end
1436
+ def index(column_name, options = {}); end
1437
+
1438
+ # Checks to see if an index exists.
1439
+ #
1440
+ # ```ruby
1441
+ # unless t.index_exists?(:branch_id)
1442
+ # t.index(:branch_id)
1443
+ # end
1444
+ # ```
1445
+ sig { params(column_name: T.any(String, Symbol), options: T.untyped).returns(T::Boolean) }
1446
+ def index_exists?(column_name, options = {}); end
1447
+
1448
+ # Renames the given index on the table.
1449
+ #
1450
+ # ```ruby
1451
+ # t.rename_index(:user_id, :account_id)
1452
+ # ```
1453
+ sig { params(index_name: T.any(String, Symbol), new_index_name: T.any(String, Symbol)).void }
1454
+ def rename_index(index_name, new_index_name); end
1455
+
1456
+ # Adds timestamps (`created_at` and `updated_at`) columns to the table.
1457
+ #
1458
+ # ```ruby
1459
+ # t.timestamps(null: false)
1460
+ # ```
1461
+ def timestamps(options = {}); end
1462
+
1463
+ # Changes the column's definition according to the new options.
1464
+ #
1465
+ # ```ruby
1466
+ # t.change(:name, :string, limit: 80)
1467
+ # t.change(:description, :text)
1468
+ # ```
1469
+ sig { params(column_name: T.any(String, Symbol), type: Symbol, options: T.untyped).void }
1470
+ def change(column_name, type, options = {}); end
1471
+
1472
+ # Sets a new default value for a column.
1473
+ #
1474
+ # ```ruby
1475
+ # t.change_default(:qualification, 'new')
1476
+ # t.change_default(:authorized, 1)
1477
+ # t.change_default(:status, from: nil, to: "draft")
1478
+ # ```
1479
+ sig { params(column_name: T.any(String, Symbol), default_or_changes: T.untyped).void }
1480
+ def change_default(column_name, default_or_changes); end
1481
+
1482
+ # Removes the column(s) from the table definition.
1483
+ #
1484
+ # ```ruby
1485
+ # t.remove(:qualification)
1486
+ # t.remove(:qualification, :experience)
1487
+ # ```
1488
+ sig { params(column_names: T.any(String, Symbol)).void }
1489
+ def remove(*column_names); end
1490
+
1491
+ # Removes the given index from the table.
1492
+ #
1493
+ # ```ruby
1494
+ # t.remove_index(:branch_id)
1495
+ # t.remove_index(column: [:branch_id, :party_id])
1496
+ # t.remove_index(name: :by_branch_party)
1497
+ # ```
1498
+ sig { params(options: T.untyped).void }
1499
+ def remove_index(options = {}); end
1500
+
1501
+ # Removes the timestamp columns (`created_at` and `updated_at`) from the table.
1502
+ #
1503
+ # ```ruby
1504
+ # t.remove_timestamps
1505
+ # ```
1506
+ sig { params(options: T.untyped).void }
1507
+ def remove_timestamps(options = {}); end
1508
+
1509
+ # Renames a column.
1510
+ #
1511
+ # ```ruby
1512
+ # t.rename(:description, :name)
1513
+ # ```
1514
+ sig { params(column_name: T.any(String, Symbol), new_column_name: T.any(String, Symbol)).void }
1515
+ def rename(column_name, new_column_name); end
1516
+
1517
+ # Adds a reference.
1518
+ #
1519
+ # ```ruby
1520
+ # t.references(:user)
1521
+ # t.belongs_to(:supplier, foreign_key: true)
1522
+ # ```
1523
+ sig { params(args: T.untyped, options: T.untyped).void }
1524
+ def references(*args, **options); end
1525
+
1526
+ # Adds a reference.
1527
+ #
1528
+ # ```ruby
1529
+ # t.references(:user)
1530
+ # t.belongs_to(:supplier, foreign_key: true)
1531
+ # ```
1532
+ sig { params(args: T.untyped, options: T.untyped).void }
1533
+ def belongs_to(*args, **options); end
1534
+
1535
+ # Removes a reference. Optionally removes a `type` column.
1536
+ #
1537
+ # ```ruby
1538
+ # t.remove_references(:user)
1539
+ # t.remove_belongs_to(:supplier, polymorphic: true)
1540
+ # ```
1541
+ sig { params(args: T.untyped, options: T.untyped).void }
1542
+ def remove_references(*args, **options); end
1543
+
1544
+ # Removes a reference. Optionally removes a `type` column.
1545
+ #
1546
+ # ```ruby
1547
+ # t.remove_references(:user)
1548
+ # t.remove_belongs_to(:supplier, polymorphic: true)
1549
+ # ```
1550
+ sig { params(args: T.untyped, options: T.untyped).void }
1551
+ def remove_belongs_to(*args, **options); end
1552
+
1553
+ # Adds a foreign key to the table using a supplied table name.
1554
+ #
1555
+ # ```ruby
1556
+ # t.foreign_key(:authors)
1557
+ # t.foreign_key(:authors, column: :author_id, primary_key: "id")
1558
+ # ```
1559
+ sig { params(args: T.untyped).void }
1560
+ def foreign_key(*args); end
1561
+
1562
+ # Removes the given foreign key from the table.
1563
+ #
1564
+ # ```ruby
1565
+ # t.remove_foreign_key(:authors)
1566
+ # t.remove_foreign_key(column: :author_id)
1567
+ # ```
1568
+ sig { params(args: T.untyped).void }
1569
+ def remove_foreign_key(*args); end
1570
+
1571
+ # Checks to see if a foreign key exists.
1572
+ #
1573
+ # ```ruby
1574
+ # t.foreign_key(:authors) unless t.foreign_key_exists?(:authors)
1575
+ # ```
1576
+ sig { params(args: T.untyped).returns(T::Boolean) }
1577
+ def foreign_key_exists?(*args); end
1578
+ end
1579
+
1580
+ class ActiveRecord::InternalMetadata < ::ActiveRecord::Base
1581
+ class << self
1582
+ def [](key); end
1583
+ def []=(key, value); end
1584
+ def _internal?; end
1585
+ def _validators; end
1586
+ def attribute_type_decorations; end
1587
+ def create_table; end
1588
+ def defined_enums; end
1589
+ def drop_table; end
1590
+ def page(num = T.unsafe(nil)); end
1591
+ def primary_key; end
1592
+ def table_exists?; end
1593
+ def table_name; end
1594
+ end
1595
+ end
1596
+
1597
+ module ActiveRecord::Locking::Pessimistic
1598
+ # Returns `nil` if `ActiveRecord::Rollback` is raised.
1599
+ sig do
1600
+ type_parameters(:U)
1601
+ .params(
1602
+ lock: T.any(String, TrueClass),
1603
+ blk: T.proc.returns(T.type_parameter(:U)),
1604
+ )
1605
+ .returns(T.nilable(T.type_parameter(:U)))
1606
+ end
1607
+ def with_lock(lock = nil, &blk); end
1608
+ end
1609
+
1610
+ ActiveRecord::LogSubscriber::IGNORE_PAYLOAD_NAMES = T.let(T.unsafe(nil), T::Array[T.untyped])
1611
+
1612
+ class ActiveRecord::Relation
1613
+ Elem = type_member(fixed: T.untyped)
1614
+
1615
+ sig { returns(Integer) }
1616
+ def delete_all; end
1617
+
1618
+ # Returns size of the records.
1619
+ sig { returns(Integer) }
1620
+ def size; end
1621
+
1622
+ # Returns true if relation is blank.
1623
+ sig { returns(T::Boolean) }
1624
+ def blank?; end
1625
+
1626
+ # Returns true if there are no records.
1627
+ sig { returns(T::Boolean) }
1628
+ def empty?; end
1629
+
1630
+ # Returns true if there are no records.
1631
+ sig { params(block: T.nilable(T.proc.params(arg0: Elem).returns(T::Boolean))).returns(T::Boolean) }
1632
+ def none?(&block); end
1633
+
1634
+ # Returns true if there are any records.
1635
+ sig { params(block: T.nilable(T.proc.params(arg0: Elem).returns(T::Boolean))).returns(T::Boolean) }
1636
+ def any?(&block); end
1637
+
1638
+ # Returns true if there is exactly one record.
1639
+ sig { params(block: T.nilable(T.proc.params(arg0: Elem).returns(T::Boolean))).returns(T::Boolean) }
1640
+ def one?(&block); end
1641
+
1642
+ # Returns true if there is more than one record.
1643
+ sig { params(block: T.nilable(T.proc.params(arg0: Elem).returns(T::Boolean))).returns(T::Boolean) }
1644
+ def many?(&block); end
1645
+ end
1646
+
1647
+ module ActiveRecord::Store
1648
+ mixes_in_class_methods(::ActiveRecord::Store::ClassMethods)
1649
+ end
1650
+
1651
+ module ActiveRecord::Store::ClassMethods
1652
+ sig do
1653
+ params(
1654
+ store_attribute: T.any(Symbol, String),
1655
+ options: T::Hash[Symbol, T.untyped]
1656
+ ).void
1657
+ end
1658
+ def store(store_attribute, options = {}); end
1659
+
1660
+ sig do
1661
+ params(
1662
+ store_attribute: T.any(Symbol, String),
1663
+ keys: T.any(T::Array[T.any(Symbol, String)], Symbol, String),
1664
+ prefix: T.nilable(T.any(T::Boolean, Symbol, String)),
1665
+ suffix: T.nilable(T.any(T::Boolean, Symbol, String))
1666
+ ).void
1667
+ end
1668
+ def store_accessor(store_attribute, *keys, prefix: nil, suffix: nil); end
1669
+
1670
+ sig do
1671
+ returns(T::Hash[Symbol, T::Array[Symbol]])
1672
+ end
1673
+ def stored_attributes; end
1674
+ end