laravel/pulse

Generated Columns

Closed this issue · 3 comments

Pulse Version

1.2

Laravel Version

11.0

PHP Version

8.2

Livewire Version

N/A

Database Driver & Version

PostreSQL 15.12 on https://www.thenile.dev

Description

Can any changes be made to this package to remove the use of generated columns?

SQLSTATE[0A000]: Feature not supported: 7 ERROR:  GENERATED columns are not supported (Connection: newdatabase, SQL: create table "pulse_values" ("id" bigserial not null primary key, "timestamp" integer not null, "type" varchar(255) not null, "key" text not null, "key_hash" uuid not null generated always as (md5("key")::uuid) stored, "value" text not null))

Steps To Reproduce

Use Pulse with PostreSQL 15.12

All good I think actually, I changed

match ($this->driver()) {
    'mariadb', 'mysql' => $table->char('key_hash', 16)->charset('binary')->virtualAs('unhex(md5(`key`))'),
    'pgsql' => $table->uuid('key_hash')->storedAs('md5("key")::uuid'),
    'sqlite' => $table->string('key_hash'),
};

to:

$table->string('key_hash');

I'm surprised to see issues on Postgres 15. We are running our test suite against Postgres 14 and things are working as expected:

image: postgres:14

Although your change may allow the migrations to run, I feel that it would cause issues for you while running Pulse, as the key_hash column would never be generated. I imagine this will result in Pulse seeing every query as the same query, every request as the same route, every cache key as the same cache key, etc.

Can you triple check the Postgres version that you have configured for Pulse. Remember that Pulse can use a dedicated database.

If you continue to have issues on Postgres 15 and are using it because your current application is using that version, I would recommend spinning up a dedicated database for Pulse with the latest Postgres version.

Let us know how you go.

Going to close this one. Pulse requires support for generated columns when using Postgres.