Facility
Alias: Team
Facility data representation.
Schema
| Property Name | Type | Required |
|---|---|---|
| name | string | YES |
| member_count | number | YES |
| organization_id | string | YES |
| status | CodedConcept | YES |
| settings_id | string | YES |
Auto-generated by better-auth
| Property Name | Type | Native Type (PostgreSQL) |
|---|---|---|
| id | string | text |
| created_at | string | timestampz |
| updated_at | string | timestampz |
Example
{
"id": "123",
"name": "Klinik Permata Mentari",
"member_count": 10,
"organization_id": "123",
"status": {
"system": "crn:status:system",
"value": "active",
"display": "Active"
},
"settings_id": "123",
"created_at": "2026-10-02 21:27:00+07",
"updated_at": "2026-10-02 21:27:00+07"
}
Important Notes
Additional Field
Better Auth Organization plugin team schema only consist of id, name, memberCount, organizationId, createdAt, updatedAt. The other property defined above are additional field you must add in your better auth configuration like below
const auth = betterAuth({
plugins: [
organization({
schema: {
team: {
additionalFields: {
status: {
type: "string",
required: true,
defaultValue: JSON.stringify({
system: "crn:status:system",
value: "active",
display: "Active",
}),
input: true,
},
settings_id: {
type: "string",
required: true,
input: false,
},
},
},
},
}),
],
});
Read here to learn more on how to extend better auth core schema.
Case Style
Better Auth uses camelCase by default. To keep your database schema consistent in snake_case, add the following configuration:
const auth = betterAuth({
plugins: [
organization({
schema: {
team: {
fields: {
createdAt: "created_at",
updatedAt: "updated_at",
},
},
},
}),
],
});
Info
Type inference in your code will still use the original field names (e.g., team.createdAt, not team.created_at).