-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add migration support for renaming foreign keys
Some database systems support renaming foreign key constraints without rebuilding the table. Add a RenameForeignKey operation to MigrationBuilder in order to support this.
- Loading branch information
Showing
15 changed files
with
297 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/EFCore.Relational/Migrations/Operations/RenameForeignKeyOperation.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using JetBrains.Annotations; | ||
|
||
namespace Microsoft.EntityFrameworkCore.Migrations.Operations | ||
{ | ||
/// <summary> | ||
/// A <see cref="MigrationOperation" /> for renaming an existing foreign key. | ||
/// </summary> | ||
public class RenameForeignKeyOperation : MigrationOperation | ||
{ | ||
/// <summary> | ||
/// The old name of the foreign key. | ||
/// </summary> | ||
public virtual string Name { get; [param: NotNull] set; } | ||
|
||
/// <summary> | ||
/// The new name for the foreign key. | ||
/// </summary> | ||
public virtual string NewName { get; [param: NotNull] set; } | ||
|
||
/// <summary> | ||
/// The schema that contains the table, or <c>null</c> if the default schema should be used. | ||
/// </summary> | ||
public virtual string Schema { get; [param: CanBeNull] set; } | ||
|
||
/// <summary> | ||
/// The name of the table that the foreign key belongs to. | ||
/// </summary> | ||
public virtual string Table { get; [param: CanBeNull] set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.