dbix class - Relationship bridges in DBIC -
i have several bridges in 1 result class, have relationship same another result class. example in text class have several bridges user class. then, named default users , users_2s. can remap names rel_name_map option, question whether there semantic behind namings? how decided 1 named users , 1 named users_2s? maybe if create tables in order on machine relationships named in order , users become users_2s , vice versa? if use rel_name_map , decide rename them can sure order preserved?
short answer: database has names bridges, , dbix::class use names. you're safe having them being renamed between runs long aren't changing database between runs.
if @ database right tools/commands should see names "users" , "user_2s" associated bridges. each "bridge" foreign key constraint, , such has name in source database schema. library function dbix::class::schema::loader::dbi::_table_fk_info
calls dbd handler's foreign_key_info method bridges, , uses given name.
if handler doesn't return foreign-key names will generate new name, using format: __dcsld__$i
, $i
number starting @ 1. numbering change if in-database schema changes.
that dscld
stands dbix::class::schema::loader
- , doesn't match bridge names, code must getting names database.
Comments
Post a Comment