demo icon indicating copy to clipboard operation
demo copied to clipboard

SQLSTATE[42883]: Undefined function: 7 ERROR: operator does not exist: text

Open khanakia opened this issue 1 year ago • 1 comments

I just installed the fresh demo as per the instructions and got the following error after i login to the admin

Database Engine: Postgres

SQLSTATE[42883]: Undefined function: 7 ERROR: operator does not exist: text ->> unknown LINE 1: ...ifications"."notifiable_id" is not null and "data"->>'format... ^ HINT: No operator matches the given name and argument types. You might need to add explicit type casts.

Screenshot 2024-12-06 at 8 16 49 PM

Screenshot 2024-12-06 at 8 17 01 PM

khanakia avatar Dec 06 '24 14:12 khanakia

I was able to reproduce this error by opting for PostgreSQL over the default SQLite.

In order to resolve you must modify database/migrations/2022_09_10_131605_create_notifications_table.php

    public function up()
    {
        Schema::create('notifications', function (Blueprint $table) {
            $table->uuid('id')->primary();
            $table->string('type');
            $table->morphs('notifiable');
            $table->jsonb('data'); //<-- Change type to jsonb from text 
            $table->timestamp('read_at')->nullable();
            $table->timestamps();
        });
    }

Rerun your migrations and everything should work as expected

zachsdevpit avatar Jan 23 '25 04:01 zachsdevpit

Thanks @zachsdevpit

danharrin avatar Aug 11 '25 08:08 danharrin