Having Two Primary keys with one STRING and one BITEA

Hello,

I’m using the last version of forest with Postgres.

I’m trying to set two primary keys in my model, ID being a string, and HASH being a BYTEA.

id: {
      type: DataTypes.UUID,
      defaultValue: Sequelize.literal('uuid_generate_v4()'),
      allowNull: false,
      primaryKey: true,
    },
hash: {
  type: DataTypes.BLOB,
  primaryKey: true,
  unique: true,
},

It seems like HASH does not translate well into a string in the :recordId as it is encoded, is there a workaround to have a 2 Primary keys with a BYTEA with Forest ?

Thank you

Hello :slight_smile:
Unfortunately we do not support the type BYTEA as primary key. Actually this feature is not in the road map…
It is not a real workaround but can you use an other column with an other type ?

I ended up changing the type of my column :man_shrugging:

Thanks anyway!

1 Like