public static void DropUserDefinedType(this MigrationBuilder migrationBuilder, string name, string schema = null) { var dropUserDefinedOperation = new DropUserDefinedTypeOperation { Name = name, Schema = schema }; migrationBuilder.Operations.Add(dropUserDefinedOperation); }
protected virtual void Generate(DropUserDefinedTypeOperation operation, IModel model, MigrationCommandListBuilder builder, bool terminate = true) { builder .Append("DROP TYPE ") .Append(Dependencies.SqlGenerationHelper.DelimitIdentifier(operation.Name, operation.Schema)); if (terminate) { builder.AppendLine(Dependencies.SqlGenerationHelper.StatementTerminator); EndStatement(builder); } }
protected override IEnumerable <MigrationOperation> Remove(TableMapping source, DiffContext diffContext) { var type = source.GetRootType(); MigrationOperation operation; if (!type.IsUserDefinedType()) { var dropOperation = new DropTableOperation { Schema = source.Schema, Name = source.Name }; diffContext.AddDrop(source, dropOperation); operation = dropOperation; } else { operation = new DropUserDefinedTypeOperation { Schema = source.Schema, Name = source.Name }; } operation.AddAnnotations(MigrationsAnnotations.ForRemove(source.EntityTypes[0])); yield return(operation); }
protected virtual void Generate(DropUserDefinedTypeOperation operation, IndentedStringBuilder builder) { builder.AppendLine(".DropUserDefinedType("); using (builder.Indent()) { builder .Append("name: ") .Append(Code.Literal(operation.Name)); if (operation.Schema != null) { builder .AppendLine(",") .Append("schema: ") .Append(Code.Literal(operation.Schema)); } builder.Append(")"); Annotations(operation.GetAnnotations(), builder); } }