Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

broken index migration in MariaDB #93

Open
madbob opened this issue Jun 13, 2023 · 5 comments
Open

broken index migration in MariaDB #93

madbob opened this issue Jun 13, 2023 · 5 comments

Comments

@madbob
Copy link

madbob commented Jun 13, 2023

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
Copy link
Owner

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
Copy link
Author

madbob commented Jun 19, 2023

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
Copy link

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

@madbob
Copy link
Author

madbob commented Jun 12, 2024

@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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants