Closed schoettl closed 2 years ago
You'll need to update the version bounds here, too - that function was introduced after 2.11.
You could use CPP
to work across persistent versions, but I'd rather have folks on newer versions 😄
So you say we better upgrade sooner than later?
Then, I'll need to change version boundaries to >= 2.13 && < 3?
yesod-form also advanced to 1.7.3 which I use and maybe that was the reason for stack resolving to use the incompatible persistent version.....
The next problem when I try to upgrade to a newer persistent version is this error:
/home/jakob/projects/yesod-scaffold/test/TestImport.hs:60:48: error:
• Couldn't match expected type ‘Text’
with actual type ‘Database.Persist.SqlBackend.Internal.SqlBackend’
• In the first argument of ‘getEscapedRawName’, namely ‘sqlBackend’
In the first argument of ‘map’, namely
‘(getEscapedRawName sqlBackend)’
In the expression: map (getEscapedRawName sqlBackend) tables
|
60 | let escapedTables = map (getEscapedRawName sqlBackend) tables
| ^^^^^^^^^^
I can't find ask
in the ChangeLog nor in Hoogle. How can I find out where it comes from and how to replace it? Oh, I finally found it in classy-prelude. But I'm afraid I don't understand the problem.
oh, i have the arguments backward, do a flip
or operator section or maybe getEscapedRawNameFunction
which will do m (Text -> Text)
and specialize to SqlBackend -> Text -> Text
Thanks @parsonsmatt, now I got it, too. Alright, I pushed a version that seems to work.
stack test and build are working.
I only slightly changed the package version boundaries to make resolver lts-19.29 and lts-19.30 happy.
Should we merge that into postgres branch? And other branches are rebased on that? (Haven't read the complete README yet.)
This now has a bunch of name shadowing warnings, anyone have thoughts on why that's happening?
[ 1 of 12] Compiling Model
/home/michael/haskell/yesod-scaffold/yesod-scaffold/src/Model.hs:23:1: error: [-Wname-shadowing, -Werror=name-shadowing]
This binding for ‘commentUserId’ shadows the existing binding
defined at src/Model.hs:23:1
|
23 | share [mkPersist sqlSettings, mkMigrate "migrateAll"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...
/home/michael/haskell/yesod-scaffold/yesod-scaffold/src/Model.hs:23:1: error: [-Wname-shadowing, -Werror=name-shadowing]
This binding for ‘commentMessage’ shadows the existing binding
defined at src/Model.hs:23:1
|
23 | share [mkPersist sqlSettings, mkMigrate "migrateAll"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...
Oh, I missed that – for me it looks like the template function share causes that. But "share" is not mentioned in the ChangeLog. I have no idea.
It's this fix which is in 2.14.0.2, but not backported to 2.13.
OK, so it's good for now and should resolve at the next upgrade (as soon a new LTS is available and the bounds on persistent*
in package.yml are increased to <2.15
)
Great, thanks! I've pushed the changes to the stack-templates repo.
Fixes #210
Thanks for your help @snoyberg and @parsonsmatt!
Now that I tried the current scaffold from scratch, I found that it works because persistent-postgresql have correct bounds in
package.yml
(<2.11). Maybe I just apply this bounds in my projects, too.I still created this PR as a basis for a future upgrade to a newer version of persistent. Hope that helps.