Conversation
Co-authored-by: djezzzl <9407725+djezzzl@users.noreply.github.com>
|
@copilot fix CI |
…ts? unavailable in AR 4.2) Co-authored-by: djezzzl <9407725+djezzzl@users.noreply.github.com>
Fixed in ff1068f. The failure was in the |
Co-authored-by: djezzzl <9407725+djezzzl@users.noreply.github.com>
Done in dcda624. Changed |
ActiveRecord cannot derive a
primary_keyfrom schema introspection when a model points to a view. This checker enforces that such models explicitly declareself.primary_key =and that the declared column(s) actually exist in the view.Changes
ViewPrimaryKeyChecker(model_checkers/) — runs only whenconnection.view_exists?(model.table_name)(AR 5.0+); reports two distinct failure modes::view_missing_primary_key—primary_keyis nil/blank:view_primary_key_column_missing—primary_keyset but column(s) absent from the viewViewMissingPrimaryKeyandViewPrimaryKeyColumnMissingwith human-readable messagesdatabase_consistency.rbExample output
Fix by adding to the model:
Original prompt
primary_keyfor models that are pointing to views #281✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.