Table with No PK

Hey Forest,

Does Forest Admin have support for MySQL tables with no primary key? I’ve been trying to add one such table to our admin panel but have just been getting errors. Here is the model definition if it helps. Thank you!

// This model was generated by Forest CLI. However, you remain in control of your models.
// Learn how here:
module.exports = (sequelize, DataTypes) => {
  const { Sequelize } = sequelize;
  // This section contains the fields of your model, mapped to your table's columns.
  // Learn more here:
  const CredentialOcpiIdentifier = sequelize.define('credentialOcpiIdentifier', {
    countryCode: {
      type: DataTypes.STRING,
    partyId: {
      type: DataTypes.STRING,
    role: {
      type: DataTypes.STRING,
  }, {
    tableName: 'credential_ocpi_identifier',
    underscored: true,
    timestamps: false,
  // This section contains the relationships for this model. See:
  CredentialOcpiIdentifier.associate = (models) => {
    CredentialOcpiIdentifier.belongsTo(models.ocpiCredential, {
      foreignKey: {
        name: 'credentialCredentialIdKey',
        field: 'credential_credential_id',
      targetKey: 'credentialId',
      as: 'credentialCredential',

  return CredentialOcpiIdentifier;

Hey @Arda_Yurdakul,

As of today, Forest Admin does not support table without a primary key.

Updating/Removing records requires a primary key to work as expected. However, if these features aren’t a strong requirement on your end, you may be able to declare a Smart field and use it as your primary key.

Let me know if that helps.