tobytwigger / laravel-job-status

The only Laravel job debugging tool you'll ever need
https://tobytwigger.github.io/laravel-job-status
MIT License
19 stars 2 forks source link

broken index migration in MariaDB #93

Open madbob opened 1 year ago

madbob commented 1 year ago

Describe the bug Migrations (in particular: 2023_02_21_175500_add_indexes.php) fails when executed on MariaDB with the following error:

SQLSTATE[HY000]: General error: 1901 Function or expression 'AUTO_INCREMENT' cannot be used in the USING HASH clause of `id` (Connection: mysql, SQL: alter table `job_status_job_statuses` add unique `job_status_job_statuses_queue_status_selector_id_unique` using hash(`queue`, `status`, `selector`, `id`))

To Reproduce Steps to reproduce the behavior:

  1. composer require twigger/laravel-job-status
  2. php artisan migrate

Additional context Tested on MariaDB Ver 15.1 Distrib 10.6.12-MariaDB, for debian-linux-gnu (x86_64)

tobytwigger commented 1 year ago

Thanks for reporting this. I'll try and fix this in the next few weeks, very happy to accept a PR sooner if you want to put one in!

madbob commented 1 year ago

Here the confirmed - and still unresolved - bug in MariaDB.

In my application I've just skipped the problematic migration, don't know if there is some alternative way to obtain a similar indexing behavior :-\

JanMisker commented 5 months ago

I just stumbled on this same bug, unfortunately in production... how can you skip a migration?

madbob commented 5 months ago

@JanMisker in the file database/migrations/2023_02_21_175500_add_indexes.php, function up(), put as first line a return;

Ugly, and you will stay without proper indexes in DB, but yet the most quick and dirty solution for this.

JanMisker commented 4 months ago

@madbob I ended up manually inserting an entry in the migrations table 🙈