InnoDB Clustering with Strapi Database Schemas

Hello everyone,
I’m using strapi versoin 4.3.6, and encountering with an issue while trying to implement InnoDB clustering. For that, we need the database schemas with primary keys for each, and some of the strapi schemas doesn’t contains any primary key.

Hence, I tried by altering the schemas by adding a primary keys and got success with clustering.

i.e,
ALTER TABLE tutorials_localizations_links ADD COLUMN PID INT AUTO_INCREMENT PRIMARY KEY;
ALTER TABLE stores_open_links ADD COLUMN PID INT AUTO_INCREMENT PRIMARY KEY;

But while trying to add few other collections on strapi and trying to start, I am having the below issue.

[2024-07-29 22:51:11.748] error: alter table admin_permissions_role_links drop index PRIMARY - ER_WRONG_AUTO_KEY: Incorrect table definition; there can be only one auto column and it must be defined as a key
Error: ER_WRONG_AUTO_KEY: Incorrect table definition; there can be only one auto column and it must be defined as a key
at Query.Sequence._packetToError

Then I tried removing my clustering, and the manually added primary keys and it succeeded.

So, is there any way that I can got this issue resolved in strapi? Because in everytime I need to push new schema changes to strapi, I will have to remove clustering and enable it again after the changes made.

Thank you.

This topic has been created from a Discord post (1267533154047102986) to give it more visibility.
It will be on Read-Only mode here.
Join the conversation on Discord

I believe we spoke on the office hours but for others coming across this, we added primary keys to every table in Strapi quite a while ago, I would advise upgrading to a much newer version

Hi <@211722558385553408> , thank you so much for answering my question. Could you please come up with the version that you have enabled it? I am using the version 4.3.6, and that will be much helpful for me if you could come up with the exact version I should migrate to.

I have no idea but you should upgrade as close to latest as you can so you can get patched on the security vulnerabilities

minimum version I’d recommend is 4.24.2

Thanks <@211722558385553408> for your support.