Skip to content

Commit

Permalink
VCST-1592: Update OpenIddict (#2842)
Browse files Browse the repository at this point in the history
  • Loading branch information
artem-dudarev authored Oct 7, 2024
1 parent a314abb commit b12094d
Show file tree
Hide file tree
Showing 12 changed files with 2,381 additions and 18 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace VirtoCommerce.Platform.Data.MySql.Migrations.Security
{
/// <inheritdoc />
public partial class UpdateOpenIddict : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "Type",
table: "OpenIddictApplications",
newName: "ClientType");

migrationBuilder.AddColumn<string>(
name: "ApplicationType",
table: "OpenIddictApplications",
type: "varchar(50)",
maxLength: 50,
nullable: true)
.Annotation("MySql:CharSet", "utf8mb4");

migrationBuilder.AddColumn<string>(
name: "JsonWebKeySet",
table: "OpenIddictApplications",
type: "longtext",
nullable: true)
.Annotation("MySql:CharSet", "utf8mb4");

migrationBuilder.AddColumn<string>(
name: "Settings",
table: "OpenIddictApplications",
type: "longtext",
nullable: true)
.Annotation("MySql:CharSet", "utf8mb4");

migrationBuilder.AlterColumn<int>(
name: "Id",
table: "AspNetUserClaims",
type: "int",
nullable: false,
oldClrType: typeof(int),
oldType: "int")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);

migrationBuilder.AlterColumn<int>(
name: "Id",
table: "AspNetRoleClaims",
type: "int",
nullable: false,
oldClrType: typeof(int),
oldType: "int")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "ApplicationType",
table: "OpenIddictApplications");

migrationBuilder.DropColumn(
name: "JsonWebKeySet",
table: "OpenIddictApplications");

migrationBuilder.DropColumn(
name: "Settings",
table: "OpenIddictApplications");

migrationBuilder.RenameColumn(
name: "ClientType",
table: "OpenIddictApplications",
newName: "Type");

migrationBuilder.AlterColumn<int>(
name: "Id",
table: "AspNetUserClaims",
type: "int",
nullable: false,
oldClrType: typeof(int),
oldType: "int")
.OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);

migrationBuilder.AlterColumn<int>(
name: "Id",
table: "AspNetRoleClaims",
type: "int",
nullable: false,
oldClrType: typeof(int),
oldType: "int")
.OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using VirtoCommerce.Platform.Security.Repositories;

Expand All @@ -16,15 +17,19 @@ protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.13")
.HasAnnotation("ProductVersion", "8.0.8")
.HasAnnotation("Relational:MaxIdentifierLength", 64);

MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);

modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("longtext");
Expand All @@ -49,6 +54,8 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("longtext");
Expand Down Expand Up @@ -135,13 +142,21 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.ValueGeneratedOnAdd()
.HasColumnType("varchar(95)");
b.Property<string>("ApplicationType")
.HasMaxLength(50)
.HasColumnType("varchar(50)");
b.Property<string>("ClientId")
.HasMaxLength(100)
.HasColumnType("varchar(100)");
b.Property<string>("ClientSecret")
.HasColumnType("longtext");
b.Property<string>("ClientType")
.HasMaxLength(50)
.HasColumnType("varchar(50)");
b.Property<string>("ConcurrencyToken")
.IsConcurrencyToken()
.HasMaxLength(50)
Expand All @@ -157,6 +172,9 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.Property<string>("DisplayNames")
.HasColumnType("longtext");
b.Property<string>("JsonWebKeySet")
.HasColumnType("longtext");
b.Property<string>("Permissions")
.HasColumnType("longtext");
Expand All @@ -172,9 +190,8 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.Property<string>("Requirements")
.HasColumnType("longtext");
b.Property<string>("Type")
.HasMaxLength(50)
.HasColumnType("varchar(50)");
b.Property<string>("Settings")
.HasColumnType("longtext");
b.HasKey("Id");
Expand Down
Loading

0 comments on commit b12094d

Please sign in to comment.