diff options
author | Frederick Cheung <frederick.cheung@gmail.com> | 2008-09-07 19:18:40 +0100 |
---|---|---|
committer | Frederick Cheung <frederick.cheung@gmail.com> | 2008-09-07 19:18:40 +0100 |
commit | e4167b8d0bfdb74c909f47c79defa9d57aa5b4a8 (patch) | |
tree | 9aa065baab65175307f055e668b895019c66d75c /railties/doc/guides/migrations | |
parent | 67f50bd42459fe47f16f5266fceb1ab1c1d86404 (diff) | |
download | rails-e4167b8d0bfdb74c909f47c79defa9d57aa5b4a8.tar.gz rails-e4167b8d0bfdb74c909f47c79defa9d57aa5b4a8.tar.bz2 rails-e4167b8d0bfdb74c909f47c79defa9d57aa5b4a8.zip |
Stylistic cleanups
Diffstat (limited to 'railties/doc/guides/migrations')
5 files changed, 7 insertions, 7 deletions
diff --git a/railties/doc/guides/migrations/anatomy_of_a_migration.txt b/railties/doc/guides/migrations/anatomy_of_a_migration.txt index 92fc20be21..ca557ab2f9 100644 --- a/railties/doc/guides/migrations/anatomy_of_a_migration.txt +++ b/railties/doc/guides/migrations/anatomy_of_a_migration.txt @@ -1,6 +1,6 @@ == Anatomy Of A Migration == -Before we dive into the details of a migration, here is a typical example: +Before I dive into the details of a migration, here is a typical example: [source, ruby] ------------------------ @@ -25,7 +25,7 @@ This migration adds a table called products with a string column called `name` a === Migrations are classes A migration is a subclass of `ActiveRecord::Migration` that implements two class methods: +up+ (perform the required transformations) and +down+ (revert them). -Methods are provided that perform common data definition tasks in a database independent way (we'll look at them in detail later): +ActiveRecord provides methods that perform common data definition tasks in a database independent way (you'll read about them in detail later): * `create_table` * `change_table` diff --git a/railties/doc/guides/migrations/creating_a_migration.txt b/railties/doc/guides/migrations/creating_a_migration.txt index 416e82f0c2..0574e0eb7b 100644 --- a/railties/doc/guides/migrations/creating_a_migration.txt +++ b/railties/doc/guides/migrations/creating_a_migration.txt @@ -84,7 +84,7 @@ class RemovePartNumberFromProducts < ActiveRecord::Migration end ----------------------- -You aren't limited to one magically generated column, for example +You are not limited to one magically generated column, for example `ruby script/generate migration AddDetailsToProducts part_number:string price:decimal` diff --git a/railties/doc/guides/migrations/migrations.txt b/railties/doc/guides/migrations/migrations.txt index 261e74f2b6..71b49f6a8f 100644 --- a/railties/doc/guides/migrations/migrations.txt +++ b/railties/doc/guides/migrations/migrations.txt @@ -5,7 +5,7 @@ Migrations are a convenient way for you to alter your database in a structured a Migrations also allow you to describe these transformation using ruby, in a database independent way (you can drop down to raw SQL for database specific features). -Rails packages a number of rake tasks and generators for working with migrations and we'll talk about those too. +Rails packages a number of rake tasks and generators for working with migrations and you'll learn about those too. include::anatomy_of_a_migration.txt[] include::creating_a_migration.txt[] diff --git a/railties/doc/guides/migrations/rakeing_around.txt b/railties/doc/guides/migrations/rakeing_around.txt index f6392f044d..5328941602 100644 --- a/railties/doc/guides/migrations/rakeing_around.txt +++ b/railties/doc/guides/migrations/rakeing_around.txt @@ -71,7 +71,7 @@ class CreateProducts < ActiveRecord::Migration t.timestamps end end - say "we created a table" + say "Created a table" suppress_messages {add_index :products, :name} say "and an index!", true say_with_time 'Waiting for a while' do @@ -89,7 +89,7 @@ end generates the following output ---------------------- == 20080906170109 CreateProducts: migrating =================================== --- we created a table +-- Created a table -> and an index! -- Waiting for a while -> 10.0001s diff --git a/railties/doc/guides/migrations/using_models_in_migrations.txt b/railties/doc/guides/migrations/using_models_in_migrations.txt index d2f0f09bd3..807664e666 100644 --- a/railties/doc/guides/migrations/using_models_in_migrations.txt +++ b/railties/doc/guides/migrations/using_models_in_migrations.txt @@ -2,7 +2,7 @@ When creating or updating data in a migration it is often tempting to use one of your models. After all they exist to provide easy access to the underlying data. This can be done but some caution should be observed. Consider for example a migration that uses the Product model to update a row in the corresponding table. Alice later updates the Product model, adding a new column and a validation on it. Bob comes back from holiday, updates the source and runs outstanding migrations with `rake db:migrate`, including the one that used the Product model. When the migration runs the source is up to date and so the Product model has the validation added by Alice. The database however is still old and so does not have that column and an error ensues. -Frequently one only wishes to update rows in the database without writing out the sql by hand: we're not using anything actually specific to the model. One pattern for this is to define a copy of the model inside the migration itself, for example: +Frequently I just want to update rows in the database without writing out the sql by hand: I'm notusing anything specific to the model. One pattern for this is to define a copy of the model inside the migration itself, for example: [source, ruby] ------------------------- |