Hacker News new | ask | show | jobs
by stemcc 3359 days ago
You can easily have schema-less with Postgres's jsonb data type.
1 comments

Not really. Postgres ORMs are not meant to do schema-less and tables still need to be created.
You're right that ORMs aren't really set up to use jsonb but it can be done. I've had pretty good success with a kind of "hybrid" putting most relational data in regular columns (with FK constraints) and adding flexible data in jsonb. The main trick is understanding how to build custom column types in whatever ORM you actually use.

I can imagine a future with specialized ORMs designed around jsonb, but the current state of the art is probably not as bad as you think.

In the .NET world, ServiceStack ORMLite has custom Postgres type attributes to use the jsonb and other fields automatically.

http://docs.servicestack.net/releases/v4.5.6#postgresql-data...

There is also Marten which is an ORM that offers a full document database interface all backed by Postgres JSON columns.

http://jasperfx.github.io/marten/documentation/documents/

You are implying you need an ORM for the simple key-value (jsonb) data access. I don't think you would benefit much.