Change default Primary Key to BigInt

System Information
  • Strapi Version: v4.0.4
  • Operating System: Mac OS 12.0
  • Database: MySQL 5.7.34

Hi, Is there a way to change default primary key type from Integer to BigInt?

Context: I have existing system using Strapi v3 and is using BigInt as the primary key by modifying it directly in DB, but since migrating to v4 I can’t manually change the type anymore, it will break on Admin start.

Error message:

I found out the code that causing this is in here:

There is no Primary Key check for bigint. I guess this is expected for now since integer is being hardcoded as primary key.

I managed to solve this by adding this code inside the bigint case:

case 'bigint': {
  if (column.column_key === 'PRI') {
    return { type: 'increments', args: [{ primary: true }], unsigned: false };
  return { type: 'bigInteger' };

I guess the next question is:

Is there a way to modify database dialect configuration/provide our own dialect configuration without have to rebuild the strapi source code ourself?

I have similar question, I want to change created_at/updated_at/published_at’s type to ‘timestamptz’ in PostgreSQL.