additional fields
organization({
schema: {
invitation: {
additionalFields: {
metadata: {
type: "json",
required: false,
default: null,
input: true,
},
},
},
},
allowUserToCreateOrganization: (user: BetterAuthUser) => {
return (user as User).role === USER_ROLES.SUPER_ADMIN;
}, // Only super admin can create
creatorRole: MEMBER_ROLES.OWNER,
}),
how to reflect this additional field in db?, do i have to do it manually, and also how to pass this now, while creating invitations
3 Replies
I think the migration command should do it for you.
npx @better-auth/cli generate
Then,
npx @better-auth/cli migrate.and how to call the createInvitation api with this additional field, when i pass it, it just ignores it, and fills other column entries @NotTheViper
@BEAST,
inferAdditionalFields should help here. Reference:
https://www.better-auth.com/docs/concepts/typescript#additional-fieldsTypeScript | Better Auth
Better Auth TypeScript integration.