|
|
|
|
@ -0,0 +1,232 @@
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
|
|
|
|
|
|
namespace Volo.Abp.Identity.EntityFrameworkCore.Migrations
|
|
|
|
|
{
|
|
|
|
|
public partial class AbpIdentity_Initial_Migration : Migration
|
|
|
|
|
{
|
|
|
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
|
|
|
{
|
|
|
|
|
migrationBuilder.CreateTable(
|
|
|
|
|
name: "IdentityRoles",
|
|
|
|
|
columns: table => new
|
|
|
|
|
{
|
|
|
|
|
Id = table.Column<string>(nullable: false),
|
|
|
|
|
ConcurrencyStamp = table.Column<string>(nullable: true),
|
|
|
|
|
Name = table.Column<string>(maxLength: 256, nullable: true),
|
|
|
|
|
NormalizedName = table.Column<string>(maxLength: 256, nullable: true)
|
|
|
|
|
},
|
|
|
|
|
constraints: table =>
|
|
|
|
|
{
|
|
|
|
|
table.PrimaryKey("PK_IdentityRoles", x => x.Id);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateTable(
|
|
|
|
|
name: "IdentityUsers",
|
|
|
|
|
columns: table => new
|
|
|
|
|
{
|
|
|
|
|
Id = table.Column<string>(nullable: false),
|
|
|
|
|
AccessFailedCount = table.Column<int>(nullable: false, defaultValue: 0),
|
|
|
|
|
ConcurrencyStamp = table.Column<string>(nullable: true),
|
|
|
|
|
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: true),
|
|
|
|
|
PasswordHash = table.Column<string>(nullable: true),
|
|
|
|
|
PhoneNumber = table.Column<string>(nullable: true),
|
|
|
|
|
PhoneNumberConfirmed = table.Column<bool>(nullable: false, defaultValue: false),
|
|
|
|
|
SecurityStamp = table.Column<string>(nullable: true),
|
|
|
|
|
TwoFactorEnabled = table.Column<bool>(nullable: false, defaultValue: false),
|
|
|
|
|
UserName = table.Column<string>(maxLength: 256, nullable: true)
|
|
|
|
|
},
|
|
|
|
|
constraints: table =>
|
|
|
|
|
{
|
|
|
|
|
table.PrimaryKey("PK_IdentityUsers", x => x.Id);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateTable(
|
|
|
|
|
name: "IdentityRoleClaims",
|
|
|
|
|
columns: table => new
|
|
|
|
|
{
|
|
|
|
|
Id = table.Column<string>(nullable: false),
|
|
|
|
|
ClaimType = table.Column<string>(nullable: true),
|
|
|
|
|
ClaimValue = table.Column<string>(nullable: true),
|
|
|
|
|
RoleId = table.Column<string>(nullable: false)
|
|
|
|
|
},
|
|
|
|
|
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<string>(nullable: false),
|
|
|
|
|
ClaimType = table.Column<string>(nullable: true),
|
|
|
|
|
ClaimValue = table.Column<string>(nullable: true),
|
|
|
|
|
UserId = table.Column<string>(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
|
|
|
|
|
{
|
|
|
|
|
Id = table.Column<string>(nullable: false),
|
|
|
|
|
LoginProvider = table.Column<string>(nullable: true),
|
|
|
|
|
ProviderDisplayName = table.Column<string>(nullable: true),
|
|
|
|
|
ProviderKey = table.Column<string>(nullable: true),
|
|
|
|
|
UserId = table.Column<string>(nullable: false)
|
|
|
|
|
},
|
|
|
|
|
constraints: table =>
|
|
|
|
|
{
|
|
|
|
|
table.PrimaryKey("PK_IdentityUserLogins", x => x.Id);
|
|
|
|
|
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
|
|
|
|
|
{
|
|
|
|
|
Id = table.Column<string>(nullable: false),
|
|
|
|
|
RoleId = table.Column<string>(nullable: false),
|
|
|
|
|
UserId = table.Column<string>(nullable: false)
|
|
|
|
|
},
|
|
|
|
|
constraints: table =>
|
|
|
|
|
{
|
|
|
|
|
table.PrimaryKey("PK_IdentityUserRoles", x => x.Id);
|
|
|
|
|
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
|
|
|
|
|
{
|
|
|
|
|
Id = table.Column<string>(nullable: false),
|
|
|
|
|
LoginProvider = table.Column<string>(nullable: true),
|
|
|
|
|
Name = table.Column<string>(nullable: true),
|
|
|
|
|
UserId = table.Column<string>(nullable: false),
|
|
|
|
|
Value = table.Column<string>(nullable: true)
|
|
|
|
|
},
|
|
|
|
|
constraints: table =>
|
|
|
|
|
{
|
|
|
|
|
table.PrimaryKey("PK_IdentityUserTokens", x => x.Id);
|
|
|
|
|
table.ForeignKey(
|
|
|
|
|
name: "FK_IdentityUserTokens_IdentityUsers_UserId",
|
|
|
|
|
column: x => x.UserId,
|
|
|
|
|
principalTable: "IdentityUsers",
|
|
|
|
|
principalColumn: "Id",
|
|
|
|
|
onDelete: ReferentialAction.Cascade);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateIndex(
|
|
|
|
|
name: "RoleNameIndex",
|
|
|
|
|
table: "IdentityRoles",
|
|
|
|
|
column: "NormalizedName",
|
|
|
|
|
unique: true);
|
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateIndex(
|
|
|
|
|
name: "IX_IdentityRoleClaims_RoleId",
|
|
|
|
|
table: "IdentityRoleClaims",
|
|
|
|
|
column: "RoleId");
|
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateIndex(
|
|
|
|
|
name: "EmailIndex",
|
|
|
|
|
table: "IdentityUsers",
|
|
|
|
|
column: "NormalizedEmail");
|
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateIndex(
|
|
|
|
|
name: "UserNameIndex",
|
|
|
|
|
table: "IdentityUsers",
|
|
|
|
|
column: "NormalizedUserName",
|
|
|
|
|
unique: true);
|
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateIndex(
|
|
|
|
|
name: "IX_IdentityUserClaims_UserId",
|
|
|
|
|
table: "IdentityUserClaims",
|
|
|
|
|
column: "UserId");
|
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateIndex(
|
|
|
|
|
name: "IX_IdentityUserLogins_UserId_LoginProvider_ProviderKey",
|
|
|
|
|
table: "IdentityUserLogins",
|
|
|
|
|
columns: new[] { "UserId", "LoginProvider", "ProviderKey" },
|
|
|
|
|
unique: true);
|
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateIndex(
|
|
|
|
|
name: "IX_IdentityUserRoles_RoleId",
|
|
|
|
|
table: "IdentityUserRoles",
|
|
|
|
|
column: "RoleId");
|
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateIndex(
|
|
|
|
|
name: "IX_IdentityUserRoles_UserId_RoleId",
|
|
|
|
|
table: "IdentityUserRoles",
|
|
|
|
|
columns: new[] { "UserId", "RoleId" },
|
|
|
|
|
unique: true);
|
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateIndex(
|
|
|
|
|
name: "IX_IdentityUserTokens_UserId_LoginProvider_Name",
|
|
|
|
|
table: "IdentityUserTokens",
|
|
|
|
|
columns: new[] { "UserId", "LoginProvider", "Name" },
|
|
|
|
|
unique: true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|