85 lines
2.5 KiB
C#
85 lines
2.5 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace LANCommander.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddUserRoleNavigationProperties : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Roles_Users_UserId",
|
|
table: "Roles");
|
|
|
|
migrationBuilder.DropPrimaryKey(
|
|
name: "PK_UserRoles",
|
|
table: "UserRoles");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_UserRoles_RoleId",
|
|
table: "UserRoles");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_Roles_UserId",
|
|
table: "Roles");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "UserId",
|
|
table: "Roles");
|
|
|
|
migrationBuilder.AddPrimaryKey(
|
|
name: "PK_UserRoles",
|
|
table: "UserRoles",
|
|
columns: new[] { "RoleId", "UserId" });
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_UserRoles_UserId",
|
|
table: "UserRoles",
|
|
column: "UserId");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropPrimaryKey(
|
|
name: "PK_UserRoles",
|
|
table: "UserRoles");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_UserRoles_UserId",
|
|
table: "UserRoles");
|
|
|
|
migrationBuilder.AddColumn<Guid>(
|
|
name: "UserId",
|
|
table: "Roles",
|
|
type: "TEXT",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddPrimaryKey(
|
|
name: "PK_UserRoles",
|
|
table: "UserRoles",
|
|
columns: new[] { "UserId", "RoleId" });
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_UserRoles_RoleId",
|
|
table: "UserRoles",
|
|
column: "RoleId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Roles_UserId",
|
|
table: "Roles",
|
|
column: "UserId");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Roles_Users_UserId",
|
|
table: "Roles",
|
|
column: "UserId",
|
|
principalTable: "Users",
|
|
principalColumn: "Id");
|
|
}
|
|
}
|
|
}
|