-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add migration to make client pair UIDs PK
- Loading branch information
Stanley Dimant
committed
Jul 13, 2022
1 parent
e70f564
commit 4a83a7d
Showing
5 changed files
with
328 additions
and
15 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
175 changes: 175 additions & 0 deletions
175
...SynchronosServer/MareSynchronosServer/Migrations/20220712102941_ClientPairKey.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
132 changes: 132 additions & 0 deletions
132
MareSynchronosServer/MareSynchronosServer/Migrations/20220712102941_ClientPairKey.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,132 @@ | ||
using Microsoft.EntityFrameworkCore.Migrations; | ||
|
||
#nullable disable | ||
|
||
namespace MareSynchronosServer.Migrations | ||
{ | ||
public partial class ClientPairKey : Migration | ||
{ | ||
protected override void Up(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.DropForeignKey( | ||
name: "FK_ClientPairs_Users_OtherUserUID", | ||
table: "ClientPairs"); | ||
|
||
migrationBuilder.DropForeignKey( | ||
name: "FK_ClientPairs_Users_UserUID", | ||
table: "ClientPairs"); | ||
|
||
migrationBuilder.DropPrimaryKey( | ||
name: "PK_ClientPairs", | ||
table: "ClientPairs"); | ||
|
||
migrationBuilder.DropColumn( | ||
name: "Id", | ||
table: "ClientPairs"); | ||
|
||
|
||
migrationBuilder.AlterColumn<string>( | ||
name: "UserUID", | ||
table: "ClientPairs", | ||
type: "nvarchar(10)", | ||
maxLength: 10, | ||
nullable: false, | ||
defaultValue: "", | ||
oldClrType: typeof(string), | ||
oldType: "nvarchar(10)", | ||
oldNullable: true); | ||
|
||
migrationBuilder.AlterColumn<string>( | ||
name: "OtherUserUID", | ||
table: "ClientPairs", | ||
type: "nvarchar(10)", | ||
maxLength: 10, | ||
nullable: false, | ||
defaultValue: "", | ||
oldClrType: typeof(string), | ||
oldType: "nvarchar(10)", | ||
oldNullable: true); | ||
|
||
migrationBuilder.AddPrimaryKey( | ||
name: "PK_ClientPairs", | ||
table: "ClientPairs", | ||
columns: new[] { "UserUID", "OtherUserUID" }); | ||
|
||
migrationBuilder.AddForeignKey( | ||
name: "FK_ClientPairs_Users_OtherUserUID", | ||
table: "ClientPairs", | ||
column: "OtherUserUID", | ||
principalTable: "Users", | ||
principalColumn: "UID", | ||
onDelete: ReferentialAction.NoAction); | ||
|
||
migrationBuilder.AddForeignKey( | ||
name: "FK_ClientPairs_Users_UserUID", | ||
table: "ClientPairs", | ||
column: "UserUID", | ||
principalTable: "Users", | ||
principalColumn: "UID", | ||
onDelete: ReferentialAction.NoAction); | ||
} | ||
|
||
protected override void Down(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.DropForeignKey( | ||
name: "FK_ClientPairs_Users_OtherUserUID", | ||
table: "ClientPairs"); | ||
|
||
migrationBuilder.DropForeignKey( | ||
name: "FK_ClientPairs_Users_UserUID", | ||
table: "ClientPairs"); | ||
|
||
migrationBuilder.DropPrimaryKey( | ||
name: "PK_ClientPairs", | ||
table: "ClientPairs"); | ||
|
||
migrationBuilder.AlterColumn<string>( | ||
name: "OtherUserUID", | ||
table: "ClientPairs", | ||
type: "nvarchar(10)", | ||
nullable: true, | ||
oldClrType: typeof(string), | ||
oldType: "nvarchar(10)", | ||
oldMaxLength: 10); | ||
|
||
migrationBuilder.AlterColumn<string>( | ||
name: "UserUID", | ||
table: "ClientPairs", | ||
type: "nvarchar(10)", | ||
nullable: true, | ||
oldClrType: typeof(string), | ||
oldType: "nvarchar(10)", | ||
oldMaxLength: 10); | ||
|
||
migrationBuilder.AddColumn<int>( | ||
name: "Id", | ||
table: "ClientPairs", | ||
type: "int", | ||
nullable: false, | ||
defaultValue: 0) | ||
.Annotation("SqlServer:Identity", "1, 1"); | ||
|
||
migrationBuilder.AddPrimaryKey( | ||
name: "PK_ClientPairs", | ||
table: "ClientPairs", | ||
column: "Id"); | ||
|
||
migrationBuilder.AddForeignKey( | ||
name: "FK_ClientPairs_Users_OtherUserUID", | ||
table: "ClientPairs", | ||
column: "OtherUserUID", | ||
principalTable: "Users", | ||
principalColumn: "UID"); | ||
|
||
migrationBuilder.AddForeignKey( | ||
name: "FK_ClientPairs_Users_UserUID", | ||
table: "ClientPairs", | ||
column: "UserUID", | ||
principalTable: "Users", | ||
principalColumn: "UID"); | ||
} | ||
} | ||
} |
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