aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2015-01-29 20:53:55 -0200
committerRafael Mendonça França <rafaelmfranca@gmail.com>2015-01-29 20:53:55 -0200
commit455e663c667a3c97e37b71b52100a965b384f2f7 (patch)
tree78533b09b13d80156b9beed4d2e6f7c070bd63a3 /guides
parent15200ade6fccd1aebf4b7c96b6dea907f43edad3 (diff)
parent3f11bc00d76dc323a5699762e31138924b24e495 (diff)
downloadrails-455e663c667a3c97e37b71b52100a965b384f2f7.tar.gz
rails-455e663c667a3c97e37b71b52100a965b384f2f7.tar.bz2
rails-455e663c667a3c97e37b71b52100a965b384f2f7.zip
Merge pull request #18734 from andreynering/docs-dumping
Improvements about schema dumping [ci skip]
Diffstat (limited to 'guides')
-rw-r--r--guides/source/active_record_migrations.md15
1 files changed, 10 insertions, 5 deletions
diff --git a/guides/source/active_record_migrations.md b/guides/source/active_record_migrations.md
index 97cabc1728..b8db21a989 100644
--- a/guides/source/active_record_migrations.md
+++ b/guides/source/active_record_migrations.md
@@ -479,7 +479,8 @@ Rails will generate a name for every foreign key starting with
There is a `:name` option to specify a different name if needed.
NOTE: Active Record only supports single column foreign keys. `execute` and
-`structure.sql` are required to use composite foreign keys.
+`structure.sql` are required to use composite foreign keys. See
+[Schema Dumping and You](#schema-dumping-and-you).
Removing a foreign key is easy as well:
@@ -695,6 +696,10 @@ of `create_table` and `reversible`, replacing `create_table`
by `drop_table`, and finally replacing `up` by `down` and vice-versa.
This is all taken care of by `revert`.
+NOTE: If you want to add check constraints like in the examples above,
+you will have to use `structure.sql` as dump method. See
+[Schema Dumping and You](#schema-dumping-and-you).
+
Running Migrations
------------------
@@ -943,10 +948,10 @@ 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: `db/schema.rb` cannot express database specific
-items such as 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`.
+items such as triggers, stored procedures or check 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`.
Instead of using Active Record's schema dumper, the database's structure will
be dumped using a tool specific to the database (via the `db:structure:dump`