DocsDataData ModelFacility

Alias: Team

Facility data representation.

Schema

Property NameTypeRequired
namestringYES
member_countnumberYES
organization_idstringYES
statusCodedConceptYES
settings_idstringYES

Auto-generated by better-auth

Property NameTypeNative Type (PostgreSQL)
idstringtext
created_atstringtimestampz
updated_atstringtimestampz

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).

Built with LogoFlowershow