setTable(determineTableName('api_key_roles', $emConfig)); $builder->createField('id', Types::BIGINT) ->makePrimaryKey() ->generatedValue('IDENTITY') ->option('unsigned', true) ->build(); (new FieldBuilder($builder, [ 'fieldName' => 'role', 'type' => Types::STRING, 'enumType' => Role::class, ]))->columnName('role_name') ->length(255) ->nullable(false) ->build(); $builder->createField('meta', Types::JSON) ->columnName('meta') ->nullable(false) ->build(); $builder->createManyToOne('apiKey', ApiKey::class) ->addJoinColumn('api_key_id', 'id', false, false, 'CASCADE') ->cascadePersist() ->build(); $builder->addUniqueConstraint(['role_name', 'api_key_id'], 'UQ_role_plus_api_key'); };