Open Source Web Application Framework for ASP.NET Core
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

221 lines
9.8 KiB

using Microsoft.EntityFrameworkCore.Migrations;
using System;
using System.Collections.Generic;
namespace MicroserviceDemo.Web.Migrations
{
public partial class Installed_Identity_Module : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "IdentityRoles",
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
ConcurrencyStamp = table.Column<string>(nullable: true),
Name = table.Column<string>(maxLength: 256, nullable: false),
NormalizedName = table.Column<string>(maxLength: 256, nullable: false),
TenantId = table.Column<Guid>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_IdentityRoles", x => x.Id);
});
migrationBuilder.CreateTable(
name: "IdentityUsers",
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
AccessFailedCount = table.Column<int>(nullable: false, defaultValue: 0),
ConcurrencyStamp = table.Column<string>(maxLength: 256, nullable: false),
Email = table.Column<string>(maxLength: 256, nullable: true),
EmailConfirmed = table.Column<bool>(nullable: false, defaultValue: false),
LockoutEnabled = table.Column<bool>(nullable: false, defaultValue: false),
LockoutEnd = table.Column<DateTimeOffset>(nullable: true),
NormalizedEmail = table.Column<string>(maxLength: 256, nullable: true),
NormalizedUserName = table.Column<string>(maxLength: 256, nullable: false),
PasswordHash = table.Column<string>(maxLength: 256, nullable: true),
PhoneNumber = table.Column<string>(maxLength: 16, nullable: true),
PhoneNumberConfirmed = table.Column<bool>(nullable: false, defaultValue: false),
SecurityStamp = table.Column<string>(maxLength: 256, nullable: false),
TenantId = table.Column<Guid>(nullable: true),
TwoFactorEnabled = table.Column<bool>(nullable: false, defaultValue: false),
UserName = table.Column<string>(maxLength: 256, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_IdentityUsers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "IdentityRoleClaims",
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
ClaimType = table.Column<string>(maxLength: 256, nullable: false),
ClaimValue = table.Column<string>(maxLength: 1024, nullable: true),
RoleId = table.Column<Guid>(nullable: false),
TenantId = table.Column<Guid>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_IdentityRoleClaims", x => x.Id);
table.ForeignKey(
name: "FK_IdentityRoleClaims_IdentityRoles_RoleId",
column: x => x.RoleId,
principalTable: "IdentityRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "IdentityUserClaims",
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
ClaimType = table.Column<string>(maxLength: 256, nullable: false),
ClaimValue = table.Column<string>(maxLength: 1024, nullable: true),
TenantId = table.Column<Guid>(nullable: true),
UserId = table.Column<Guid>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_IdentityUserClaims", x => x.Id);
table.ForeignKey(
name: "FK_IdentityUserClaims_IdentityUsers_UserId",
column: x => x.UserId,
principalTable: "IdentityUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "IdentityUserLogins",
columns: table => new
{
UserId = table.Column<Guid>(nullable: false),
LoginProvider = table.Column<string>(maxLength: 64, nullable: false),
ProviderDisplayName = table.Column<string>(maxLength: 128, nullable: true),
ProviderKey = table.Column<string>(maxLength: 196, nullable: false),
TenantId = table.Column<Guid>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_IdentityUserLogins", x => new { x.UserId, x.LoginProvider });
table.ForeignKey(
name: "FK_IdentityUserLogins_IdentityUsers_UserId",
column: x => x.UserId,
principalTable: "IdentityUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "IdentityUserRoles",
columns: table => new
{
UserId = table.Column<Guid>(nullable: false),
RoleId = table.Column<Guid>(nullable: false),
TenantId = table.Column<Guid>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_IdentityUserRoles", x => new { x.UserId, x.RoleId });
table.ForeignKey(
name: "FK_IdentityUserRoles_IdentityRoles_RoleId",
column: x => x.RoleId,
principalTable: "IdentityRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_IdentityUserRoles_IdentityUsers_UserId",
column: x => x.UserId,
principalTable: "IdentityUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "IdentityUserTokens",
columns: table => new
{
UserId = table.Column<Guid>(nullable: false),
LoginProvider = table.Column<string>(maxLength: 128, nullable: false),
Name = table.Column<string>(nullable: false),
TenantId = table.Column<Guid>(nullable: true),
Value = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_IdentityUserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
table.ForeignKey(
name: "FK_IdentityUserTokens_IdentityUsers_UserId",
column: x => x.UserId,
principalTable: "IdentityUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_IdentityRoleClaims_RoleId",
table: "IdentityRoleClaims",
column: "RoleId");
migrationBuilder.CreateIndex(
name: "IX_IdentityRoles_NormalizedName",
table: "IdentityRoles",
column: "NormalizedName");
migrationBuilder.CreateIndex(
name: "IX_IdentityUserClaims_UserId",
table: "IdentityUserClaims",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_IdentityUserLogins_LoginProvider_ProviderKey",
table: "IdentityUserLogins",
columns: new[] { "LoginProvider", "ProviderKey" });
migrationBuilder.CreateIndex(
name: "IX_IdentityUserRoles_RoleId_UserId",
table: "IdentityUserRoles",
columns: new[] { "RoleId", "UserId" });
migrationBuilder.CreateIndex(
name: "IX_IdentityUsers_NormalizedEmail",
table: "IdentityUsers",
column: "NormalizedEmail");
migrationBuilder.CreateIndex(
name: "IX_IdentityUsers_NormalizedUserName",
table: "IdentityUsers",
column: "NormalizedUserName");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "IdentityRoleClaims");
migrationBuilder.DropTable(
name: "IdentityUserClaims");
migrationBuilder.DropTable(
name: "IdentityUserLogins");
migrationBuilder.DropTable(
name: "IdentityUserRoles");
migrationBuilder.DropTable(
name: "IdentityUserTokens");
migrationBuilder.DropTable(
name: "IdentityRoles");
migrationBuilder.DropTable(
name: "IdentityUsers");
}
}
}