private void CreateColumns(TableInfo tableInfo, Table table)
 {
     foreach (var columnInfo in tableInfo.Columns)
     {
         CreateColumn(columnInfo, table);
     }
 }
 private void CreateForeignKeys(TableInfo tableInfo)
 {
     foreach (var foreignKey in tableInfo.ForeignKeys)
     {
         CreateForeignKey(foreignKey);
     }
 }
        private void CreateTable(TableInfo tableInfo)
        {
            var resolvedNode = mappingResolver.Resolve(targetResult, tableInfo.Name);
            var table        = resolvedNode.Schema.CreateTable(resolvedNode.Name);

            CreateColumns(tableInfo, table);
            CreatePrimaryIndex(tableInfo, table);
            CreateSecondaryIndexes(tableInfo, table);
            CreateFullTextIndexes(tableInfo, table);
        }
 private void CreateFullTextIndexes(TableInfo tableInfo, Table table)
 {
     if (!provider.Supports(ProviderFeatures.FullText))
     {
         return;
     }
     foreach (var ftIndex in tableInfo.FullTextIndexes)
     {
         CreateFullTextIndex(tableInfo, table, ftIndex);
     }
 }
 private void CreateSecondaryIndexes(TableInfo tableInfo, Table table)
 {
     if (tableInfo.SecondaryIndexes == null || tableInfo.SecondaryIndexes.Count == 0)
     {
         return;
     }
     foreach (var secondaryIndex in tableInfo.SecondaryIndexes)
     {
         CreateSecondaryIndex(table, secondaryIndex);
     }
 }
        private void CreatePrimaryIndex(TableInfo tableInfo, Table table)
        {
            if (tableInfo.PrimaryIndex == null)
            {
                return;
            }
            var columns    = tableInfo.PrimaryIndex.KeyColumns.Select(cr => table.TableColumns[cr.Value.Name]).ToArray();
            var primaryKey = table.CreatePrimaryKey(tableInfo.PrimaryIndex.Name, columns);

            primaryKey.IsClustered = provider.Supports(ProviderFeatures.ClusteredIndexes) && tableInfo.PrimaryIndex.IsClustered;
        }
        private void CreateFullTextIndex(TableInfo tableInfo, Table table, StorageFullTextIndexInfo fullTextIndexInfo)
        {
            var ftIndex = table.CreateFullTextIndex(fullTextIndexInfo.Name);

            ftIndex.UnderlyingUniqueIndex = tableInfo.PrimaryIndex.EscapedName;
            ftIndex.FullTextCatalog       = "Default";
            foreach (var columnRef in fullTextIndexInfo.Columns)
            {
                var configuration  = columnRef.Configuration;
                var typeColumnName = columnRef.TypeColumnName;
                var column         = columnRef.Value;

                var tableColumn = FindColumn(table, column.Name);
                var ftColumn    = ftIndex.CreateIndexColumn(tableColumn);

                ftColumn.TypeColumn = (!typeColumnName.IsNullOrEmpty() && provider.Supports(ProviderFeatures.FullTextColumnDataTypeSpecification))
          ? FindColumn(table, typeColumnName)
          : null;
                ftColumn.Languages.Add(new Language(configuration));
            }
        }
 private Table FindTable(TableInfo tableInfo)
 {
     return(mappingResolver.Resolve(targetResult, tableInfo.Name).GetTable());
 }