Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

RileyGWeb's avatar

Laravel Jetstream deployment issue

I wish I could make a more descriptive title but that's all I know. Here's what's going on:

I created a fresh TALL app with Jetstream. I deployed to Forge and Digital Ocean. I had to change a couple things in the default migrations (password_reset_tokens table and sessions table). Particularly in the sessions table, I made this change:

$table->string('id')->primary();
// to
$table->increments('id');

...Due to an error it was throwing about not having a primary key. The password_reset_tokens change was similar.

When I try to navigate to the site, I get a 500 server error. The logs show this:

production.ERROR: SQLSTATE[22007]: Invalid datetime format: 1292 Truncated incorrect INTEGER value: 'YXZJpA27QtYAJZojAFOt2LKDISf9tt0GzvRSPfFW' (Connection: mysql, SQL: update `sessions` set `payload` = YTozOntzOjY6Il90b2tlbiI7czo0MDoiTldhdU1PdHpWanFPNDg4endGQnhsRTZ6NG0wWXhFUGVhNzRBVWx0QiI7czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6MjI6Imh0dHA6Ly8xNTkuMjIzLjEyNC4xODciO31zOjY6Il9mbGFzaCI7YToyOntzOjM6Im9sZCI7YTowOnt9czozOiJuZXciO2E6MDp7fX19, `last_activity` = 1683416276, `user_id` = ?, `ip_address` = 68.228.41.128, `user_agent` = Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36, `id` = YXZJpA27QtYAJZojAFOt2LKDISf9tt0GzvRSPfFW where `id` = YXZJpA27QtYAJZojAFOt2LKDISf9tt0GzvRSPfFW) {"exception":"[object] (Illuminate\Database\QueryException(code: 22007): SQLSTATE[22007]: Invalid datetime format: 1292 Truncated incorrect INTEGER value: 'YXZJpA27QtYAJZojAFOt2LKDISf9tt0GzvRSPfFW' (Connection: mysql, SQL: update `sessions` set `payload` = YTozOntzOjY6Il90b2tlbiI7czo0MDoiTldhdU1PdHpWanFPNDg4endGQnhsRTZ6NG0wWXhFUGVhNzRBVWx0QiI7czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6MjI6Imh0dHA6Ly8xNTkuMjIzLjEyNC4xODciO31zOjY6Il9mbGFzaCI7YToyOntzOjM6Im9sZCI7YTowOnt9czozOiJuZXciO2E6MDp7fX19, `last_activity` = 1683416276, `user_id` = ?, `ip_address` = 68.228.41.128, `user_agent` = Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36, `id` = YXZJpA27QtYAJZojAFOt2LKDISf9tt0GzvRSPfFW where `id` = YXZJpA27QtYAJZojAFOt2LKDISf9tt0GzvRSPfFW) at /home/forge/159.223.124.187/vendor/laravel/framework/src/Illuminate/Database/Connection.php:793)
[stacktrace]

Basically, for the sessions table, the id column needs to be a string, and it needs to be the primary key. But ->primary(); doesn't seem to set it as the primary key. So when I use ->increments('id') it gives me an error because that's an integer column.

How do I solve this?

0 likes
1 reply
LaryAI's avatar
Level 58

The issue is that the sessions table's id column needs to be a string and the primary key. The solution is to change the migration file to use the string method instead of the increments method. Here's how to do it:

  1. Open the migration file for the sessions table. It should be located in the database/migrations directory.

  2. Change the id column definition to use the string method and set it as the primary key:

$table->string('id')->primary();
  1. Save the file and run the migration again:
php artisan migrate

This should fix the issue with the sessions table and allow the application to run without errors.

Please or to participate in this conversation.