Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✅ Drizzle: Fix Typesafety & Autocompletion #32

Open
blefnk opened this issue May 15, 2024 · 1 comment
Open

✅ Drizzle: Fix Typesafety & Autocompletion #32

blefnk opened this issue May 15, 2024 · 1 comment
Assignees
Labels
discussion Discussions
Milestone

Comments

@blefnk
Copy link
Owner

blefnk commented May 15, 2024

It's not an issue anymore, it's a story. Over several versions of Relivator and many months, I put a lot of effort into combining Postgres and MySQL as well as the providers of these services (Neon/Planetscale/Vercel/etc.) as best I could. This was necessary to have opportunity to change the provider only with the help of an .env file, means on-the-fly. I have to admit, it turned into hell.

So, typesafety was lost, and I spent a long time trying to provide the correct types, starting with importing Drizzle's own types with even trying to create my own types. But it always came down to the fact that Postgress and MySQL types were combined into one, which is why TypeScript could not cross them correctly, because there were some parameters somewhere and not others, I was have even trying to narrow down these types (and, yes, I learned TypeScript quite well thanks to this challenge). It was months, I'm a psycho I know, don't make the same mistakes, haha.

Working on the 1.2.6 update, I fixed typesafety and autocompletion. Now it's just a matter of uncommenting out a single needed line in the two index.ts files. And starting from 1.3.0, the project will have only Postgres (since Planetscale is now only paid, I think MySQL will lose a lot of popularity in the JS community). But don't worry, thanks to the Reliverse CLI, you can always bootstrap your own version of Relivator with MySQL, and even with Prisma 😉, if you need to.

I will leave this issue open here for a while longer so more people can see it. If anyone has any thoughts on this, please feel free to comment.

@blefnk blefnk added the discussion Discussions label May 15, 2024
@blefnk blefnk added this to the v1-v2 milestone May 15, 2024
@blefnk blefnk self-assigned this May 15, 2024
@blefnk blefnk changed the title Drizzle: Fix Typesafety & Autocompletion ✅ Drizzle: Fix Typesafety & Autocompletion May 15, 2024
@blefnk
Copy link
Owner Author

blefnk commented May 15, 2024

As mentioned in PR #29, I'm working on adding better-sqlite3 to the project. This will be delivered in Relivator 1.2.6 or 1.3.0. And also, the project will now have support for private/local Postgres and MySQL thanks to the mentioned PR. SQLite will be the standard provider once it is fully delivered, because it doesn't require any additional setup unlike local Postgres and MySQL. upd. As an option, SQLite will be default, but it will be possible to switch to Postgres manually by commenting out specific lines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Discussions
Projects
Status: In Progress
Development

No branches or pull requests

1 participant