|
|
|
|
|
by pilotdeveloper
1088 days ago
|
|
I think I expressed myself in a confusing manner.
I write _SQL_ for migrations and nothing else. What I meant was that in order to _run_ the migrations it's enough to have a simple bash script of a few lines (which basically calls psql, ls and feeds the sql migration files in order). I don't use jsonb with migrations. My migration files look like migrations/1645698230_create_orders.sql
create table orders (.... ); migrations/164595623_setup_some_trigger.sql
create trigger... -------- In response to "Elimination of boilerplate to load data from a table into a type" Unrelatedly to migrations, when working with postgres, I use postgres'json capabilites to get nice nested structures that I can convert to any other language easily (or even send it to the browser if serving a webpage). Instead of using tabular responses, I get json structures _directly_ from postgresql. Very often I just write SQL queries that return a single row with a single json/jsonb field that has the whole JSON response to be served to a web endpoint. Basically I write most if not all my webservice in SQL. And I just have a very thin layer of a server language to work as a proxy between a frontend application and my database application (written in SQL). |
|