laravel-job-status icon indicating copy to clipboard operation
laravel-job-status copied to clipboard

broken index migration in MariaDB

Open madbob opened this issue 2 years ago • 5 comments

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)

madbob avatar Jun 13 '23 15:06 madbob

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!

tobytwigger avatar Jun 19 '23 07:06 tobytwigger

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 :-\

madbob avatar Jun 19 '23 09:06 madbob

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

JanMisker avatar Jun 12 '24 13:06 JanMisker

@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.

madbob avatar Jun 12 '24 13:06 madbob

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

JanMisker avatar Jun 12 '24 18:06 JanMisker