DB PostgreSQL support

I’m running PostgreSQL for my Mastodon instance, and I’d like to use the same DB for writely to save resources and keep costs down.

Any chance of supporting a DB abstraction to allow both maria and PostgreSQL?

The next (and likely final) database engine the team is going to build support for will be SQLite. Our primary goal is to make WriteFreely installation as easy as possible, so that’ll help everyone avoid these relatively heavy engines and keep everything self-contained. However, if anyone in the community wants to contribute the changes necessary for PostgreSQL support – and especially if they want to help maintain it – we’ll gladly welcome that.

With SQLite support we’ll also add test cases to ensure database functions work consistently across different storage engines, etc., so those changes should make supporting other backends (like PostgreSQL) much easier.

(Note: we’ll continue the previous GitHub discussion about this on this thread.)

I’ll be working on the SQLite support this weekend. While I’m doing that work, I’ll also be noting things that might need to be changed to work with PostgreSQL.

1 Like

Awesome, that’ll help a lot :+1:

+1 for wanting PostgreSQL support, other federated software uses it as well (Mastodon, Pleroma, Matrix) so it’s nice to run them all in the same db server

Is anybody else working on this right now?

Would people be happy to see Postgres support shoe-horned into the existing database.go, or would some other approach be needed?

Bump. I’m all for SQLite as a primary DB if that’s the goal…

but mastodon/pixelfed/funkwhale and others are all on postgres… so I’m keen on hosting less moving parts

We’ll be happy to support Postgres as well – we just doesn’t have the bandwidth for all that extra maintenance work without dedicated funding or development help from the community.

MySQL is our priority since we use it in production on Write.as, and SQLite ensures WriteFreely is easy to deploy, a primary product goal for us. So we just need some extra help for other DB engines.

@robw Adding it into database.go should work just fine! Everything else is in there already.