Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename MigrationOperation.For methods to CreateFrom #21884

Merged
merged 1 commit into from
Aug 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1177,11 +1177,11 @@ protected virtual IEnumerable<MigrationOperation> Add([NotNull] IUniqueConstrain
{
if (target.GetIsPrimaryKey())
{
yield return AddPrimaryKeyOperation.For((IPrimaryKeyConstraint)target);
yield return AddPrimaryKeyOperation.CreateFrom((IPrimaryKeyConstraint)target);
}
else
{
yield return AddUniqueConstraintOperation.For(target);
yield return AddUniqueConstraintOperation.CreateFrom(target);
}
}

Expand Down Expand Up @@ -1276,7 +1276,7 @@ protected virtual IEnumerable<MigrationOperation> Add([NotNull] IForeignKeyConst
yield break;
}

var operation = AddForeignKeyOperation.For(target);
var operation = AddForeignKeyOperation.CreateFrom(target);

var createTableOperation = diffContext.FindCreate(targetTable);
if (createTableOperation != null)
Expand Down Expand Up @@ -1383,7 +1383,7 @@ protected virtual IEnumerable<MigrationOperation> Add(
[NotNull] ITableIndex target,
[NotNull] DiffContext diffContext)
{
yield return CreateIndexOperation.For(target);
yield return CreateIndexOperation.CreateFrom(target);
}

/// <summary>
Expand Down Expand Up @@ -1450,7 +1450,7 @@ protected virtual IEnumerable<MigrationOperation> Diff(
/// </summary>
protected virtual IEnumerable<MigrationOperation> Add([NotNull] ICheckConstraint target, [NotNull] DiffContext diffContext)
{
yield return AddCheckConstraintOperation.For(target);
yield return AddCheckConstraintOperation.CreateFrom(target);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ public class AddCheckConstraintOperation : MigrationOperation, ITableMigrationOp
public virtual string Sql { get; [param: NotNull] set; }

/// <summary>
/// Creates a new <see cref="AddCheckConstraintOperation"/> for the specified check constraint.
/// Creates a new <see cref="AddCheckConstraintOperation"/> from the specified check constraint.
/// </summary>
/// <param name="checkConstraint"> The check constraint. </param>
/// <returns> The operation. </returns>
public static AddCheckConstraintOperation For([NotNull] ICheckConstraint checkConstraint)
public static AddCheckConstraintOperation CreateFrom([NotNull] ICheckConstraint checkConstraint)
{
Check.NotNull(checkConstraint, nameof(checkConstraint));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ public class AddForeignKeyOperation : MigrationOperation, ITableMigrationOperati
public virtual ReferentialAction OnDelete { get; set; }

/// <summary>
/// Creates a new <see cref="AddForeignKeyOperation"/> for the specified foreign key.
/// Creates a new <see cref="AddForeignKeyOperation"/> from the specified foreign key.
/// </summary>
/// <param name="foreignKey"> The foreign key. </param>
/// <returns> The operation. </returns>
public static AddForeignKeyOperation For([NotNull] IForeignKeyConstraint foreignKey)
public static AddForeignKeyOperation CreateFrom([NotNull] IForeignKeyConstraint foreignKey)
{
Check.NotNull(foreignKey, nameof(foreignKey));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ public class AddPrimaryKeyOperation : MigrationOperation, ITableMigrationOperati
public virtual string[] Columns { get; [param: NotNull] set; }

/// <summary>
/// Creates a new <see cref="AddPrimaryKeyOperation"/> for the specified primary key.
/// Creates a new <see cref="AddPrimaryKeyOperation"/> from the specified primary key.
/// </summary>
/// <param name="primaryKey"> The primary key. </param>
/// <returns> The operation. </returns>
public static AddPrimaryKeyOperation For([NotNull] IPrimaryKeyConstraint primaryKey)
public static AddPrimaryKeyOperation CreateFrom([NotNull] IPrimaryKeyConstraint primaryKey)
{
Check.NotNull(primaryKey, nameof(primaryKey));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ public class AddUniqueConstraintOperation : MigrationOperation, ITableMigrationO
public virtual string[] Columns { get; [param: NotNull] set; }

/// <summary>
/// Creates a new <see cref="AddUniqueConstraintOperation"/> for the specified unique constraint.
/// Creates a new <see cref="AddUniqueConstraintOperation"/> from the specified unique constraint.
/// </summary>
/// <param name="uniqueConstraint"> The unique constraint. </param>
bricelam marked this conversation as resolved.
Show resolved Hide resolved
/// <returns> The operation. </returns>
public static AddUniqueConstraintOperation For([NotNull] IUniqueConstraint uniqueConstraint)
public static AddUniqueConstraintOperation CreateFrom([NotNull] IUniqueConstraint uniqueConstraint)
{
Check.NotNull(uniqueConstraint, nameof(uniqueConstraint));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ public class CreateIndexOperation : MigrationOperation, ITableMigrationOperation
public virtual string Filter { get; [param: CanBeNull] set; }

/// <summary>
/// Creates a new <see cref="CreateIndexOperation"/> for the specified index.
/// Creates a new <see cref="CreateIndexOperation"/> from the specified index.
/// </summary>
/// <param name="index"> The index. </param>
/// <returns> The operation. </returns>
public static CreateIndexOperation For([NotNull] ITableIndex index)
public static CreateIndexOperation CreateFrom([NotNull] ITableIndex index)
{
Check.NotNull(index, nameof(index));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1739,7 +1739,7 @@ protected virtual void CreateIndexes(

foreach (var index in indexes)
{
Generate(CreateIndexOperation.For(index), index.Table.Model.Model, builder, terminate: false);
Generate(CreateIndexOperation.CreateFrom(index), index.Table.Model.Model, builder, terminate: false);
builder.AppendLine(Dependencies.SqlGenerationHelper.StatementTerminator);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ private IReadOnlyList<MigrationOperation> RewriteOperations(
Name = renameIndexOperation.Name
});

operations.Add(CreateIndexOperation.For(index));
operations.Add(CreateIndexOperation.CreateFrom(index));
}
else
{
Expand Down Expand Up @@ -299,7 +299,7 @@ private IReadOnlyList<MigrationOperation> RewriteOperations(
var primaryKey = table.PrimaryKey;
if (primaryKey != null)
{
createTableOperation.PrimaryKey = AddPrimaryKeyOperation.For(primaryKey);
createTableOperation.PrimaryKey = AddPrimaryKeyOperation.CreateFrom(primaryKey);
}

foreach (var column in table.Columns)
Expand All @@ -325,17 +325,17 @@ private IReadOnlyList<MigrationOperation> RewriteOperations(

foreach (var foreignKey in table.ForeignKeyConstraints)
{
createTableOperation.ForeignKeys.Add(AddForeignKeyOperation.For(foreignKey));
createTableOperation.ForeignKeys.Add(AddForeignKeyOperation.CreateFrom(foreignKey));
}

foreach (var uniqueConstraint in table.UniqueConstraints.Where(c => !c.GetIsPrimaryKey()))
{
createTableOperation.UniqueConstraints.Add(AddUniqueConstraintOperation.For(uniqueConstraint));
createTableOperation.UniqueConstraints.Add(AddUniqueConstraintOperation.CreateFrom(uniqueConstraint));
}

foreach (var checkConstraint in table.CheckConstraints)
{
createTableOperation.CheckConstraints.Add(AddCheckConstraintOperation.For(checkConstraint));
createTableOperation.CheckConstraints.Add(AddCheckConstraintOperation.CreateFrom(checkConstraint));
}

createTableOperation.AddAnnotations(table.GetAnnotations());
Expand All @@ -345,7 +345,7 @@ private IReadOnlyList<MigrationOperation> RewriteOperations(
{
if (index.IsUnique && rebuild.Value.CreateIndexesDeferred.Contains(index.Name))
{
var createIndexOperation = CreateIndexOperation.For(index);
var createIndexOperation = CreateIndexOperation.CreateFrom(index);
createIndexOperation.Table = createTableOperation.Name;
operations.Add(createIndexOperation);
}
Expand Down Expand Up @@ -472,7 +472,7 @@ private IReadOnlyList<MigrationOperation> RewriteOperations(

foreach (var index in indexesToRebuild)
{
operations.Add(CreateIndexOperation.For(index));
operations.Add(CreateIndexOperation.CreateFrom(index));
}

return operations;
Expand Down