110 lines
3.3 KiB
C#
110 lines
3.3 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace MainProject.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AlterTableUsersForPasswordEncryption : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Users_Roles_RoleId",
|
|
table: "Users");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "PasswordHash",
|
|
table: "Users");
|
|
|
|
migrationBuilder.AlterColumn<int>(
|
|
name: "RoleId",
|
|
table: "Users",
|
|
type: "int",
|
|
nullable: true,
|
|
oldClrType: typeof(int),
|
|
oldType: "int");
|
|
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "Password",
|
|
table: "Users",
|
|
type: "nvarchar(max)",
|
|
nullable: true,
|
|
oldClrType: typeof(string),
|
|
oldType: "nvarchar(max)");
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "PasswordIterations",
|
|
table: "Users",
|
|
type: "int",
|
|
nullable: false,
|
|
defaultValue: 0);
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "PasswordPepper",
|
|
table: "Users",
|
|
type: "nvarchar(max)",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Users_Roles_RoleId",
|
|
table: "Users",
|
|
column: "RoleId",
|
|
principalTable: "Roles",
|
|
principalColumn: "Id");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Users_Roles_RoleId",
|
|
table: "Users");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "PasswordIterations",
|
|
table: "Users");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "PasswordPepper",
|
|
table: "Users");
|
|
|
|
migrationBuilder.AlterColumn<int>(
|
|
name: "RoleId",
|
|
table: "Users",
|
|
type: "int",
|
|
nullable: false,
|
|
defaultValue: 0,
|
|
oldClrType: typeof(int),
|
|
oldType: "int",
|
|
oldNullable: true);
|
|
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "Password",
|
|
table: "Users",
|
|
type: "nvarchar(max)",
|
|
nullable: false,
|
|
defaultValue: "",
|
|
oldClrType: typeof(string),
|
|
oldType: "nvarchar(max)",
|
|
oldNullable: true);
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "PasswordHash",
|
|
table: "Users",
|
|
type: "nvarchar(max)",
|
|
nullable: false,
|
|
defaultValue: "");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Users_Roles_RoleId",
|
|
table: "Users",
|
|
column: "RoleId",
|
|
principalTable: "Roles",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
}
|
|
}
|
|
}
|