225 lines
8.3 KiB
C#
225 lines
8.3 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace StandManager.Infrastructure.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class UserApp : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropPrimaryKey(
|
|
name: "PK_ApplicationUsers",
|
|
table: "ApplicationUsers");
|
|
|
|
migrationBuilder.RenameTable(
|
|
name: "ApplicationUsers",
|
|
newName: "AspNetUsers");
|
|
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "UserName",
|
|
table: "AspNetUsers",
|
|
type: "nvarchar(256)",
|
|
maxLength: 256,
|
|
nullable: true,
|
|
oldClrType: typeof(string),
|
|
oldType: "nvarchar(max)",
|
|
oldNullable: true);
|
|
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "NormalizedUserName",
|
|
table: "AspNetUsers",
|
|
type: "nvarchar(256)",
|
|
maxLength: 256,
|
|
nullable: true,
|
|
oldClrType: typeof(string),
|
|
oldType: "nvarchar(max)",
|
|
oldNullable: true);
|
|
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "NormalizedEmail",
|
|
table: "AspNetUsers",
|
|
type: "nvarchar(256)",
|
|
maxLength: 256,
|
|
nullable: true,
|
|
oldClrType: typeof(string),
|
|
oldType: "nvarchar(max)",
|
|
oldNullable: true);
|
|
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "Email",
|
|
table: "AspNetUsers",
|
|
type: "nvarchar(256)",
|
|
maxLength: 256,
|
|
nullable: true,
|
|
oldClrType: typeof(string),
|
|
oldType: "nvarchar(max)",
|
|
oldNullable: true);
|
|
|
|
migrationBuilder.AddPrimaryKey(
|
|
name: "PK_AspNetUsers",
|
|
table: "AspNetUsers",
|
|
column: "Id");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "AspNetUserClaims",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
UserId = table.Column<string>(type: "nvarchar(450)", nullable: false),
|
|
ClaimType = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
ClaimValue = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_AspNetUserClaims", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_AspNetUserClaims_AspNetUsers_UserId",
|
|
column: x => x.UserId,
|
|
principalTable: "AspNetUsers",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "AspNetUserLogins",
|
|
columns: table => new
|
|
{
|
|
LoginProvider = table.Column<string>(type: "nvarchar(450)", nullable: false),
|
|
ProviderKey = table.Column<string>(type: "nvarchar(450)", nullable: false),
|
|
ProviderDisplayName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
UserId = table.Column<string>(type: "nvarchar(450)", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey });
|
|
table.ForeignKey(
|
|
name: "FK_AspNetUserLogins_AspNetUsers_UserId",
|
|
column: x => x.UserId,
|
|
principalTable: "AspNetUsers",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "AspNetUserTokens",
|
|
columns: table => new
|
|
{
|
|
UserId = table.Column<string>(type: "nvarchar(450)", nullable: false),
|
|
LoginProvider = table.Column<string>(type: "nvarchar(450)", nullable: false),
|
|
Name = table.Column<string>(type: "nvarchar(450)", nullable: false),
|
|
Value = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
|
|
table.ForeignKey(
|
|
name: "FK_AspNetUserTokens_AspNetUsers_UserId",
|
|
column: x => x.UserId,
|
|
principalTable: "AspNetUsers",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "EmailIndex",
|
|
table: "AspNetUsers",
|
|
column: "NormalizedEmail");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "UserNameIndex",
|
|
table: "AspNetUsers",
|
|
column: "NormalizedUserName",
|
|
unique: true,
|
|
filter: "[NormalizedUserName] IS NOT NULL");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_AspNetUserClaims_UserId",
|
|
table: "AspNetUserClaims",
|
|
column: "UserId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_AspNetUserLogins_UserId",
|
|
table: "AspNetUserLogins",
|
|
column: "UserId");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "AspNetUserClaims");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "AspNetUserLogins");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "AspNetUserTokens");
|
|
|
|
migrationBuilder.DropPrimaryKey(
|
|
name: "PK_AspNetUsers",
|
|
table: "AspNetUsers");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "EmailIndex",
|
|
table: "AspNetUsers");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "UserNameIndex",
|
|
table: "AspNetUsers");
|
|
|
|
migrationBuilder.RenameTable(
|
|
name: "AspNetUsers",
|
|
newName: "ApplicationUsers");
|
|
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "UserName",
|
|
table: "ApplicationUsers",
|
|
type: "nvarchar(max)",
|
|
nullable: true,
|
|
oldClrType: typeof(string),
|
|
oldType: "nvarchar(256)",
|
|
oldMaxLength: 256,
|
|
oldNullable: true);
|
|
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "NormalizedUserName",
|
|
table: "ApplicationUsers",
|
|
type: "nvarchar(max)",
|
|
nullable: true,
|
|
oldClrType: typeof(string),
|
|
oldType: "nvarchar(256)",
|
|
oldMaxLength: 256,
|
|
oldNullable: true);
|
|
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "NormalizedEmail",
|
|
table: "ApplicationUsers",
|
|
type: "nvarchar(max)",
|
|
nullable: true,
|
|
oldClrType: typeof(string),
|
|
oldType: "nvarchar(256)",
|
|
oldMaxLength: 256,
|
|
oldNullable: true);
|
|
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "Email",
|
|
table: "ApplicationUsers",
|
|
type: "nvarchar(max)",
|
|
nullable: true,
|
|
oldClrType: typeof(string),
|
|
oldType: "nvarchar(256)",
|
|
oldMaxLength: 256,
|
|
oldNullable: true);
|
|
|
|
migrationBuilder.AddPrimaryKey(
|
|
name: "PK_ApplicationUsers",
|
|
table: "ApplicationUsers",
|
|
column: "Id");
|
|
}
|
|
}
|
|
}
|