I see the options --show-indexes and --show-foreign-keys, but if I run annotate with them, I cannot get it to work. What is annotate looking for to be able to include these in the annotations? Is it looking at the DB migrations? Is it looking at belongs_to associations in the models? Both? Something else?
My migrations contains t.index statements within the create_table calls, as well as add_foreign_key statements as necessary. My models are for legacy tables and don't use the default :id column, so in the belongs_to associations I must use :foreign_key to specify the column. Like:
class MyModel
belongs_to :other_model, class_name: 'OtherModel',
primary_key: 'other_model_code',
foreign_key: 'my_model_code',
inverse_of: 'my_model'
end
So I'm not sure if I have something set up incorrectly, or if I'm possibly doing something else wrong. I'd appreciate any help.
Commands
$ bundle exec annotate --models --show-indexes --show-foreign-keys
Version
- annotate version: 3.2.0
- rails version: 7.0.8.3
- ruby version: 3.3.1
I see the options
--show-indexesand--show-foreign-keys, but if I run annotate with them, I cannot get it to work. What is annotate looking for to be able to include these in the annotations? Is it looking at the DB migrations? Is it looking atbelongs_toassociations in the models? Both? Something else?My migrations contains
t.indexstatements within thecreate_tablecalls, as well asadd_foreign_keystatements as necessary. My models are for legacy tables and don't use the default:idcolumn, so in thebelongs_toassociations I must use:foreign_keyto specify the column. Like:So I'm not sure if I have something set up incorrectly, or if I'm possibly doing something else wrong. I'd appreciate any help.
Commands
Version