I am trying to merge an old, legacy Rails 3 app into a more recent Django app.
Both apps used to use different databases, which are being merged into one unique database usable by both apps. The Django app will slowly take over the functionality of the old Rails app, starting with the migrations.
Django enforces strict database constraints in its migrations (e.g. NOT NULL fields with defaults). Any new fields on a table that is used by both apps will prevent Rails from updating records on that table, because ActiveRecord forcefully inserts NULL values instead of defaults.
Since we won't be adding new features to the Rails app, I'd like it to stick to a list of fields and ignore any newly-added fields.
The following answer using default_scope breaks other scopes, so I'd like to avoid it.
Triggers are an option, but I'm not keen on adding cruft to the Django app, just to deal with legacy code in the Rails app.
Hence : Can I manually define columns in my models instead of letting ActiveRecord inspect the database automatically?
Aucun commentaire:
Enregistrer un commentaire