71 lines
2.1 KiB
C#
71 lines
2.1 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace UserManagement.API.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class UniqueProperties : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "USER_NAME",
|
|
table: "Users",
|
|
type: "nvarchar(450)",
|
|
nullable: false,
|
|
oldClrType: typeof(string),
|
|
oldType: "nvarchar(max)");
|
|
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "ROLE",
|
|
table: "Roles",
|
|
type: "nvarchar(450)",
|
|
nullable: false,
|
|
oldClrType: typeof(string),
|
|
oldType: "nvarchar(max)");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Users_USER_NAME",
|
|
table: "Users",
|
|
column: "USER_NAME",
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Roles_ROLE",
|
|
table: "Roles",
|
|
column: "ROLE",
|
|
unique: true);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_Users_USER_NAME",
|
|
table: "Users");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_Roles_ROLE",
|
|
table: "Roles");
|
|
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "USER_NAME",
|
|
table: "Users",
|
|
type: "nvarchar(max)",
|
|
nullable: false,
|
|
oldClrType: typeof(string),
|
|
oldType: "nvarchar(450)");
|
|
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "ROLE",
|
|
table: "Roles",
|
|
type: "nvarchar(max)",
|
|
nullable: false,
|
|
oldClrType: typeof(string),
|
|
oldType: "nvarchar(450)");
|
|
}
|
|
}
|
|
}
|