public static void CreateFullTextIndex( this DbMigration migration, string table, string index, string[] columns) { var op = new CreateFullTextIndexOperation { Table = table, Index = index, Columns = columns }; ((IDbMigration)migration).AddOperation(op); }
public virtual void Generate(CreateFullTextIndexOperation createFullTextIndexOperation) { using (var writer = Writer()) { writer.WriteLine("IF(NOT EXISTS(SELECT * FROM SYS.fulltext_catalogs WHERE is_default = 1))"); writer.WriteLine("BEGIN"); writer.WriteLine(" CREATE FULLTEXT CATALOG DefaultFullTextCatalog AS DEFAULT"); writer.WriteLine("END"); writer.WriteLine(); writer.WriteLine("CREATE FULLTEXT INDEX ON {0} ({1})", Name(createFullTextIndexOperation.Table), string.Join(", ", createFullTextIndexOperation.Columns.Select(c => Quote(c)))); writer.WriteLine("KEY INDEX {0}", Quote(createFullTextIndexOperation.Index)); writer.WriteLine("WITH CHANGE_TRACKING AUTO"); Statement(writer.InnerWriter.ToString(), suppressTransaction: true); } }
private void GenerateFullTextIndex(CreateFullTextIndexOperation fullTextIndexOperation) { using (var writer = Writer()) { writer.WriteLine("IF(NOT EXISTS(SELECT * FROM SYS.fulltext_catalogs WHERE is_default = 1))"); writer.WriteLine("BEGIN"); writer.WriteLine(" CREATE FULLTEXT CATALOG DefaultFullTextCatalog AS DEFAULT"); writer.WriteLine("END"); writer.WriteLine(); writer.WriteLine( $"CREATE FULLTEXT INDEX ON {Name(fullTextIndexOperation.Table)} ({string.Join(", ", fullTextIndexOperation.Columns.Select(Quote))})"); writer.WriteLine($"KEY INDEX {Quote(fullTextIndexOperation.Name)}"); writer.WriteLine("WITH CHANGE_TRACKING AUTO"); Statement(writer.InnerWriter.ToString(), true); } }