Browse Source

Tweak the maximum column lengths used in the EF 6/EF Core stores

pull/1106/head
Kévin Chalet 5 years ago
parent
commit
3bd87668da
  1. 7
      src/OpenIddict.EntityFramework/Configurations/OpenIddictEntityFrameworkApplicationConfiguration.cs
  2. 8
      src/OpenIddict.EntityFramework/Configurations/OpenIddictEntityFrameworkAuthorizationConfiguration.cs
  3. 2
      src/OpenIddict.EntityFramework/Configurations/OpenIddictEntityFrameworkScopeConfiguration.cs
  4. 8
      src/OpenIddict.EntityFramework/Configurations/OpenIddictEntityFrameworkTokenConfiguration.cs
  5. 7
      src/OpenIddict.EntityFrameworkCore/Configurations/OpenIddictEntityFrameworkCoreApplicationConfiguration.cs
  6. 8
      src/OpenIddict.EntityFrameworkCore/Configurations/OpenIddictEntityFrameworkCoreAuthorizationConfiguration.cs
  7. 2
      src/OpenIddict.EntityFrameworkCore/Configurations/OpenIddictEntityFrameworkCoreScopeConfiguration.cs
  8. 8
      src/OpenIddict.EntityFrameworkCore/Configurations/OpenIddictEntityFrameworkCoreTokenConfiguration.cs

7
src/OpenIddict.EntityFramework/Configurations/OpenIddictEntityFrameworkApplicationConfiguration.cs

@ -33,7 +33,7 @@ namespace OpenIddict.EntityFramework
// Entity Framework would throw an exception due to the TKey generic parameter
// being non-nullable when using value types like short, int, long or Guid.
HasKey(application => application.Id!);
HasKey(application => application.Id);
Property(application => application.ClientId)
.HasMaxLength(100)
@ -46,8 +46,11 @@ namespace OpenIddict.EntityFramework
.HasMaxLength(50)
.IsConcurrencyToken();
Property(application => application.ConsentType)
.HasMaxLength(50);
Property(application => application.Type)
.HasMaxLength(25);
.HasMaxLength(50);
HasMany(application => application.Authorizations)
.WithOptional(authorization => authorization.Application!)

8
src/OpenIddict.EntityFramework/Configurations/OpenIddictEntityFrameworkAuthorizationConfiguration.cs

@ -31,20 +31,20 @@ namespace OpenIddict.EntityFramework
// Entity Framework would throw an exception due to the TKey generic parameter
// being non-nullable when using value types like short, int, long or Guid.
HasKey(authorization => authorization.Id!);
HasKey(authorization => authorization.Id);
Property(authorization => authorization.ConcurrencyToken)
.HasMaxLength(50)
.IsConcurrencyToken();
Property(authorization => authorization.Status)
.HasMaxLength(25);
.HasMaxLength(50);
Property(authorization => authorization.Subject)
.HasMaxLength(450);
.HasMaxLength(400);
Property(authorization => authorization.Type)
.HasMaxLength(25);
.HasMaxLength(50);
HasMany(authorization => authorization.Tokens)
.WithOptional(token => token.Authorization!)

2
src/OpenIddict.EntityFramework/Configurations/OpenIddictEntityFrameworkScopeConfiguration.cs

@ -29,7 +29,7 @@ namespace OpenIddict.EntityFramework
// Entity Framework would throw an exception due to the TKey generic parameter
// being non-nullable when using value types like short, int, long or Guid.
HasKey(scope => scope.Id!);
HasKey(scope => scope.Id);
Property(scope => scope.ConcurrencyToken)
.HasMaxLength(50)

8
src/OpenIddict.EntityFramework/Configurations/OpenIddictEntityFrameworkTokenConfiguration.cs

@ -33,7 +33,7 @@ namespace OpenIddict.EntityFramework
// Entity Framework would throw an exception due to the TKey generic parameter
// being non-nullable when using value types like short, int, long or Guid.
HasKey(token => token.Id!);
HasKey(token => token.Id);
Property(token => token.ConcurrencyToken)
.HasMaxLength(50)
@ -47,13 +47,13 @@ namespace OpenIddict.EntityFramework
.HasColumnAnnotation(IndexAnnotation.AnnotationName, new IndexAnnotation(new IndexAttribute()));
Property(token => token.Status)
.HasMaxLength(25);
.HasMaxLength(50);
Property(token => token.Subject)
.HasMaxLength(450);
.HasMaxLength(400);
Property(token => token.Type)
.HasMaxLength(25);
.HasMaxLength(50);
ToTable("OpenIddictTokens");
}

7
src/OpenIddict.EntityFrameworkCore/Configurations/OpenIddictEntityFrameworkCoreApplicationConfiguration.cs

@ -52,11 +52,14 @@ namespace OpenIddict.EntityFrameworkCore
.HasMaxLength(50)
.IsConcurrencyToken();
builder.Property(application => application.Id!)
builder.Property(application => application.ConsentType)
.HasMaxLength(50);
builder.Property(application => application.Id)
.ValueGeneratedOnAdd();
builder.Property(application => application.Type)
.HasMaxLength(25);
.HasMaxLength(50);
builder.HasMany(application => application.Authorizations)
.WithOne(authorization => authorization.Application!)

8
src/OpenIddict.EntityFrameworkCore/Configurations/OpenIddictEntityFrameworkCoreAuthorizationConfiguration.cs

@ -49,17 +49,17 @@ namespace OpenIddict.EntityFrameworkCore
.HasMaxLength(50)
.IsConcurrencyToken();
builder.Property(authorization => authorization.Id!)
builder.Property(authorization => authorization.Id)
.ValueGeneratedOnAdd();
builder.Property(authorization => authorization.Status)
.HasMaxLength(25);
.HasMaxLength(50);
builder.Property(authorization => authorization.Subject)
.HasMaxLength(450);
.HasMaxLength(400);
builder.Property(authorization => authorization.Type)
.HasMaxLength(25);
.HasMaxLength(50);
builder.HasMany(authorization => authorization.Tokens)
.WithOne(token => token.Authorization!)

2
src/OpenIddict.EntityFrameworkCore/Configurations/OpenIddictEntityFrameworkCoreScopeConfiguration.cs

@ -45,7 +45,7 @@ namespace OpenIddict.EntityFrameworkCore
.HasMaxLength(50)
.IsConcurrencyToken();
builder.Property(scope => scope.Id!)
builder.Property(scope => scope.Id)
.ValueGeneratedOnAdd();
builder.Property(scope => scope.Name)

8
src/OpenIddict.EntityFrameworkCore/Configurations/OpenIddictEntityFrameworkCoreTokenConfiguration.cs

@ -55,20 +55,20 @@ namespace OpenIddict.EntityFrameworkCore
.HasMaxLength(50)
.IsConcurrencyToken();
builder.Property(token => token.Id!)
builder.Property(token => token.Id)
.ValueGeneratedOnAdd();
builder.Property(token => token.ReferenceId)
.HasMaxLength(100);
builder.Property(token => token.Status)
.HasMaxLength(25);
.HasMaxLength(50);
builder.Property(token => token.Subject)
.HasMaxLength(450);
.HasMaxLength(400);
builder.Property(token => token.Type)
.HasMaxLength(25);
.HasMaxLength(50);
builder.ToTable("OpenIddictTokens");
}

Loading…
Cancel
Save