public void BuildTypeIds(TypeIdRegistry registry)
        {
            // Import static type identifiers.
            // Static types are system types, which don't change their type identifiers.
            // User types are not static by default.
            foreach (var type in GetTypesWithStaticTypeIds())
            {
                registry.Register(type.TypeId, type);
            }

            // Load old type identifiers from database
            foreach (var type in GetTypesWithoutTypeId(registry))
            {
                var typeId = typeIdProvider.GetTypeId(type.UnderlyingType);
                if (typeId != TypeInfo.NoTypeId)
                {
                    registry.Register(typeId, type);
                }
            }

            // Generate type identifiers for remaining types
            var typeGroups = GetTypesWithoutTypeId(registry)
                             .GroupBy(t => t.MappingDatabase ?? string.Empty)
                             .OrderBy(g => g.Key);

            foreach (var group in typeGroups)
            {
                var sequence = GetTypeIdSequence(registry, group.Key);
                foreach (var type in group.OrderBy(i => i.Name))
                {
                    registry.Register(sequence.GetNextValue(), type);
                }
            }
        }
        /// <inheritdoc/>
        protected override IPathNode VisitColumnInfo(ColumnInfo column)
        {
            var nonNullableType = column.ValueType;
            var nullableType    = ToNullable(nonNullableType, column.IsNullable);

            StorageColumnInfo extractedConnectedColumn = null;

            if (isUpgradingStage && ShouldGetExtractedColumnInformation(column))
            {
                extractedConnectedColumn = GetExtractedStorageColumnInfoFor(column);
            }

            var typeInfoPrototype = new StorageTypeInfo(nullableType, null, column.IsNullable, column.Length, column.Precision, column.Scale);
            var nativeTypeInfo    = CreateType(nonNullableType, column.Length, column.Precision, column.Scale);

            // We need the same type as in SQL database here (i.e. the same as native)
            var typeInfo      = new StorageTypeInfo(ToNullable(nativeTypeInfo.Type, column.IsNullable), nativeTypeInfo.NativeType, column.IsNullable, nativeTypeInfo.Length, nativeTypeInfo.Precision, nativeTypeInfo.Scale);
            var finalTypeInfo = GetStorageTypeInfo(typeInfo, extractedConnectedColumn, column);

            var defaultValue         = GetColumnDefaultValue(column, finalTypeInfo);
            var defaultSqlExpression = GetColumnDefaultSqlExpression(column);

            if (column.IsSystem && column.Field.IsTypeId)
            {
                var type = column.Field.ReflectedType;
                if (type.IsEntity && type == type.Hierarchy.Root)
                {
                    defaultValue = typeIdProvider.GetTypeId(type.UnderlyingType);
                }
            }
            return(new StorageColumnInfo(currentTable, column.Name, finalTypeInfo)
            {
                DefaultValue = defaultValue,
                DefaultSqlExpression = defaultSqlExpression
            });
        }