Skip to content

Commit 35bf079

Browse files
committed
Update all Migration version references
Migration version references has been updated 2 times in less than 3 weeks (rails#41894, rails#42113). I'd not want to receive the same tweaks in the near future.
1 parent 2c8821a commit 35bf079

File tree

10 files changed

+56
-56
lines changed

10 files changed

+56
-56
lines changed

activerecord/README.rdoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ This would also define the following accessors: <tt>Product#name</tt> and
140140

141141
* Database agnostic schema management with Migrations.
142142

143-
class AddSystemSettings < ActiveRecord::Migration[6.0]
143+
class AddSystemSettings < ActiveRecord::Migration[7.0]
144144
def up
145145
create_table :system_settings do |t|
146146
t.string :name

activerecord/lib/active_record/associations.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1780,7 +1780,7 @@ def belongs_to(name, scope = nil, **options)
17801780
# The join table should not have a primary key or a model associated with it. You must manually generate the
17811781
# join table with a migration such as this:
17821782
#
1783-
# class CreateDevelopersProjectsJoinTable < ActiveRecord::Migration[6.0]
1783+
# class CreateDevelopersProjectsJoinTable < ActiveRecord::Migration[7.0]
17841784
# def change
17851785
# create_join_table :developers, :projects
17861786
# end

activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ def #{column_type}(*names, **options)
278278
# Inside migration files, the +t+ object in {create_table}[rdoc-ref:SchemaStatements#create_table]
279279
# is actually of this type:
280280
#
281-
# class SomeMigration < ActiveRecord::Migration[6.0]
281+
# class SomeMigration < ActiveRecord::Migration[7.0]
282282
# def up
283283
# create_table :foo do |t|
284284
# puts t.class # => "ActiveRecord::ConnectionAdapters::TableDefinition"

activerecord/lib/active_record/migration.rb

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def initialize(message = nil)
2020
# For example the following migration is not reversible.
2121
# Rolling back this migration will raise an ActiveRecord::IrreversibleMigration error.
2222
#
23-
# class IrreversibleMigrationExample < ActiveRecord::Migration[6.0]
23+
# class IrreversibleMigrationExample < ActiveRecord::Migration[7.0]
2424
# def change
2525
# create_table :distributors do |t|
2626
# t.string :zipcode
@@ -38,7 +38,7 @@ def initialize(message = nil)
3838
#
3939
# 1. Define <tt>#up</tt> and <tt>#down</tt> methods instead of <tt>#change</tt>:
4040
#
41-
# class ReversibleMigrationExample < ActiveRecord::Migration[6.0]
41+
# class ReversibleMigrationExample < ActiveRecord::Migration[7.0]
4242
# def up
4343
# create_table :distributors do |t|
4444
# t.string :zipcode
@@ -63,7 +63,7 @@ def initialize(message = nil)
6363
#
6464
# 2. Use the #reversible method in <tt>#change</tt> method:
6565
#
66-
# class ReversibleMigrationExample < ActiveRecord::Migration[6.0]
66+
# class ReversibleMigrationExample < ActiveRecord::Migration[7.0]
6767
# def change
6868
# create_table :distributors do |t|
6969
# t.string :zipcode
@@ -228,7 +228,7 @@ def initialize
228228
#
229229
# Example of a simple migration:
230230
#
231-
# class AddSsl < ActiveRecord::Migration[6.0]
231+
# class AddSsl < ActiveRecord::Migration[7.0]
232232
# def up
233233
# add_column :accounts, :ssl_enabled, :boolean, default: true
234234
# end
@@ -248,7 +248,7 @@ def initialize
248248
#
249249
# Example of a more complex migration that also needs to initialize data:
250250
#
251-
# class AddSystemSettings < ActiveRecord::Migration[6.0]
251+
# class AddSystemSettings < ActiveRecord::Migration[7.0]
252252
# def up
253253
# create_table :system_settings do |t|
254254
# t.string :name
@@ -376,7 +376,7 @@ def initialize
376376
# bin/rails generate migration add_fieldname_to_tablename fieldname:string
377377
#
378378
# This will generate the file <tt>timestamp_add_fieldname_to_tablename.rb</tt>, which will look like this:
379-
# class AddFieldnameToTablename < ActiveRecord::Migration[6.0]
379+
# class AddFieldnameToTablename < ActiveRecord::Migration[7.0]
380380
# def change
381381
# add_column :tablenames, :fieldname, :string
382382
# end
@@ -402,7 +402,7 @@ def initialize
402402
#
403403
# Not all migrations change the schema. Some just fix the data:
404404
#
405-
# class RemoveEmptyTags < ActiveRecord::Migration[6.0]
405+
# class RemoveEmptyTags < ActiveRecord::Migration[7.0]
406406
# def up
407407
# Tag.all.each { |tag| tag.destroy if tag.pages.empty? }
408408
# end
@@ -415,7 +415,7 @@ def initialize
415415
#
416416
# Others remove columns when they migrate up instead of down:
417417
#
418-
# class RemoveUnnecessaryItemAttributes < ActiveRecord::Migration[6.0]
418+
# class RemoveUnnecessaryItemAttributes < ActiveRecord::Migration[7.0]
419419
# def up
420420
# remove_column :items, :incomplete_items_count
421421
# remove_column :items, :completed_items_count
@@ -429,7 +429,7 @@ def initialize
429429
#
430430
# And sometimes you need to do something in SQL not abstracted directly by migrations:
431431
#
432-
# class MakeJoinUnique < ActiveRecord::Migration[6.0]
432+
# class MakeJoinUnique < ActiveRecord::Migration[7.0]
433433
# def up
434434
# execute "ALTER TABLE `pages_linked_pages` ADD UNIQUE `page_id_linked_page_id` (`page_id`,`linked_page_id`)"
435435
# end
@@ -446,7 +446,7 @@ def initialize
446446
# <tt>Base#reset_column_information</tt> in order to ensure that the model has the
447447
# latest column data from after the new column was added. Example:
448448
#
449-
# class AddPeopleSalary < ActiveRecord::Migration[6.0]
449+
# class AddPeopleSalary < ActiveRecord::Migration[7.0]
450450
# def up
451451
# add_column :people, :salary, :integer
452452
# Person.reset_column_information
@@ -504,7 +504,7 @@ def initialize
504504
# To define a reversible migration, define the +change+ method in your
505505
# migration like this:
506506
#
507-
# class TenderloveMigration < ActiveRecord::Migration[6.0]
507+
# class TenderloveMigration < ActiveRecord::Migration[7.0]
508508
# def change
509509
# create_table(:horses) do |t|
510510
# t.column :content, :text
@@ -534,7 +534,7 @@ def initialize
534534
# can't execute inside a transaction though, and for these situations
535535
# you can turn the automatic transactions off.
536536
#
537-
# class ChangeEnum < ActiveRecord::Migration[6.0]
537+
# class ChangeEnum < ActiveRecord::Migration[7.0]
538538
# disable_ddl_transaction!
539539
#
540540
# def up
@@ -698,7 +698,7 @@ def initialize(name = self.class.name, version = nil)
698698
# and create the table 'apples' on the way up, and the reverse
699699
# on the way down.
700700
#
701-
# class FixTLMigration < ActiveRecord::Migration[6.0]
701+
# class FixTLMigration < ActiveRecord::Migration[7.0]
702702
# def change
703703
# revert do
704704
# create_table(:horses) do |t|
@@ -717,7 +717,7 @@ def initialize(name = self.class.name, version = nil)
717717
#
718718
# require_relative "20121212123456_tenderlove_migration"
719719
#
720-
# class FixupTLMigration < ActiveRecord::Migration[6.0]
720+
# class FixupTLMigration < ActiveRecord::Migration[7.0]
721721
# def change
722722
# revert TenderloveMigration
723723
#
@@ -768,7 +768,7 @@ def down
768768
# when the three columns 'first_name', 'last_name' and 'full_name' exist,
769769
# even when migrating down:
770770
#
771-
# class SplitNameMigration < ActiveRecord::Migration[6.0]
771+
# class SplitNameMigration < ActiveRecord::Migration[7.0]
772772
# def change
773773
# add_column :users, :first_name, :string
774774
# add_column :users, :last_name, :string
@@ -796,7 +796,7 @@ def reversible
796796
# In the following example, the new column +published+ will be given
797797
# the value +true+ for all existing records.
798798
#
799-
# class AddPublishedToPosts < ActiveRecord::Migration[6.0]
799+
# class AddPublishedToPosts < ActiveRecord::Migration[7.0]
800800
# def change
801801
# add_column :posts, :published, :boolean, default: false
802802
# up_only do

activerecord/lib/active_record/model_schema.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ def content_columns
489489
# when just after creating a table you want to populate it with some default
490490
# values, eg:
491491
#
492-
# class CreateJobLevels < ActiveRecord::Migration[6.0]
492+
# class CreateJobLevels < ActiveRecord::Migration[7.0]
493493
# def up
494494
# create_table :job_levels do |t|
495495
# t.integer :id

guides/bug_report_templates/active_record_migrations_gem.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
class Payment < ActiveRecord::Base
3030
end
3131

32-
class ChangeAmountToAddScale < ActiveRecord::Migration[6.0]
32+
class ChangeAmountToAddScale < ActiveRecord::Migration[6.1]
3333
def change
3434
reversible do |dir|
3535
dir.up do

guides/bug_report_templates/active_record_migrations_main.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
class Payment < ActiveRecord::Base
2929
end
3030

31-
class ChangeAmountToAddScale < ActiveRecord::Migration[6.0]
31+
class ChangeAmountToAddScale < ActiveRecord::Migration[7.0]
3232
def change
3333
reversible do |dir|
3434
dir.up do

guides/source/active_record_basics.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ database that Active Record supports using `rake`. Here's a migration that
368368
creates a table:
369369

370370
```ruby
371-
class CreatePublications < ActiveRecord::Migration[6.0]
371+
class CreatePublications < ActiveRecord::Migration[7.0]
372372
def change
373373
create_table :publications do |t|
374374
t.string :title

guides/source/active_record_migrations.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ history to the latest version. Active Record will also update your
3434
Here's an example of a migration:
3535

3636
```ruby
37-
class CreateProducts < ActiveRecord::Migration[6.0]
37+
class CreateProducts < ActiveRecord::Migration[7.0]
3838
def change
3939
create_table :products do |t|
4040
t.string :name
@@ -71,7 +71,7 @@ If you wish for a migration to do something that Active Record doesn't know how
7171
to reverse, you can use `reversible`:
7272

7373
```ruby
74-
class ChangeProductsPrice < ActiveRecord::Migration[6.0]
74+
class ChangeProductsPrice < ActiveRecord::Migration[7.0]
7575
def change
7676
reversible do |dir|
7777
change_table :products do |t|
@@ -86,7 +86,7 @@ end
8686
Alternatively, you can use `up` and `down` instead of `change`:
8787

8888
```ruby
89-
class ChangeProductsPrice < ActiveRecord::Migration[6.0]
89+
class ChangeProductsPrice < ActiveRecord::Migration[7.0]
9090
def up
9191
change_table :products do |t|
9292
t.change :price, :string
@@ -128,7 +128,7 @@ $ bin/rails generate migration AddPartNumberToProducts
128128
This will create an appropriately named empty migration:
129129

130130
```ruby
131-
class AddPartNumberToProducts < ActiveRecord::Migration[6.0]
131+
class AddPartNumberToProducts < ActiveRecord::Migration[7.0]
132132
def change
133133
end
134134
end
@@ -150,7 +150,7 @@ $ bin/rails generate migration AddPartNumberToProducts part_number:string
150150
will generate
151151

152152
```ruby
153-
class AddPartNumberToProducts < ActiveRecord::Migration[6.0]
153+
class AddPartNumberToProducts < ActiveRecord::Migration[7.0]
154154
def change
155155
add_column :products, :part_number, :string
156156
end
@@ -166,7 +166,7 @@ $ bin/rails generate migration AddPartNumberToProducts part_number:string:index
166166
will generate the appropriate `add_column` and [`add_index`][] statements:
167167

168168
```ruby
169-
class AddPartNumberToProducts < ActiveRecord::Migration[6.0]
169+
class AddPartNumberToProducts < ActiveRecord::Migration[7.0]
170170
def change
171171
add_column :products, :part_number, :string
172172
add_index :products, :part_number
@@ -183,7 +183,7 @@ $ bin/rails generate migration RemovePartNumberFromProducts part_number:string
183183
generates
184184

185185
```ruby
186-
class RemovePartNumberFromProducts < ActiveRecord::Migration[6.0]
186+
class RemovePartNumberFromProducts < ActiveRecord::Migration[7.0]
187187
def change
188188
remove_column :products, :part_number, :string
189189
end
@@ -199,7 +199,7 @@ $ bin/rails generate migration AddDetailsToProducts part_number:string price:dec
199199
generates
200200

201201
```ruby
202-
class AddDetailsToProducts < ActiveRecord::Migration[6.0]
202+
class AddDetailsToProducts < ActiveRecord::Migration[7.0]
203203
def change
204204
add_column :products, :part_number, :string
205205
add_column :products, :price, :decimal
@@ -218,7 +218,7 @@ $ bin/rails generate migration CreateProducts name:string part_number:string
218218
generates
219219

220220
```ruby
221-
class CreateProducts < ActiveRecord::Migration[6.0]
221+
class CreateProducts < ActiveRecord::Migration[7.0]
222222
def change
223223
create_table :products do |t|
224224
t.string :name
@@ -244,7 +244,7 @@ $ bin/rails generate migration AddUserRefToProducts user:references
244244
generates the following [`add_reference`][] call:
245245

246246
```ruby
247-
class AddUserRefToProducts < ActiveRecord::Migration[6.0]
247+
class AddUserRefToProducts < ActiveRecord::Migration[7.0]
248248
def change
249249
add_reference :products, :user, foreign_key: true
250250
end
@@ -262,7 +262,7 @@ $ bin/rails generate migration CreateJoinTableCustomerProduct customer product
262262
will produce the following migration:
263263

264264
```ruby
265-
class CreateJoinTableCustomerProduct < ActiveRecord::Migration[6.0]
265+
class CreateJoinTableCustomerProduct < ActiveRecord::Migration[7.0]
266266
def change
267267
create_join_table :customers, :products do |t|
268268
# t.index [:customer_id, :product_id]
@@ -291,7 +291,7 @@ $ bin/rails generate model Product name:string description:text
291291
will create a migration that looks like this
292292

293293
```ruby
294-
class CreateProducts < ActiveRecord::Migration[6.0]
294+
class CreateProducts < ActiveRecord::Migration[7.0]
295295
def change
296296
create_table :products do |t|
297297
t.string :name
@@ -319,7 +319,7 @@ $ bin/rails generate migration AddDetailsToProducts 'price:decimal{5,2}' supplie
319319
will produce a migration that looks like this
320320

321321
```ruby
322-
class AddDetailsToProducts < ActiveRecord::Migration[6.0]
322+
class AddDetailsToProducts < ActiveRecord::Migration[7.0]
323323
def change
324324
add_column :products, :price, :decimal, precision: 5, scale: 2
325325
add_reference :products, :supplier, polymorphic: true
@@ -605,7 +605,7 @@ to reverse. You can use [`reversible`][] to specify what to do when running a
605605
migration and what else to do when reverting it. For example:
606606

607607
```ruby
608-
class ExampleMigration < ActiveRecord::Migration[6.0]
608+
class ExampleMigration < ActiveRecord::Migration[7.0]
609609
def change
610610
create_table :distributors do |t|
611611
t.string :zipcode
@@ -660,7 +660,7 @@ is wise to perform the transformations in precisely the reverse order they were
660660
made in the `up` method. The example in the `reversible` section is equivalent to:
661661

662662
```ruby
663-
class ExampleMigration < ActiveRecord::Migration[6.0]
663+
class ExampleMigration < ActiveRecord::Migration[7.0]
664664
def up
665665
create_table :distributors do |t|
666666
t.string :zipcode
@@ -703,7 +703,7 @@ You can use Active Record's ability to rollback migrations using the [`revert`][
703703
```ruby
704704
require_relative "20121212123456_example_migration"
705705

706-
class FixupExampleMigration < ActiveRecord::Migration[6.0]
706+
class FixupExampleMigration < ActiveRecord::Migration[7.0]
707707
def change
708708
revert ExampleMigration
709709

@@ -721,7 +721,7 @@ is later decided it would be best to use Active Record validations,
721721
in place of the `CHECK` constraint, to verify the zipcode.
722722

723723
```ruby
724-
class DontUseConstraintForZipcodeValidationMigration < ActiveRecord::Migration[6.0]
724+
class DontUseConstraintForZipcodeValidationMigration < ActiveRecord::Migration[7.0]
725725
def change
726726
revert do
727727
# copy-pasted code from ExampleMigration
@@ -883,7 +883,7 @@ Several methods are provided in migrations that allow you to control all this:
883883
For example, this migration:
884884

885885
```ruby
886-
class CreateProducts < ActiveRecord::Migration[6.0]
886+
class CreateProducts < ActiveRecord::Migration[7.0]
887887
def change
888888
suppress_messages do
889889
create_table :products do |t|
@@ -1052,7 +1052,7 @@ to add or modify data. This is useful in an existing database that can't be dest
10521052
and recreated, such as a production database.
10531053

10541054
```ruby
1055-
class AddInitialProducts < ActiveRecord::Migration[6.0]
1055+
class AddInitialProducts < ActiveRecord::Migration[7.0]
10561056
def up
10571057
5.times do |i|
10581058
Product.create(name: "Product ##{i}", description: "A product.")

0 commit comments

Comments
 (0)