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
NotTheViper
NotTheViper2mo ago
I think the migration command should do it for you. npx @better-auth/cli generate Then, npx @better-auth/cli migrate.
BEAST
BEASTOP2mo ago
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
NotTheViper
NotTheViper2mo ago
@BEAST, inferAdditionalFields should help here. Reference: https://www.better-auth.com/docs/concepts/typescript#additional-fields
TypeScript | Better Auth
Better Auth TypeScript integration.

Did you find this page helpful?