You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This problem happens during the running of migrations when it tries to create a new schema_migration table, on an empty database on MySQL 8.
It looks like at least MySQL 8 has this flag sql_require_primary_key that does not allow table to not have PRIMARY_KEY.
This problem arises if you are not in direct control of the databases, ex: DigitalOcean Managed Database, where this flag is ON.
Steps to Reproduce the Problem
With an empty database, run migrations.
The following error will show:
CREATEUNIQUE INDEX `schema_migration_version_idx` ON`schema_migration` (`version`);: Error 3750: Unable to create or change a table without a primary key, when the system variable 'sql_require_primary_key' is set.
Expected Behavior
No error.
Actual Behavior
From my point of view there are 2 options:
Add PRIMARY_KEY to schema_migration by default. (easy option)
Enable some kind of hook that would allow us to runs before any kind of migrations (even before the creation of schema_migration. This following snippet would allow the turn OFF of this flag for the current session.
SET @ORIG_SQL_REQUIRE_PRIMARY_KEY=@@SQL_REQUIRE_PRIMARY_KEY;
SET SQL_REQUIRE_PRIMARY_KEY =0;
Thank you for reporting this issue. I made a PR for this, and merged it, but not yet been released. I hope this change will fix the issue. The release with fix will be released within the next week or another, so please kindly let me know if it resolved your issue.
Description
This problem happens during the running of migrations when it tries to create a new
schema_migration
table, on an empty database on MySQL 8.It looks like at least
MySQL 8
has this flagsql_require_primary_key
that does not allow table to not have PRIMARY_KEY.This problem arises if you are not in direct control of the databases, ex: DigitalOcean Managed Database, where this flag is ON.
Steps to Reproduce the Problem
With an empty database, run migrations.
The following error will show:
Expected Behavior
No error.
Actual Behavior
From my point of view there are 2 options:
schema_migration
by default. (easy option)schema_migration
. This following snippet would allow the turn OFF of this flag for the current session.Info
The text was updated successfully, but these errors were encountered: