top | item 40325485

(no title)

_AzMoo | 1 year ago

Coupling your API to your database schema is a bad idea. Once you have clients consuming that API you can no longer make changes to your database schema without also updating all of those clients and coordinating their deployments. Advice like this reads like it's coming from somebody that's never stayed in a role long enough to deal with the consequences of their actions.

discuss

order

fzeindl|1 year ago

> Coupling your API to your database schema is a bad idea. Once you have clients consuming that API you can no longer make changes to your database schema without also updating all of those clients and coordinating their deployments.

This is not correct. Whenever you need to change an API you need to upgrade your clients or you add a new version of the API. With PostgREST the versions of the API are served as views or functions that internally map to internal tables. It is absolutely possible to change the tables without changing the API.

simonw|1 year ago

You can work around this with SQL views. Design your externally facing API using views that expose a subset of your overall schema.

If you need to change that schema you can update the views to keep them working.

est|1 year ago

> you can no longer make changes to your database schema without also updating all of those clients

and that was a solved problem from 90s C/S architecture, it's called views.

https://www.postgresql.org/docs/current/tutorial-views.html

Today's B/S shit was a painful and slow reinvention of old things.