Database
Auth requires the following database tables to work:
Core Schema
User
Table name: user
Field | Type | Key | Desccription |
---|---|---|---|
id | uuid | PK | Unique identifier for the user |
name | varchar(255) | User's name | |
varchar(255) | User's email address for login | ||
image | varchar(255) | User's image url | |
created_at | timestamp | Timestamp when the user was created. | |
updated_at | timestamp | Timestamp when the user was last updated. |
Account
Table name: account
Field | Type | Key | Desccription |
---|---|---|---|
provider | varchar(255) | PK | Provider name (e.g. 'google', 'github') |
account_id | varchar(255) | PK | Unique identifier for the account |
user_id | uuid | FK | Foreign key referencing the user table |
password | varchar(255) | ? | Hashed password (only used with credential provider) |
Session
Table name: session
Field | Type | Key | Desccription |
---|---|---|---|
token | varchar(255) | PK | Unique session token |
expires | timestamp | Expiration date of the session | |
user_id | uuid | FK | Foreign key referencing the user table |
Relationships
The database schema establishes the following relationships between tables:
- User to Account: One-to-many relationship. A user can have multiple accounts across different providers.
- User to Session: One-to-many relationship. A user can have multiple active sessions.
- Account to User: Many-to-one relationship. Each account belongs to exactly one user.
- Session to User: Many-to-one relationship. Each session belongs to exactly one user.