code: public ExtendedRelation addRelationship(String baseTableName,
  			String relatedTableName, UserMappingTable userMappingTable,
  			String relationName) {
  
  		// Validate the relation
  		validateRelationship(baseTableName, relatedTableName, relationName);
  
  		// Create the user mapping table if needed
  		createUserMappingTable(userMappingTable);
  
  		// Add a row to gpkgext_relations
  		ExtendedRelation extendedRelation = new ExtendedRelation();
  		extendedRelation.setBaseTableName(baseTableName);
  		extendedRelation
  				.setBasePrimaryColumn(getPrimaryKeyColumnName(baseTableName));
  		extendedRelation.setRelatedTableName(relatedTableName);
  		extendedRelation
  				.setRelatedPrimaryColumn(getPrimaryKeyColumnName(relatedTableName));
  		extendedRelation.setMappingTableName(userMappingTable.getTableName());
  		extendedRelation.setRelationName(relationName);
  		try {
  			extendedRelationsDao.create(extendedRelation);
  		} catch (SQLException e) {
  			throw new GeoPackageException("Failed to add relationship '"
  					+ relationName + "' between " + baseTableName + " and "
  					+ relatedTableName, e);
  		}
  		return extendedRelation;
  	}
docs: Adds a relationship between the base and related table. Creates the user
  mapping table if needed.
  
  @param baseTableName
  base table name
  @param relatedTableName
  related table name
  @param userMappingTable
  user mapping table
  @param relationName
  relation name
  @return The relationship that was added