austintoddj / canvas

Publishing on your own terms
http://trycanvas.app
MIT License
3.26k stars 521 forks source link

Invalid text representation: canvas_users:id -> sessions:user_id #1427

Open scrappy opened 6 months ago

scrappy commented 6 months ago

Is there an existing issue for this?

Current Behavior

SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for type bigint: "7f3aeeeb-ec17-42d2-95c9-dfd777c65cea" CONTEXT: unnamed portal parameter $3 = '...'

Looking at the database, the session table has user_id defined as bigint, same as the users table .. but canvas_users has id set as UUID ...

`

\d sessions

                     Table "public.sessions"
Column     |          Type          | Collation | Nullable | Default

---------------+------------------------+-----------+----------+--------- id | character varying(255) | | not null | user_id | bigint | | | ip_address | character varying(45) | | | user_agent | text | | | payload | text | | not null | last_activity | integer | | not null | Indexes: "sessions_pkey" PRIMARY KEY, btree (id) "sessions_last_activity_index" btree (last_activity) "sessions_user_id_index" btree (user_id) `

Database backend is PostgreSQL ... from git, doesn't look like canvas' schema has changed in 4 years, so did something change in newer laravel ... ?

Expected Behavior

No response

Steps To Reproduce

Install canvas on top of laravel 11.7.0 and try and login.

Fresh install of both as of today, using composer to install ...

Environment

> php artisan --version
Laravel Framework 11.7.0

Anything else?

No response

scrappy commented 6 months ago

To get around the issue, I just changed my session settings to use redis instead of database ... doesn't fix the issue, but suspect moving to redis is probably a good idea to start with ...

mdrisss commented 5 months ago

By default, the migration file for the sessions table comes with the line : $table->foreignId('user_id')->nullable()->index(); I've changed this line to this: $table->uuid('user_id')->nullable()->index(); It remains to be seen whether this is a good solution, but it gets around the problem :)

Gigamick commented 2 months ago

Also struggling with this