SQL error when adding an other database table
You're including the primary key as a field, which won't work. It needs to be on the same level as fields:

'fields' =&gt; [
  'id' =&gt; [
    'description' =&gt; 'The ID of the database entry of bar.',
    'type' =&gt; 'serial',
  ],
],
'primary key' =&gt; ['id'],