3 ms·
Prisma is pretty good, but the migrations system doesn't really compare. If your answer to many (any?) migrations is "blow away the existing database", that's n
by DangitBobby 4y ago
Prisma is pretty good, but the migrations system doesn't really compare. If your answer to many (any?) migrations is "blow away the existing database", that's not gonna work for me. Another thing that's not gonna work for me is generating each migration by hand with SQL specific to the dialect that youre using in development, now that I'm spoiled with Django's auto-migrations. I've had good success with Prisma by using Django to simply manage the schema and using `prisma pull db` (though Prisma unfortunately errors if you are using the default type for primary keys, AutoBigInteger because it can't handle BigNumber). Prisma is basically the ORM I had in mind when I said "there has been work in this space", FYI.
I have only used NextAuth a tiny bit, but it wasn't clear to me how to, for example, extend the user model to add fields to users. I would appreciate it if you have any resources you could point me to for an example or explanation on how to achieve that. I also did not find documentation about how to add my own authentication adapter (or plugin or whatever language they use).
- reducesuffering 4y agoExtend the User model in Prisma: https://github.com/t3-oss/create-t3-app/blob/main/cli/template/addons/prisma/auth-schema.prisma#L48-L56 https://github.com/t3-oss/create-t3-app/blob/main/cli/templa... Here's the file you add auth "providers": https://github.com/t3-oss/create-t3-app/blob/main/cli/template/addons/next-auth/api-handler-prisma.ts#L9-L28 https://github.com/t3-oss/create-t3-app/blob/main/cli/templa... Custom providers: https://next-auth.js.org/configuration/providers/oauth#using-a-custom-provider https://next-auth.js.org/configuration/providers/oauth#using...
- DangitBobby 4y agoHow does your random link to a Prisma schema relate to next-auth? Did that come from next-auth documentation? Cool, how do I make a provider? That's pretty anemic documentation. I feel literally 0% more informed about the process. Obviously I could go through the fucking source code to find out how custom oauth providers were implemented! But I don't care about oauth 99% of the time! What I actually want is username/password login with session cookies. How do I do that? > The Credentials provider allows you to handle signing in with arbitrary credentials, such as a username and password, domain, or two factor authentication or hardware device (e.g. YubiKey U2F / FIDO). > It is intended to support use cases where you have an existing system you need to authenticate users against. What if I want session cookies instead of JWT? And there's no default schema (which is because it has no baked in ORM or database management, to be fair), so I have to go through the boilerplate of defining it in in every new project. And I'll have to figure out how to do permission based access and groups. This is all table stakes, for me. Next Auth isn't actually taking care of any of the hard parts of my use case. It just doesn't have the bare minimum that I need it to have to be a suitable replacement.