52 lines
1.7 KiB
C#
52 lines
1.7 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace JobTrackerApi.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddCanonicalMicrosoftIdentity : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
var stringType = ActiveProvider.Contains("MySql", StringComparison.OrdinalIgnoreCase) ? "varchar(36)" : "TEXT";
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "MicrosoftObjectId",
|
|
table: "AspNetUsers",
|
|
type: stringType,
|
|
maxLength: 36,
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "MicrosoftTenantId",
|
|
table: "AspNetUsers",
|
|
type: stringType,
|
|
maxLength: 36,
|
|
nullable: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_AspNetUsers_MicrosoftTenantId_MicrosoftObjectId",
|
|
table: "AspNetUsers",
|
|
columns: new[] { "MicrosoftTenantId", "MicrosoftObjectId" },
|
|
unique: true);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_AspNetUsers_MicrosoftTenantId_MicrosoftObjectId",
|
|
table: "AspNetUsers");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "MicrosoftObjectId",
|
|
table: "AspNetUsers");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "MicrosoftTenantId",
|
|
table: "AspNetUsers");
|
|
}
|
|
}
|
|
}
|