4 ms·
We had to abandon Zapatos because a) it doesn’t support multiple schemas; b) the types wouldn’t always be very readable. PgTyped was the alternative, and 2 yea
by xctr94 3y ago
We had to abandon Zapatos because a) it doesn’t support multiple schemas; b) the types wouldn’t always be very readable.
PgTyped was the alternative, and 2 years later I’m very glad we made the switch.
- Exuma 3y agoWhat do you mean multiple schemas ? What is an example of a non readable type?
- pimeys 3y agoLike this, it's pretty common way to use Postgres (with multiple schemas): CREATE SCHEMA a; CREATE SCHEMA b; CREATE TABLE a.foo (id SERIAL PRIMARY KEY); CREATE TABLE b.foo (id SERIAL PRIMARY KEY);
- xctr94 3y agoI didn’t know support for schemas had landed, but the docs still seem obtuse for joins and upserts. Compared to plain SQL files in PgTyped — which admittedly needs some annotations to work, and lacks transactions —, I find the lateral joins in Zapatos really verbose and ugly. Lots of extra parameters too. Which isn’t to say it’s not a great tool! You pick what you like :)
- alde 3y agoGlad you are liking pgTyped. Transactions are supported as pgTyped is just a thin wrapper around node-postgres: https://github.com/adelsz/pgtyped/discussions/448 https://github.com/adelsz/pgtyped/discussions/448
- xctr94 3y agoAh, I meant having a single transaction in a SQL file, as that’s how we’re using it. So having multiple queries with a BEGIN and COMMIT wrapping them.
- hhfdsbvc 3y agoEver try drizzle?
- xctr94 3y agoI haven’t, but it’s an ORM so an automatic no. We tested 6 ORMs before deciding that plain SQL with introspection was the way to go. No regrets.
- 9dev 3y agoI don’t know if this has changed recently, but I’m using multiple schemas with Zapatos just fine. The type you can import looks like `auth.user.Selectable`, where auth is the schema and user the table.
- gmac 3y agoIt does now support multiple schemas: https://jawj.github.io/zapatos/#60 https://jawj.github.io/zapatos/#60