fix #280 by changing the regex used for fk resolution
Signed-off-by: Sean Corfield <sean@corfield.org>
This commit is contained in:
parent
9e914bc5e1
commit
c77f7539c6
2 changed files with 11 additions and 1 deletions
|
|
@ -3,6 +3,7 @@
|
|||
Only accretive/fixative changes will be made from now on.
|
||||
|
||||
* 1.3.next in progress
|
||||
* Fix [#280](https://github.com/seancorfield/next-jdbc/issues/280) by allowing `-` as well as `_` in `nav` foreign key names.
|
||||
* Update dev dependencies, including testing against Clojure 1.12 Alpha 11.
|
||||
|
||||
* 1.3.925 -- 2024-03-15
|
||||
|
|
|
|||
|
|
@ -1037,7 +1037,7 @@
|
|||
(let [fk-suffix (get-in opts [:schema-opts :fk-suffix] "id")
|
||||
pk (get-in opts [:schema-opts :pk] "id")
|
||||
pk-fn (get-in opts [:schema-opts :pk-fn] (constantly (name pk)))
|
||||
[_ table] (re-find (re-pattern (str "(?i)^(.+?)_?"
|
||||
[_ table] (re-find (re-pattern (str "(?i)^(.+?)[-_]?"
|
||||
(name fk-suffix)
|
||||
"$"))
|
||||
(name col))]
|
||||
|
|
@ -1050,8 +1050,10 @@
|
|||
(default-schema {} :user_statusid)
|
||||
(default-schema {:schema-opts {:fk-suffix "did"}} :user_id)
|
||||
(default-schema {:schema-opts {:fk-suffix "did"}} :user_did)
|
||||
(default-schema {:schema-opts {:fk-suffix "did"}} :user-did)
|
||||
(default-schema {:schema-opts {:fk-suffix "(did|id)"}} :user_id)
|
||||
(default-schema {:schema-opts {:fk-suffix "(did|id)"}} :user_did)
|
||||
(default-schema {:schema-opts {:fk-suffix "(did|id)"}} :user-did)
|
||||
(default-schema {:schema-opts {:fk-suffix "(did|id)"
|
||||
:pk :did}} :user_did)
|
||||
(default-schema {:schema-opts {:fk-suffix "(did|id)"
|
||||
|
|
@ -1061,6 +1063,13 @@
|
|||
"id"
|
||||
pk))}}
|
||||
:user_did)
|
||||
(default-schema {:schema-opts {:fk-suffix "(did|id)"
|
||||
:pk :did
|
||||
:pk-fn (fn [table pk]
|
||||
(if (= "user" table)
|
||||
"id"
|
||||
pk))}}
|
||||
:user-did)
|
||||
(default-schema {:schema-opts {:fk-suffix "(did|id)"
|
||||
:pk :did
|
||||
:pk-fn (fn [table pk]
|
||||
|
|
|
|||
Loading…
Reference in a new issue