diff --git a/documentation/content/main/basics/database.md b/documentation/content/main/basics/database.md index 7eeeba1c7..d2b5f8565 100644 --- a/documentation/content/main/basics/database.md +++ b/documentation/content/main/basics/database.md @@ -31,12 +31,12 @@ SDKs such as `@vercel/postgres` and `@neonserverless/database` provide drop-in r ## Database model -Lucia requires 3 tables to work, which are then connected to Lucia via a database adapter. This is only the basic model and the specifics depend on the adapter. - -**The `id` columns are not UUID types with the default configuration.** +Lucia requires 3 tables to work, which are then connected to Lucia via a database adapter. This is only the basic model and the specifics depend on the adapter. **Lucia does not support default database values.** ### User table +The `id` column must be a string type, and as such, cannot be auto-incremented integer. It can be a UUID type, but keep in mind that the default user ids generated by Lucia are not UUIDs or ObjectIDs. You cannot use default (auto-generated) database values (such as UUIDs and ObjectIDs) and IDs must be generated at runtime. + | name | type | primary key | description | | ---- | -------- | :---------: | ----------- | | id | `string` | ✓ | User id | @@ -47,7 +47,7 @@ type UserSchema = { } & Lucia.DatabaseUserAttributes; ``` -In addition to the required fields shown below, you can add any additional fields to the table, in which case they should be declared in type `Lucia.DatabaseUserAttributes`. +In addition to the required fields shown below, you can add any additional fields to the table, in which case they should be declared in type `Lucia.DatabaseUserAttributes`. **Lucia does not support default (auto-generated) database values.** ```ts declare namespace Lucia { @@ -61,6 +61,8 @@ declare namespace Lucia { ### Session table +The `id` column must be a string type, and as such, cannot be auto-incremented integer. It can be a UUID type, but keep in mind that the default session ids generated by Lucia are not UUIDs or ObjectIDs. You cannot use default (auto-generated) database values (such as UUIDs and ObjectIDs) and IDs must be generated at runtime. + | name | type | primary key | references | description | | -------------- | --------------- | :---------: | ---------- | -------------------------------------------------- | | id | `string` | ✓ | | | @@ -77,7 +79,7 @@ type SessionSchema = { } & Lucia.DatabaseSessionAttributes; ``` -In addition to the required fields shown below, you can add any additional fields to the table, in which case they should be declared in type `Lucia.DatabaseSessionAttributes`. +In addition to the required fields shown below, you can add any additional fields to the table, in which case they should be declared in type `Lucia.DatabaseSessionAttributes`. **Lucia does not support default (auto-generated) database values.** ```ts declare namespace Lucia { @@ -91,6 +93,8 @@ declare namespace Lucia { ### Key table +The `id` column must be a regular string type. IDs are generated by Lucia and cannot be configured. It cannot be an auto-incremented integer, UUID, or ObjectID, nor could it be auto-generated by the database. + | name | type | primary key | references | description | | --------------- | ---------------- | :---------: | ---------- | -------------------------------------------------------- | | id | `string` | ✓ | | Key id in the form of: `${providerId}:${providerUserId}` |