aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorMatthew Draper <matthew@trebex.net>2015-12-06 06:29:19 +1030
committerMatthew Draper <matthew@trebex.net>2015-12-15 17:18:09 +1030
commitc0af95e0abe92ea676bf73959ea84d2fccc8c8fb (patch)
tree7b682faf8f7543926a3869bfa63a2826de34fcf0 /activerecord
parent6940dc860c4b25bff2eded370f2af4316de15a30 (diff)
downloadrails-c0af95e0abe92ea676bf73959ea84d2fccc8c8fb.tar.gz
rails-c0af95e0abe92ea676bf73959ea84d2fccc8c8fb.tar.bz2
rails-c0af95e0abe92ea676bf73959ea84d2fccc8c8fb.zip
Use a deliberately-invalid migration version in all doc examples
If we use a real version, at best that'll be an onerous update required for each release; at worst, it will encourage users to write new migrations against an older version than they're using. The other option would be to leave these bare, without any version specifier. But as that's just a variant spelling of "4.2", it would seem to raise the same concerns as above.
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/README.rdoc2
-rw-r--r--activerecord/lib/active_record/associations.rb2
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb2
-rw-r--r--activerecord/lib/active_record/migration.rb30
-rw-r--r--activerecord/lib/active_record/model_schema.rb2
5 files changed, 19 insertions, 19 deletions
diff --git a/activerecord/README.rdoc b/activerecord/README.rdoc
index 7eb4e9db1a..9c37b97f76 100644
--- a/activerecord/README.rdoc
+++ b/activerecord/README.rdoc
@@ -138,7 +138,7 @@ This would also define the following accessors: <tt>Product#name</tt> and
* Database agnostic schema management with Migrations.
- class AddSystemSettings < ActiveRecord::Migration
+ class AddSystemSettings < ActiveRecord::Migration[0.0]
def up
create_table :system_settings do |t|
t.string :name
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb
index b806a2f832..f2a637e727 100644
--- a/activerecord/lib/active_record/associations.rb
+++ b/activerecord/lib/active_record/associations.rb
@@ -1639,7 +1639,7 @@ module ActiveRecord
# The join table should not have a primary key or a model associated with it. You must manually generate the
# join table with a migration such as this:
#
- # class CreateDevelopersProjectsJoinTable < ActiveRecord::Migration
+ # class CreateDevelopersProjectsJoinTable < ActiveRecord::Migration[0.0]
# def change
# create_join_table :developers, :projects
# end
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
index 159cbcb85a..9ec8e0fc26 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
@@ -190,7 +190,7 @@ module ActiveRecord
# Inside migration files, the +t+ object in {create_table}[rdoc-ref:SchemaStatements#create_table]
# is actually of this type:
#
- # class SomeMigration < ActiveRecord::Migration
+ # class SomeMigration < ActiveRecord::Migration[0.0]
# def up
# create_table :foo do |t|
# puts t.class # => "ActiveRecord::ConnectionAdapters::TableDefinition"
diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb
index 53a84c1342..b2418e4247 100644
--- a/activerecord/lib/active_record/migration.rb
+++ b/activerecord/lib/active_record/migration.rb
@@ -13,7 +13,7 @@ module ActiveRecord
# For example the following migration is not reversible.
# Rolling back this migration will raise an ActiveRecord::IrreversibleMigration error.
#
- # class IrreversibleMigrationExample < ActiveRecord::Migration
+ # class IrreversibleMigrationExample < ActiveRecord::Migration[0.0]
# def change
# create_table :distributors do |t|
# t.string :zipcode
@@ -31,7 +31,7 @@ module ActiveRecord
#
# 1. Define <tt>#up</tt> and <tt>#down</tt> methods instead of <tt>#change</tt>:
#
- # class ReversibleMigrationExample < ActiveRecord::Migration
+ # class ReversibleMigrationExample < ActiveRecord::Migration[0.0]
# def up
# create_table :distributors do |t|
# t.string :zipcode
@@ -56,7 +56,7 @@ module ActiveRecord
#
# 2. Use the #reversible method in <tt>#change</tt> method:
#
- # class ReversibleMigrationExample < ActiveRecord::Migration
+ # class ReversibleMigrationExample < ActiveRecord::Migration[0.0]
# def change
# create_table :distributors do |t|
# t.string :zipcode
@@ -155,7 +155,7 @@ module ActiveRecord
#
# Example of a simple migration:
#
- # class AddSsl < ActiveRecord::Migration
+ # class AddSsl < ActiveRecord::Migration[0.0]
# def up
# add_column :accounts, :ssl_enabled, :boolean, default: true
# end
@@ -175,7 +175,7 @@ module ActiveRecord
#
# Example of a more complex migration that also needs to initialize data:
#
- # class AddSystemSettings < ActiveRecord::Migration
+ # class AddSystemSettings < ActiveRecord::Migration[0.0]
# def up
# create_table :system_settings do |t|
# t.string :name
@@ -301,7 +301,7 @@ module ActiveRecord
# rails generate migration add_fieldname_to_tablename fieldname:string
#
# This will generate the file <tt>timestamp_add_fieldname_to_tablename.rb</tt>, which will look like this:
- # class AddFieldnameToTablename < ActiveRecord::Migration
+ # class AddFieldnameToTablename < ActiveRecord::Migration[0.0]
# def change
# add_column :tablenames, :fieldname, :string
# end
@@ -332,7 +332,7 @@ module ActiveRecord
#
# Not all migrations change the schema. Some just fix the data:
#
- # class RemoveEmptyTags < ActiveRecord::Migration
+ # class RemoveEmptyTags < ActiveRecord::Migration[0.0]
# def up
# Tag.all.each { |tag| tag.destroy if tag.pages.empty? }
# end
@@ -345,7 +345,7 @@ module ActiveRecord
#
# Others remove columns when they migrate up instead of down:
#
- # class RemoveUnnecessaryItemAttributes < ActiveRecord::Migration
+ # class RemoveUnnecessaryItemAttributes < ActiveRecord::Migration[0.0]
# def up
# remove_column :items, :incomplete_items_count
# remove_column :items, :completed_items_count
@@ -359,7 +359,7 @@ module ActiveRecord
#
# And sometimes you need to do something in SQL not abstracted directly by migrations:
#
- # class MakeJoinUnique < ActiveRecord::Migration
+ # class MakeJoinUnique < ActiveRecord::Migration[0.0]
# def up
# execute "ALTER TABLE `pages_linked_pages` ADD UNIQUE `page_id_linked_page_id` (`page_id`,`linked_page_id`)"
# end
@@ -376,7 +376,7 @@ module ActiveRecord
# <tt>Base#reset_column_information</tt> in order to ensure that the model has the
# latest column data from after the new column was added. Example:
#
- # class AddPeopleSalary < ActiveRecord::Migration
+ # class AddPeopleSalary < ActiveRecord::Migration[0.0]
# def up
# add_column :people, :salary, :integer
# Person.reset_column_information
@@ -434,7 +434,7 @@ module ActiveRecord
# To define a reversible migration, define the +change+ method in your
# migration like this:
#
- # class TenderloveMigration < ActiveRecord::Migration
+ # class TenderloveMigration < ActiveRecord::Migration[0.0]
# def change
# create_table(:horses) do |t|
# t.column :content, :text
@@ -464,7 +464,7 @@ module ActiveRecord
# can't execute inside a transaction though, and for these situations
# you can turn the automatic transactions off.
#
- # class ChangeEnum < ActiveRecord::Migration
+ # class ChangeEnum < ActiveRecord::Migration[0.0]
# disable_ddl_transaction!
#
# def up
@@ -601,7 +601,7 @@ module ActiveRecord
# and create the table 'apples' on the way up, and the reverse
# on the way down.
#
- # class FixTLMigration < ActiveRecord::Migration
+ # class FixTLMigration < ActiveRecord::Migration[0.0]
# def change
# revert do
# create_table(:horses) do |t|
@@ -620,7 +620,7 @@ module ActiveRecord
#
# require_relative '20121212123456_tenderlove_migration'
#
- # class FixupTLMigration < ActiveRecord::Migration
+ # class FixupTLMigration < ActiveRecord::Migration[0.0]
# def change
# revert TenderloveMigration
#
@@ -673,7 +673,7 @@ module ActiveRecord
# when the three columns 'first_name', 'last_name' and 'full_name' exist,
# even when migrating down:
#
- # class SplitNameMigration < ActiveRecord::Migration
+ # class SplitNameMigration < ActiveRecord::Migration[0.0]
# def change
# add_column :users, :first_name, :string
# add_column :users, :last_name, :string
diff --git a/activerecord/lib/active_record/model_schema.rb b/activerecord/lib/active_record/model_schema.rb
index e3f304b0af..8ae2a61aa8 100644
--- a/activerecord/lib/active_record/model_schema.rb
+++ b/activerecord/lib/active_record/model_schema.rb
@@ -275,7 +275,7 @@ module ActiveRecord
# when just after creating a table you want to populate it with some default
# values, eg:
#
- # class CreateJobLevels < ActiveRecord::Migration
+ # class CreateJobLevels < ActiveRecord::Migration[0.0]
# def up
# create_table :job_levels do |t|
# t.integer :id