Skip to content

[5.x] Add a paragraph about user UUIDs in the sessions table. #1698

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 8, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions content/collections/tips/storing-users-in-a-database.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ Statamic comes with an Eloquent driver to make the transition as seamless as pos
$table->string('group_id');
});
```
- If you're using the `database` session driver and using UUIDs as the primary key for users, make sure to update the `user_id` column in the `sessions` table.
```php
Schema::table('sessions', function (Blueprint $table) { // [tl! ++] [tl! **]
$table->foreignUuid('user_id')->nullable()->change(); // [tl! ++] [tl! **]
}); // [tl! ++] [tl! **]
```
- If you've customized your `user` blueprint, edit the migration so it includes those fields as columns. You can also create a new migration file by running `php artisan make:migration`. You'll have to manually edit the migration file to reflect your changes. Read up on [Laravel database migrations here](https://laravel.com/docs/12.x/migrations).
```php
$table->string('some_field');
Expand Down