3 ms·
I was stumped on how to integrate Postgres schemas + TypeScript types, so I visited HN, and this thread helped me move forward. My project is a game, the clien
by EarthLaunch 4y ago
I was stumped on how to integrate Postgres schemas + TypeScript types, so I visited HN, and this thread helped me move forward.
My project is a game, the client/server uses WebSocket rather than a normal REST API.
I have used Prisma, Knex, TypeORM. Seems to me that ideally, we would write types in TypeScript and have a DB schema generated from those, including automatic migrations based on schema diffing like Prisma. Then we only need to know TS, not another DSL.
We don't want to generate TS types from the DB because then we have no way of versioning the DB schema (except by writing SQL or DSL migrations).
I ended up finding https://deepkit.io/library/orm https://deepkit.io/library/orm and I'm going to try it out. (Not associated with project)
- johnny22 4y agoare you familiar with mikro-orm ?
- EarthLaunch 4y agoThank you for mentioning it, that made me take a re-look. I find the schema generator doc[0] hard to digest. But I do like that it uses the 'do one thing well' philosophy. Deepkit allows using just the ORM package, but I appreciate how detailed the warnings are on the mikroorm doc. 0: https://mikro-orm.io/docs/schema-generator https://mikro-orm.io/docs/schema-generator
- deleted 4y ago[deleted]