You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a foreign key specified in the database that isn't reflected when I create an er diagram.
ActiveRecord::Schema.define(version: 2020_09_09_163334)do# These are extensions that must be enabled in order to support this databaseenable_extension"pgcrypto"enable_extension"plpgsql"create_table"patients",id: false,force: :cascadedo |t|
t.integer"mrn",null: falset.datetime"created_at",precision: 6,null: falset.datetime"updated_at",precision: 6,null: falset.index["mrn"],name: "index_patients_on_mrn",unique: trueendcreate_table"samples",id: false,force: :cascadedo |t|
t.string"sample_id",null: falset.integer"patient_mrn",null: falset.datetime"created_at",precision: 6,null: falset.datetime"updated_at",precision: 6,null: falset.index["sample_id"],name: "index_samples_on_sample_id",unique: trueendadd_foreign_key"samples","patients",column: "patient_mrn",primary_key: "mrn",name: "key_samples_on_patient_mrn"endclassPatient < ApplicationRecordself.primary_key=:mrnhas_many:samples,primary_key: :mrn,foreign_key: :patient_mrnendclassSample < ApplicationRecordself.primary_key=:sample_idbelongs_to:patient,primary_key: :mrn,foreign_key: :patient_mrnend
The gem seems to mark columns as foreign keys only if the column and foreign_key attribute are the default types. Override them and FK won't show up in the er diagram.
The text was updated successfully, but these errors were encountered:
# Returns +true+ if this attribute is used as a foreign key for any# relationship.defforeign_key?@domain.relationships_by_entity_name(@model.name).map(&:associations).flatten.map{ |associaton|
associaton.send(Domain.foreign_key_method_name)}.include?(name)end
I dropped a binding.pry debugging statement into the code:
I have a foreign key specified in the database that isn't reflected when I create an er diagram.
The
.erdconfig
file:The ER Diagram
The gem seems to mark columns as foreign keys only if the
column
andforeign_key
attribute are the default types. Override them andFK
won't show up in the er diagram.The text was updated successfully, but these errors were encountered: