Database Adapters
AirBadge uses Auth.js’s database adapters.
It requires some extra fields to the User
schema.
Extra fields
Name | Type | Description |
---|---|---|
subscriptionId | String | The id of the Stripe subscription. |
subscriptionStatus | String | The status of the Stripe subscription. |
customerId | String | The customerId of the user in Stripe. |
priceId | String | The priceId of the subscription. |
plan | String | The plan the user is on. Maps to Price’s lookup_key. |
Prisma
Follow the Auth.js setup instructions.
Then adjust the User
schema in prisma/schema.prisma
:
model User {
// existing fields, id, name etc...
// add these fields
customerId String?
subscriptionId String?
subscriptionStatus SubscriptionStatus?
plan String?
priceId String?
}
// add this enum
enum SubscriptionStatus {
INCOMPLETE
INCOMPLETE_EXPIRED
TRIALING
ACTIVE
PAST_DUE
CANCELED
UNPAID
}
Then, run prisma db push
to sync the database.
Mongo
The Mongo adapter works without any changes. See Auth.js setup instructions.
Drizzle
Coming soon.
Others
All others should work by adding the extra fields.