Skip to content

Commit

Permalink
[engines guide] some fixes for the author id migration including proo…
Browse files Browse the repository at this point in the history
…f of not copying over other migrations again
  • Loading branch information
radar committed Oct 20, 2011
1 parent 3e2d35b commit 13e6f0c
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions railties/guides/source/engines.textile
Expand Up @@ -450,20 +450,26 @@ By defining that the +author+ association's object is represented by the +User+
To generate this new column, run this command within the engine:

<shell>
$ rails g migration add_author_to_blorgh_posts author:references
$ rails g migration add_author_id_to_blorgh_posts author_id:integer
</shell>

NOTE: Due to the migration's name, Rails will automatically know that you want to add a column to a specific table and write that into the migration for you. You don't need to tell it any more than this.
NOTE: Due to the migration's name and the column specification after it, Rails will automatically know that you want to add a column to a specific table and write that into the migration for you. You don't need to tell it any more than this.

This migration will need to be run on the application. To do that, it must first be copied using this command:

<shell>
$ rake blorgh:install:migrations
</shell>

NOTE: Notice here that only _one_ migration was copied over here. This is because the first two migrations were copied over the first time this command was run.
Notice here that only _one_ migration was copied over here. This is because the first two migrations were copied over the first time this command was run.

And then migrated using this command:
<shell>
NOTE: Migration [timestamp]_create_blorgh_posts.rb from blorgh has been skipped. Migration with the same name already exists.
NOTE: Migration [timestamp]_create_blorgh_comments.rb from blorgh has been skipped. Migration with the same name already exists.
Copied migration [timestamp]_add_author_id_to_blorgh_posts.rb from blorgh
</shell>

Run this migration using this command:

<shell>
$ rake db:migrate
Expand Down

0 comments on commit 13e6f0c

Please sign in to comment.