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 am unsure if this is intentional - in which case this is a request for improvement - or not - in which case this is a bug report.
The foreign key constraint name is weird: it seems that the (mandatory) constraint name passed in the quasi quoter is appended with no separator (e.g. _) to the FK table name.
FYI I use:
Stack with resolver lts-16.5, so Persistent 2.10.5.2 and Persistent Template 2.8.2.3
PostgreSQL 11.8
To reproduce:
share
[mkPersist sqlSettings, mkMigrate "migrateAll"]
[persistLowerCase|
FooBar
foo String
bar Bool
Primary foo bar
deriving Show
FooBarBaz
foo String
bar Bool
baz Int
Primary foo bar baz
Foreign FooBar fk_something foo bar
deriving Show
|]
The foreign key constraint is named foo_bar_bazfk_something, i.e. it appends the table name foo_bar_baz to the provided QQ name fk_something with no separator.
While I don't mind being forced to prefix with the table name foo_bar_baz, I don't understand why there isn't at least a separator _ between the table name and the given suffix (so it would be foo_bar_baz_fk_something). And it's illegal (doesn't compile) to write Foreign FooBar _fk_something foo bar.
What do you think?
Cheers!
The text was updated successfully, but these errors were encountered:
To fix this, we'll want to introduce a field on the relevant Settings datatype that accepts a "foreign key first character" - eg mkPersistSettingsTableSeparator :: Maybe Text - with a default value of Nothing. Users can opt in to Just "_" or similar. This would be a breaking change, but could land in 2.11 or 2.12.
Hello,
I am unsure if this is intentional - in which case this is a request for improvement - or not - in which case this is a bug report.
The foreign key constraint name is weird: it seems that the (mandatory) constraint name passed in the quasi quoter is appended with no separator (e.g.
_
) to the FK table name.FYI I use:
lts-16.5
, so Persistent2.10.5.2
and Persistent Template2.8.2.3
11.8
To reproduce:
The foreign key constraint is named
foo_bar_bazfk_something
, i.e. it appends the table namefoo_bar_baz
to the provided QQ namefk_something
with no separator.While I don't mind being forced to prefix with the table name
foo_bar_baz
, I don't understand why there isn't at least a separator_
between the table name and the given suffix (so it would befoo_bar_baz_fk_something
). And it's illegal (doesn't compile) to writeForeign FooBar _fk_something foo bar
.What do you think?
Cheers!
The text was updated successfully, but these errors were encountered: