Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Selda with something else #1302

Open
dhess opened this issue Nov 11, 2024 · 4 comments
Open

Replace Selda with something else #1302

dhess opened this issue Nov 11, 2024 · 4 comments
Assignees
Labels
database Database/persistence issue priority: low This issue has low priority

Comments

@dhess
Copy link
Member

dhess commented Nov 11, 2024

It's clear that Selda is unmaintained now. There's at least one community fork, but I'd prefer something where upstream has control over the Hackage story.

Given the future of this project is focused on running most things in-browser, including at least some level of persistence, SQLite support is still attractive, because there's been some success running SQLite in the browser via Wasm. In any case, I think our SQL needs may be quite a bit simpler than we originally anticipated. Therefore, something like https://hackage.haskell.org/package/sqlite-simple might be a good enough replacement for Selda.

Relevant links:

@dhess dhess added the database Database/persistence issue label Nov 11, 2024
@dhess dhess self-assigned this Nov 11, 2024
@dhess
Copy link
Member Author

dhess commented Jan 2, 2025

I'm inclined to punt on this for now. We've found a reasonably-maintained Selda fork, and it even builds for Wasm, so perhaps we should kick the can down the road until we run into a Selda-related showstopper.

@dhess dhess added the priority: low This issue has low priority label Jan 2, 2025
@dhess
Copy link
Member Author

dhess commented Jan 2, 2025

See also #1312.

@dhess
Copy link
Member Author

dhess commented Jan 2, 2025

As mentioned in #1312, it's likely we'll have to implement database init/migration in Haskell now, if we want Sqlite support in Wasm. Selda's migration support is known to be not very robust, so perhaps we should look more seriously at Beam: https://haskell-beam.github.io/beam/schema-guide/migrations/

edit: unfortunately, beam-sqlite doesn't currently build for Wasm:

Failed to build beam-sqlite-0.5.3.0.
Build log (
/Users/dhess/.ghc-wasm/.cabal/logs/ghc-9.10.1.20241209/bm-sqlt-0.5.3.0-67fa3b91.log
):
Configuring library for beam-sqlite-0.5.3.0...
Preprocessing library for beam-sqlite-0.5.3.0...
Building library for beam-sqlite-0.5.3.0...
Database/Beam/Sqlite/Connection.hs:97:2: error:
     error: Need either POSIX or Win32 API for MonadBeamInsertReturning
       97 | #error Need either POSIX or Win32 API for MonadBeamInsertReturning
          |  ^
   |
97 | #error Need either POSIX or Win32 API for MonadBeamInsertReturning
   |  ^

Database/Beam/Sqlite/Connection.hs:397:2: error:
     error: Need either POSIX or Win32 API for MonadBeamInsertReturning
      397 | #error Need either POSIX or Win32 API for MonadBeamInsertReturning
          |  ^
    |
397 | #error Need either POSIX or Win32 API for MonadBeamInsertReturning
    |  ^

2 errors generated.
Database/Beam/Sqlite/Connection.hs:97:2: error:
     error: Need either POSIX or Win32 API for MonadBeamInsertReturning
       97 | #error Need either POSIX or Win32 API for MonadBeamInsertReturning
          |  ^
   |
97 | #error Need either POSIX or Win32 API for MonadBeamInsertReturning
   |  ^

Database/Beam/Sqlite/Connection.hs:397:2: error:
     error: Need either POSIX or Win32 API for MonadBeamInsertReturning
      397 | #error Need either POSIX or Win32 API for MonadBeamInsertReturning
          |  ^
    |
397 | #error Need either POSIX or Win32 API for MonadBeamInsertReturning
    |  ^

2 errors generated.
Database/Beam/Sqlite/Connection.hs:1:1: error:
    `wasm32-wasi-clang' failed in phase `Haskell C pre-processor'. (Exit code: 1)
  |
1 | {-# OPTIONS_GHC -fno-warn-orphans #-}
  | ^

Error: [Cabal-7125]
Failed to build beam-sqlite-0.5.3.0 (which is required by test:primer-selda-test from primer-selda-0.7.2.0, exe:primer-miso from primer-miso-0.8.0.0 and others). See the build log above for details.

make: *** [Makefile.wasm32:11: build] Error 1

Upstream issue:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
database Database/persistence issue priority: low This issue has low priority
Projects
None yet
Development

No branches or pull requests

1 participant