drawdb-io / drawdb

Free, simple, and intuitive online database design tool and SQL generator.
https://drawdb.vercel.app
MIT License
12.09k stars 855 forks source link

Auto swap for foreign key name #79

Closed nchj closed 1 month ago

nchj commented 2 months ago

IF I create a table A with column id, Table B with column id and a_id, then A.id and B.a_id is a one to many relation

when i drag b.a_id to a.id the relation name is called B_a_id_fk, and A is primary and B is foreign, this is correct

图片

but, when i drag a.id to b.a_id, the relation name is called A_id_fk, B is primary, A is foreign, this is not correct,

图片

so, i can use swap function to adjust which is the primary, then A is primary and B is foreign, this is correct, but the foreign key name is also called A_id_fk

图片

so can it autoamtically correct the fk name when swap?

l123wx commented 1 month ago

I have implemented this feature in pr #94 : )