lazy_migrate 0.1.0 → 0.2.0

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