k1LoW / tbls

tbls is a CI-Friendly tool for document a database, written in Go.
MIT License
3.34k stars 164 forks source link

Add a NamingStrategy to map Post.user_id → User.user_id style detected relation #466

Closed s3i7h closed 1 year ago

s3i7h commented 1 year ago

I encountered a niche case where primary keys are named tablename_id, and wanted tbls to be able to detect the relation.

This PR adds:

My concern about this is that other NamingStrategy's can be introduced and the combination will blow up. If that's the case, separating the NamingStrategy config into two parts and letting ParentTableNamer and ParentColumnNamer be specified separately might be good maybe??

k1LoW commented 1 year ago

@yu-ichiro Thank you for your commit!

My concern about this is that other NamingStrategy's can be introduced and the combination will blow up. If that's the case, separating the NamingStrategy config into two parts and letting ParentTableNamer and ParentColumnNamer be specified separately might be good maybe??

We don't think the number of strategies will increase that much, so we don't think it will be a problem 👍

k1LoW commented 1 year ago

Maybe 😄