mariadbjbpmkie-server

JBPM issue with Maria DB Galera were Primary key mandatory


JBPM issue with Maria DB Galera were Primary key mandatory. Some tables in JBPM db schema have no primary key.

Currently we have Mariadb as the only database option to use.

create table EventTypes (
    InstanceId bigint not null,
    element varchar(255)
) ENGINE=InnoDB;
create table PeopleAssignments_PotOwners (
        task_id bigint not null,
        entity_id varchar(255) not null
) ENGINE=InnoDB;

Source for MariaDB primary Key mandatory: mariadb-galera-cluster-known-limitations

Please help.


Solution

  • PeopleAssignments_PotOwners looks like a many:many mapping table between tasks and entities?? If so, then the 'natural' PRIMARY KEY would be

    PRIMARY KEY(task_id, entity_id)
    

    (in either order).

    Perhaps ditto for the other table?

    More discussion of efficiency in many:many tables: http://mysql.rjweb.org/doc.php/index_cookbook_mysql#many_to_many_mapping_table

    If you don't have a 'natural' primary key composed of one (or more) columns, add

    id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY