diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2015-05-04 22:43:07 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2015-09-20 12:46:11 +0900 |
commit | fdf371ab0697d43c7eec66418edda9017be9b75b (patch) | |
tree | 2e6bbd7ef3012b13fa55e74c474029f0ad5e61a9 /actionpack/lib/action_controller/railtie.rb | |
parent | 26aa1b58b0e9451d15a0ee32da3c004d44e5a356 (diff) | |
download | rails-fdf371ab0697d43c7eec66418edda9017be9b75b.tar.gz rails-fdf371ab0697d43c7eec66418edda9017be9b75b.tar.bz2 rails-fdf371ab0697d43c7eec66418edda9017be9b75b.zip |
Support for foreign keys in create table
If foreign keys specified in create table, generated SQL is slightly more
efficient.
Definition:
```
create_table :testings do |t|
t.references :testing_parent, foreign_key: true
end
```
Before:
```
CREATE TABLE "testings" ("id" serial primary key, "testing_parent_id" integer);
ALTER TABLE "testings" ADD CONSTRAINT "fk_rails_a196c353b2" FOREIGN KEY ("testing_parent_id") REFERENCES "testing_parents" ("id");
```
After:
```
CREATE TABLE "testings" ("id" serial primary key, "testing_parent_id" integer, CONSTRAINT "fk_rails_a196c353b2" FOREIGN KEY ("testing_parent_id") REFERENCES "testing_parents" ("id"));
```
Diffstat (limited to 'actionpack/lib/action_controller/railtie.rb')
0 files changed, 0 insertions, 0 deletions