PostgreSQL support
-
@miwilc don't think it would be suitable for the nodebb perspective. Actually redis and mongodb are supported, both connectors using the same API that was firstly created with redis in mind, with a key/value approach under 1 collection.
Sure it can be done using postgresql, but a connector should be made, and it would have to use same approach as the existing ones, and would't make more sense using a relational database.
-
@jarey I think SQL matches pretty closely to what NodeBB has already implemented in terms of database functionality. I'd like to see a PostgreSQL adapter as a replacement for MongoDB since NodeBB really doesn't use many of the document-store features of Mongo.
-
I mean, the whole k/v thing was weird to me from the start. I think writing a wrapper around the database stuff and then in the future maybe being able to do
npm i nodebb-database-redis
,npm i nodebb-database-mongo
,npm i nodebb-database-postgresql
, etc. would be awesome. Also because everyone could help writing these wrappers for new databases etc. -
@lenovouser I agree, it would be good to allow the database adapter to be a module.
I would like to point out that the adapters are already modular, though, and you can add new ones yourself as long as they match the existing adapters.
-
@PitaJ what i means is that i don't think relational databases are really suitable for the squeme that nowadays provides nodebb. Only one table with string key and blob for values seems a bit awkward in terms of relational database use.
If you refer of having the actual model implementing an ER approach, i think it would be fantastic too. But don't know how would you achieve a schemaless model implementation under relational databases without storing all info in a blob or something similar. Sure a global schema for the core features would be plaussible since it could be maintained by nodebb team and supported between versions upgrades; but plugin-wise it would be a little more complicated to mantain the model in a flexible way.
-
@jarey a relational database is obviously much more than Redis. However, I think a relational DB like PostgreSQL is much closer to a basic k/v DB than something like MongoDB.
-
@PitaJ said in PostgreSQL support:
@jarey a relational database is obviously much more than Redis. However, I think a relational DB like PostgreSQL is much closer to a basic k/v DB than something like MongoDB.
I don't agree there. MongoDB being schemaless for me is an easy way to work with the javascript objects in json. I think it would be harder to work with traditional relational databases like PostgreSQL in that approach. If you don't see MongoDB suitable, because its collection model is not used by Nodebb, the table model around PostgreSQL wouldn't be used either with the additional problem of being tied to an specific schema if you don't model all data with key/blob.
Another thing would be talking about using PostgreNoSQL, in that case i suppose it would be nearly-equivalent to redis key/value.
-
MongoDB being schemaless for me is an easy way to work with the javascript objects in json. I think it would be harder to work with traditional relational databases like PostgreSQL in that approach.
I'm not talking about whatever your specific use case is, I'm only talking about how NodeBB/database works.
If you don't see MongoDB suitable, because its collection model is not used by Nodebb, the table model around PostgreSQL wouldn't be used either with the additional problem of being tied to an specific schema if you don't model all data with key/blob.
What I'm saying is that the relational table structure (SQL) is closer to key/value (Redis) than the document-store structure (Mongo). Obviously that doesn't matter when talking about NodeBB/database since it doesn't using any of those specific features. It essentially just emulates Redis on top of Mongo, which a Postgre adapter would also do.