aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/active_record_migrations.md
diff options
context:
space:
mode:
authorYasuo Honda <yasuo.honda@gmail.com>2017-08-22 18:49:50 +0000
committerYasuo Honda <yasuo.honda@gmail.com>2017-08-22 19:32:45 +0000
commit43c6a683f2caad47b87c5d6a263865cd0db6174f (patch)
tree4b737992738b3cd0f59f4aaf22459db3b753be0b /guides/source/active_record_migrations.md
parent665ac7cff212d010a3573f85cea895666fbaad15 (diff)
downloadrails-43c6a683f2caad47b87c5d6a263865cd0db6174f.tar.gz
rails-43c6a683f2caad47b87c5d6a263865cd0db6174f.tar.bz2
rails-43c6a683f2caad47b87c5d6a263865cd0db6174f.zip
Load both `:authors` and `:author_addresses` to keep data integrity
`:authors` has a foreign key to `:author_addresses`. If only `:authors` fixture loaded into the database which supports foreign key and checks the existing data when enabling foreien keys like Oracle, it raises the following error `ORA-02298: cannot validate (ARUNIT.FK_RAILS_94423A17A3) - parent keys not found` It is because there is no parent data exists in `author_addresses` table. Here are how other database with foreign key support works: - MySQL does not check the existing data when enabling foreign key by `foreign_key_checks=1` https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_foreign_key_checks > Setting foreign_key_checks to 1 does not trigger a scan of the existing table data. Therefore, rows added to the table while foreign_key_checks=0 will not be verified for consistency. - PostgreSQL database itself has a feature to check existing data when enabling foreign key and discussed at #27636, which is reverted.
Diffstat (limited to 'guides/source/active_record_migrations.md')
0 files changed, 0 insertions, 0 deletions