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

[Bug Report]: Primary keys required in MySQL 8 DB cluster #3052

Closed
aqos156 opened this issue Nov 11, 2021 · 1 comment
Closed

[Bug Report]: Primary keys required in MySQL 8 DB cluster #3052

aqos156 opened this issue Nov 11, 2021 · 1 comment
Labels

Comments

@aqos156
Copy link

aqos156 commented Nov 11, 2021

Describe the Bug

MySQL DB cluster requires having primary keys for row replication. These aren't present in certain migrations.

  Illuminate\Database\QueryException  : SQLSTATE[HY000]: General error: 3750 Unable to create or change a table without a primary key, when the system variable 'sql_require_primary_key' is set. Add a primary key to the table or unset this variable to avoid this message. Note that tables without a primary key can cause performance problems in row-based replication, so please consult your DBA before changing this setting. (SQL: create table `password_resets` (`email` varchar(191) not null, `token` varchar(191) not null, `created_at` timestamp not null) default character set utf8mb4 collate 'utf8mb4_unicode_ci'),
Migration table created successfully.,
    666|         // message to include the bindings with SQL, which will make this exception a,
Migrating: 2014_10_12_000000_create_users_table,
Migrated:  2014_10_12_000000_create_users_table (0.14 seconds),
Migrating: 2014_10_12_100000_create_password_resets_table,
  at /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php:669,
      /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:119,
  Please use the argument -v to see more details.,
  2   Doctrine\DBAL\Driver\PDO\Exception::new(),
      /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/Exception.php:18,
  1   Doctrine\DBAL\Driver\PDO\Exception::("SQLSTATE[HY000]: General error: 3750 Unable to create or change a table without a primary key, when the system variable 'sql_require_primary_key' is set. Add a primary key to the table or unset this variable to avoid this message. Note that tables without a primary key can cause performance problems in row-based replication, so please consult your DBA before changing this setting."),
  Exception trace:,
    673|,
    672|         },
    671|             );,
    670|                 $query, $this->prepareBindings($bindings), $e,
  > 669|             throw new QueryException(,
    668|         catch (Exception $e) {,
    667|         // lot more helpful to the developer instead of just the database's errors.,
    665|         // If an exception occurs when attempting to run a query, we'll format the error

Steps to Reproduce

  1. Create a MySQL DB cluster (on DigitalOcean even single instance has the required settings)
  2. Try to setup a instance of BookStack on the cluster

Expected Behaviour

To have primary keys in all tables during migrations, thus supporting MySQL 8 clustering.

Screenshots or Additional Context

No response

Exact BookStack Version

v21.10.03

PHP Version

No response

Hosting Environment

linuxserver.io docker image on debian and MySQL 8 DB cluster in DigitalOcean

@ssddanbrown
Copy link
Member

Hi @aqos156,

This has previously been discussed here: #2612 (comment).

As per that thread, I don't really see this as a bug for this project since it's mostly down to the enforcement from a specific cloud vendor, or for a database feature we don't advertise to support. I'm not overly comfortable with the feature-set of specific vendors being the deciding factor in our efforts/support level. Looks like the framework we use did potentially look to make changes to support such environments but they were reverted due to bugs. Maybe something we could potentially support in the future but don't think we can easily support right now.

From what I've seen there looks like there are some workarounds or some people have managed to request the enforcement of primary keys be turned off in their environment. Otherwise will close this off.

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

No branches or pull requests

2 participants