boolean first = true;
        Map<String, String> typesForNames = new HashMap<String, String>();
        Set<String> fullTextSearchableNames = new HashSet<String>();
        for (JcrPropertyDefinition defn : nodeTypes.getAllPropertyDefinitions()) {
            if (defn.isResidual()) continue;
            Name name = defn.getInternalName();
            String columnName = name.getString(registry);
            if (first) {
                builder.addTable(tableName, columnName);
                first = false;
            }
            org.modeshape.jcr.value.PropertyType requiredType = PropertyTypeUtil.modePropertyTypeFor(defn.getRequiredType());
            switch (defn.getRequiredType()) {
                case PropertyType.REFERENCE:
                    break;
                case PropertyType.WEAKREFERENCE:
                case org.modeshape.jcr.api.PropertyType.SIMPLE_REFERENCE:
                case PropertyType.UNDEFINED:
                    requiredType = org.modeshape.jcr.value.PropertyType.STRING;
                    break;
            }
            String type = typeSystem.getDefaultType();
            if (defn.getRequiredType() != PropertyType.UNDEFINED) {
                type = types.get(defn.getRequiredType());
            }
            assert type != null;
            String previousType = typesForNames.put(columnName, type);
            if (previousType != null && !previousType.equals(type)) {
                // There are two property definitions with the same name but different types, so we need to find a common type ...
                type = typeSystem.getCompatibleType(previousType, type);
            }
            boolean fullTextSearchable = fullTextSearchableNames.contains(columnName) || defn.isFullTextSearchable();
            if (fullTextSearchable) fullTextSearchableNames.add(columnName);
            // Add (or overwrite) the column ...
            boolean orderable = defn.isQueryOrderable();
            Set<Operator> operators = operatorsFor(defn);
            Object minimum = defn.getMinimumValue();
            Object maximum = defn.getMaximumValue();
            builder.addColumn(tableName, columnName, type, requiredType, fullTextSearchable, orderable, minimum, maximum,
                              operators);
        }
        if (additionalProperties != null) {
            boolean fullTextSearchable = false;
            for (JcrPropertyDefinition defn : additionalProperties) {
                Name name = defn.getInternalName();
                String columnName = name.getString(registry);
                assert defn.getRequiredType() != PropertyType.UNDEFINED;
                String type = types.get(defn.getRequiredType());
                assert type != null;
                String previousType = typesForNames.put(columnName, type);
                if (previousType != null && !previousType.equals(type)) {