diff options
author | Frederick Cheung <frederick.cheung@gmail.com> | 2008-09-09 02:13:18 +0100 |
---|---|---|
committer | Frederick Cheung <frederick.cheung@gmail.com> | 2008-09-09 02:24:13 +0100 |
commit | fd8c38435e68cfcaeab90398e09e58b0fa15d127 (patch) | |
tree | 46f45ad618c94b5dfe61d009e5f5997bb032faec /railties/doc/guides/migrations | |
parent | 5e4aa0ca81222826d07ee83b68556289ec8b4b78 (diff) | |
download | rails-fd8c38435e68cfcaeab90398e09e58b0fa15d127.tar.gz rails-fd8c38435e68cfcaeab90398e09e58b0fa15d127.tar.bz2 rails-fd8c38435e68cfcaeab90398e09e58b0fa15d127.zip |
typo
Diffstat (limited to 'railties/doc/guides/migrations')
-rw-r--r-- | railties/doc/guides/migrations/migrations.txt | 7 | ||||
-rw-r--r-- | railties/doc/guides/migrations/scheming.txt | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/railties/doc/guides/migrations/migrations.txt b/railties/doc/guides/migrations/migrations.txt index ad20dcdf93..d7087d4044 100644 --- a/railties/doc/guides/migrations/migrations.txt +++ b/railties/doc/guides/migrations/migrations.txt @@ -1,9 +1,9 @@ Migrations ========== -Migrations are a convenient way for you to alter your database in a structured and organised manner. While you could edit fragments of SQL by hand it would then be up to you to tell other developers that they need to run your scripts when they next pull changes. You'd also have to keep track of which changes need to be run against the production machines next time you deploy. Active Record tracks which migrations have already been run so all you have to do is update your source and run `rake db:migrate`. Active Record will work out which migrations should be run. +Migrations are a convenient way for you to alter your database in a structured and organised manner. You could edit fragments of SQL by hand but you would then be responsible for telling other developers that they need to go and run it. You'd also have to keep track of which changes need to be run against the production machines next time you deploy. Active Record tracks which migrations have already been run so all you have to do is update your source and run `rake db:migrate`. Active Record will work out which migrations should be run. -Migrations also allow you to describe these transformation using ruby. The great thing about this is that (like most of Active Record's functionality) its database independent, you don't need to worry about the precise syntax of CREATE TABLE any more that you worry about variations on SELECT * (you can drop down to raw SQL for database specific features). For example you could use SQLite3 in development, but MySQL in production. +Migrations also allow you to describe these transformations using ruby. The great thing about this is that (like most of Active Record's functionality) its database independent, you don't need to worry about the precise syntax of CREATE TABLE any more that you worry about variations on SELECT * (you can drop down to raw SQL for database specific features). For example you could use SQLite3 in development, but MySQL in production. You'll learn all about migrations including: @@ -17,4 +17,5 @@ include::creating_a_migration.txt[] include::writing_a_migration.txt[] include::rakeing_around.txt[] include::using_models_in_migrations.txt[] -include::scheming.txt[]
\ No newline at end of file +include::scheming.txt[] +include::foreign_keys.txt[]
\ No newline at end of file diff --git a/railties/doc/guides/migrations/scheming.txt b/railties/doc/guides/migrations/scheming.txt index 5a2e04cf8c..8290f7116e 100644 --- a/railties/doc/guides/migrations/scheming.txt +++ b/railties/doc/guides/migrations/scheming.txt @@ -33,7 +33,7 @@ end In many ways this is exactly what it is. This file is created by inspecting the database and expressing its structure using `create_table`, `add_index` and so on. Because this is database independent it could be loaded into any database that Active Record supports. This could be very useful if you were to distribute an application that is able to run against multiple databases. -There is however a trade-off: `schema.rb` cannot express database specific items such as foreign key constraints. While in a migration you can execute custom sql statements, the schema dumper cannot reconstitute those statements from the database. If you are using features like this then you should set the schema format to `:sql`. +There is however a trade-off: `schema.rb` cannot express database specific items such as foreign key constraints, triggers or stored procedures. While in a migration you can execute custom sql statements, the schema dumper cannot reconstitute those statements from the database. If you are using features like this then you should set the schema format to `:sql`. Instead of using Active Record 's schema dumper the database's structure will dumped using a tool specific to that database (via the `db:structure:dump` rake task) into `db/#\{RAILS_ENV\}_structure.sql`. For example for postgresql the `pg_dump` utility is used and for mysql this file will contain the output of SHOW CREATE TABLE for the various tables. Loading this schema is simply a question of executing the sql statements contained inside. |