IHP is a modern batteries-included haskell web framework, built on top of Haskell and Nix. Blazing fast, secure, easy to refactor and the best developer experience with everything you need - from prototype to production.
This release brings many small quality of life improvements to IHP, fixes lots of bugs and comes with several helpful documentation improvements. There's been over 190 commits since v1.2.0
Major Changes
-
New CLI command:
new-session-secret
:
Until now it's always been a bit tricky to get a new secret for theIHP_SESSION_SECRET
env var. To fix that we've added a newnew-section-secret
command. Run it from the command line inside your IHP project, and it will generate a new random key to use for theIHP_SESSION_SECRET
env var:$ new-session-secret 1J8jtRW331a0IbHBCHmsFNoesQUNFnuHqY8cB5927KsoV5sYmiq3DMmvsYk5S7EDma9YhqZLZWeTFu2pGOxMT2F/5PnifW/5ffwJjZvZcJh9MKPh3Ez9fmPEyxZBDxVp
-
Proper support for non
id
primary keys:
Previously IHP assumed that your tables primary keys are calledid
, and that you don't use composite primary keys.With this release the following SQL schema will compile without any errors:
CREATE TABLE bits ( bit_arbitrary_ident UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL ); CREATE TABLE parts ( part_arbitrary_ident UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL ); CREATE TABLE bit_part_refs ( bit_ref UUID NOT NULL, part_ref UUID NOT NULL, PRIMARY KEY(bit_ref, part_ref) );
-
GHC Upgrade: 9.4 -> 9.8.2
-
New Function:
sqlQuerySingleRow
:
Runs a raw sql query, that is expected to return a single result row
Like 'sqlQuery', but useful when you expect only a single row as the resultdo user <- sqlQuerySingleRow "SELECT id, firstname, lastname FROM users WHERE id = ?" (Only userId)
-
New Function:
sqlExecDiscardResult
:
Runs a sql statement (like aCREATE
statement), but doesn't return any resultsqlExecDiscardResult "CREATE TABLE users ()" ()
There's now also
updateRecordDiscardResult
, which is likeupdateRecord
, but doesn't return the updated record. -
Worker support exponential backoff:
instance Job DraftEmailJob where backoffStrategy = ExponentialBackoff { delayInSeconds = 30 } perform job = do -- ...
Minor Changes
- DataSync: Configurable message timeout
- HSX: Allow attributes sse-connect and sse-swap
- Allow a submit button to be disabled
- Use a more robust check for
isUrl
validator validateMaybe
: Helper to allowvalidateField
to work on Maybe valuesfileOrNothing
should check fileContent isn't empty- Add debounce to fsnotify
- Form: Add
urlField
- ihp-new: Remove cachix install step
- Remove HLS config initialization
- nix: Extracted out duplicate binary cache config
- Fixed base64 error when deploying with deploy-to-nixos
- Fixed migrate service failing to build when the IHP app has no migrations yet
- nix: Fixed some postgres settings in appWithPostgres nixos config
- Disable nix sandbox for deploy-to-nixos: This makes it work better out of the box with projects that use npm
- ihp-new: Create git repo to avoid issues when IHP is part of a larger git repo
- Allow optimized builds with deploy-to-nixos
- deploy-to-nixos: Fixed db init script
- Use built-in ping pong mechanism of the latest version of websockets
- Fixed npm install when running an IHP app on latest nixpkgs
- deploy-to-nixos: Fixed database being used before it has been created
- deploy-to-nixos: Switch to the right user before creating tables
- Remove unused datePickers code
- Allow easier SMTP config envs
- Add loadSchema service
- Worker: Write to log instead of using putStrLn
- Worker: Fixed poller not scheduling concurrent jobs
- Allow sql dumping via the Makefile
- Fixed Underscore in ID column leads to compile error in code generation
- Fix SchemaCompiler to support non-id-pks
- Made request logger less verbose by not logging requests to static files: This was the existing behaviour until we switched out the static middleware a while ago
- make it easier to spot schema + fixture errors
- Only track exception (e.g. with sentry) in production: This was the expected behaviour, but turns out I missed one place
- ihp-openai: Don't use deprecated prompt anymore, as we mostly use the chat API
- ihp-openai: Added missing assistantMessage
- Simplify session vault key handling: Moved the session vault key from the ApplicationContext and RequestContext data structure to a global variable. This is the suggested way by the WAI developers.
- Allow overriding the logger in the controller context
- fixed long constraint names cause verbose patches in migrations
- Pin devenv to a stable release
- Document creation of Docker with Nix and Podman
Docs
- Show example how to send a link from Mail
- Update tailwindcss instructions
- Improvements to the emacs documentation (you're better off with vim)
- Add docs about Unique Constraints
- Docs about Passing JSON to the View
Full Changelog: v1.2.0...v1.3.0
Updating
→ See the UPGRADE.md for upgrade instructions.
If you have any problems with updating, let us know on the IHP Discourse.
📧 To stay in the loop, subscribe to the IHP release emails (right at the bottom of the page). Or follow digitally induced on twitter.