If you want to have referential integrity there's no other choice. Otherwise you create tables that have no relation to each other. No one stops you from doing this, but then you probably don't want an RDBMS in the first place.
It's madness, I know.
1. https://api.rubyonrails.org/classes/ActiveRecord/ConnectionA...
Thanks for that tidbit, I have no XP with Rails, but I would never imagine they do something so atrocious.
Some of that is compatibility reasons; not every DB Django supports would allow creating all the desired types of constraints in the DB, so Django has no choice but to ship application-layer enforcement.
You can work around that with manually-created migrations (and I've worked some places that did this, in order to get particular constraint types that were needed at the DB level), but I don't know of a good generic solution to that problem.
Django 2.2 is going with a somewhat-manual approach to allow specifying richer types of constraints, so maybe that'll lead to progress.
Then this line is generated `add_reference :things, :this, foreign_key: true`
and then we call the migration, and there is the foreign key.
By default the relationship constructors do not create foreign keys, if they did it would be redundant to include it in the generated output surely? At least that's what the docs seem to say.
rails g model Post user:references