suborbital / reactr

Function scheduler for Go & WebAssembly
Apache License 2.0
289 stars 28 forks source link

SQLite backend for the database API #263

Open flaki opened 2 years ago

flaki commented 2 years ago

It feels like we are not missing much to be able to support SQLite as an SQL connection backend, which would be a big DevEx win, especially for bootstrappers.

As @jagger27 points out "SQLite is not particularly connection-oriented", but being able to start from a dependency-free SQL connection in local dev, and switching that to something more production-ready (MySQL, Postgres) when deploying would make for a much more seamless developer experience then fiddling with Docker Compose scripts and local Postgres instances.

connections > database in the Directive.yaml already has all we need:

# ...
connections:
  database:
    type: sqlite

Initially that's all we would need, we could use the simplicity (and e.g. lack of further configuration, such as storage filename) to further imply this is not intended for more complex apps, but to provide a "baseline" persistent storage.

With this people could build their persistence model quickly and swap out the storage model for their production deployment.

In the future we could build on this sqlite support to expand to more production-ready configs, like Litestream.