diff --git a/README.md b/README.md index 6c905692..ae2475d7 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ # Atles (Alpha) -![.NET Core](https://github.com/lucabriguglia/Atles/workflows/.NET%20Core/badge.svg) - A forum software built with ASP.NET Blazor WebAssembly and CQRS. **Documentation**: [Atles Wiki](https://lucabriguglia.github.io/Atles). @@ -11,8 +9,8 @@ A forum software built with ASP.NET Blazor WebAssembly and CQRS. ## Technology -- Blazor WebAssembly 5.0.1 -- Entity Framework Core 5.0.1 +- Blazor WebAssembly 6.0.1 +- Entity Framework Core 6.0.1 - SQL Server ## Features @@ -21,7 +19,7 @@ A forum software built with ASP.NET Blazor WebAssembly and CQRS. - Multi language - Granular permissions - Markdown editor -- You can use your own ASP.NET Identity +- An existing ASP.NET Identity database can be used ## Run on local diff --git a/sql/IdentityConnection.Migrations.sql b/sql/IdentityConnection.Migrations.sql index 4f44bcf0..c4cabdbb 100644 --- a/sql/IdentityConnection.Migrations.sql +++ b/sql/IdentityConnection.Migrations.sql @@ -11,7 +11,7 @@ GO BEGIN TRANSACTION; GO -IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'00000000000000_CreateIdentitySchema') +IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'20220126100216_InitialCreate') BEGIN CREATE TABLE [AspNetRoles] ( [Id] nvarchar(450) NOT NULL, @@ -23,7 +23,7 @@ BEGIN END; GO -IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'00000000000000_CreateIdentitySchema') +IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'20220126100216_InitialCreate') BEGIN CREATE TABLE [AspNetUsers] ( [Id] nvarchar(450) NOT NULL, @@ -46,13 +46,15 @@ BEGIN END; GO -IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'00000000000000_CreateIdentitySchema') +IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'20220126100216_InitialCreate') BEGIN CREATE TABLE [DeviceCodes] ( [UserCode] nvarchar(200) NOT NULL, [DeviceCode] nvarchar(200) NOT NULL, [SubjectId] nvarchar(200) NULL, + [SessionId] nvarchar(100) NULL, [ClientId] nvarchar(200) NOT NULL, + [Description] nvarchar(200) NULL, [CreationTime] datetime2 NOT NULL, [Expiration] datetime2 NOT NULL, [Data] nvarchar(max) NOT NULL, @@ -61,22 +63,41 @@ BEGIN END; GO -IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'00000000000000_CreateIdentitySchema') +IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'20220126100216_InitialCreate') +BEGIN + CREATE TABLE [Keys] ( + [Id] nvarchar(450) NOT NULL, + [Version] int NOT NULL, + [Created] datetime2 NOT NULL, + [Use] nvarchar(450) NULL, + [Algorithm] nvarchar(100) NOT NULL, + [IsX509Certificate] bit NOT NULL, + [DataProtected] bit NOT NULL, + [Data] nvarchar(max) NOT NULL, + CONSTRAINT [PK_Keys] PRIMARY KEY ([Id]) + ); +END; +GO + +IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'20220126100216_InitialCreate') BEGIN CREATE TABLE [PersistedGrants] ( [Key] nvarchar(200) NOT NULL, [Type] nvarchar(50) NOT NULL, [SubjectId] nvarchar(200) NULL, + [SessionId] nvarchar(100) NULL, [ClientId] nvarchar(200) NOT NULL, + [Description] nvarchar(200) NULL, [CreationTime] datetime2 NOT NULL, [Expiration] datetime2 NULL, + [ConsumedTime] datetime2 NULL, [Data] nvarchar(max) NOT NULL, CONSTRAINT [PK_PersistedGrants] PRIMARY KEY ([Key]) ); END; GO -IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'00000000000000_CreateIdentitySchema') +IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'20220126100216_InitialCreate') BEGIN CREATE TABLE [AspNetRoleClaims] ( [Id] int NOT NULL IDENTITY, @@ -89,7 +110,7 @@ BEGIN END; GO -IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'00000000000000_CreateIdentitySchema') +IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'20220126100216_InitialCreate') BEGIN CREATE TABLE [AspNetUserClaims] ( [Id] int NOT NULL IDENTITY, @@ -102,7 +123,7 @@ BEGIN END; GO -IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'00000000000000_CreateIdentitySchema') +IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'20220126100216_InitialCreate') BEGIN CREATE TABLE [AspNetUserLogins] ( [LoginProvider] nvarchar(128) NOT NULL, @@ -115,7 +136,7 @@ BEGIN END; GO -IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'00000000000000_CreateIdentitySchema') +IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'20220126100216_InitialCreate') BEGIN CREATE TABLE [AspNetUserRoles] ( [UserId] nvarchar(450) NOT NULL, @@ -127,7 +148,7 @@ BEGIN END; GO -IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'00000000000000_CreateIdentitySchema') +IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'20220126100216_InitialCreate') BEGIN CREATE TABLE [AspNetUserTokens] ( [UserId] nvarchar(450) NOT NULL, @@ -140,125 +161,94 @@ BEGIN END; GO -IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'00000000000000_CreateIdentitySchema') +IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'20220126100216_InitialCreate') BEGIN CREATE INDEX [IX_AspNetRoleClaims_RoleId] ON [AspNetRoleClaims] ([RoleId]); END; GO -IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'00000000000000_CreateIdentitySchema') +IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'20220126100216_InitialCreate') BEGIN EXEC(N'CREATE UNIQUE INDEX [RoleNameIndex] ON [AspNetRoles] ([NormalizedName]) WHERE [NormalizedName] IS NOT NULL'); END; GO -IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'00000000000000_CreateIdentitySchema') +IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'20220126100216_InitialCreate') BEGIN CREATE INDEX [IX_AspNetUserClaims_UserId] ON [AspNetUserClaims] ([UserId]); END; GO -IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'00000000000000_CreateIdentitySchema') +IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'20220126100216_InitialCreate') BEGIN CREATE INDEX [IX_AspNetUserLogins_UserId] ON [AspNetUserLogins] ([UserId]); END; GO -IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'00000000000000_CreateIdentitySchema') +IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'20220126100216_InitialCreate') BEGIN CREATE INDEX [IX_AspNetUserRoles_RoleId] ON [AspNetUserRoles] ([RoleId]); END; GO -IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'00000000000000_CreateIdentitySchema') +IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'20220126100216_InitialCreate') BEGIN CREATE INDEX [EmailIndex] ON [AspNetUsers] ([NormalizedEmail]); END; GO -IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'00000000000000_CreateIdentitySchema') +IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'20220126100216_InitialCreate') BEGIN EXEC(N'CREATE UNIQUE INDEX [UserNameIndex] ON [AspNetUsers] ([NormalizedUserName]) WHERE [NormalizedUserName] IS NOT NULL'); END; GO -IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'00000000000000_CreateIdentitySchema') +IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'20220126100216_InitialCreate') BEGIN CREATE UNIQUE INDEX [IX_DeviceCodes_DeviceCode] ON [DeviceCodes] ([DeviceCode]); END; GO -IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'00000000000000_CreateIdentitySchema') +IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'20220126100216_InitialCreate') BEGIN CREATE INDEX [IX_DeviceCodes_Expiration] ON [DeviceCodes] ([Expiration]); END; GO -IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'00000000000000_CreateIdentitySchema') -BEGIN - CREATE INDEX [IX_PersistedGrants_Expiration] ON [PersistedGrants] ([Expiration]); -END; -GO - -IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'00000000000000_CreateIdentitySchema') -BEGIN - CREATE INDEX [IX_PersistedGrants_SubjectId_ClientId_Type] ON [PersistedGrants] ([SubjectId], [ClientId], [Type]); -END; -GO - -IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'00000000000000_CreateIdentitySchema') +IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'20220126100216_InitialCreate') BEGIN - INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion]) - VALUES (N'00000000000000_CreateIdentitySchema', N'5.0.1'); + CREATE INDEX [IX_Keys_Use] ON [Keys] ([Use]); END; GO -COMMIT; -GO - -BEGIN TRANSACTION; -GO - -IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'20210106103055_UpdateIdentityServer') +IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'20220126100216_InitialCreate') BEGIN - ALTER TABLE [PersistedGrants] ADD [ConsumedTime] datetime2 NULL; + CREATE INDEX [IX_PersistedGrants_ConsumedTime] ON [PersistedGrants] ([ConsumedTime]); END; GO -IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'20210106103055_UpdateIdentityServer') +IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'20220126100216_InitialCreate') BEGIN - ALTER TABLE [PersistedGrants] ADD [Description] nvarchar(200) NULL; -END; -GO - -IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'20210106103055_UpdateIdentityServer') -BEGIN - ALTER TABLE [PersistedGrants] ADD [SessionId] nvarchar(100) NULL; -END; -GO - -IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'20210106103055_UpdateIdentityServer') -BEGIN - ALTER TABLE [DeviceCodes] ADD [Description] nvarchar(200) NULL; + CREATE INDEX [IX_PersistedGrants_Expiration] ON [PersistedGrants] ([Expiration]); END; GO -IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'20210106103055_UpdateIdentityServer') +IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'20220126100216_InitialCreate') BEGIN - ALTER TABLE [DeviceCodes] ADD [SessionId] nvarchar(100) NULL; + CREATE INDEX [IX_PersistedGrants_SubjectId_ClientId_Type] ON [PersistedGrants] ([SubjectId], [ClientId], [Type]); END; GO -IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'20210106103055_UpdateIdentityServer') +IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'20220126100216_InitialCreate') BEGIN CREATE INDEX [IX_PersistedGrants_SubjectId_SessionId_Type] ON [PersistedGrants] ([SubjectId], [SessionId], [Type]); END; GO -IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'20210106103055_UpdateIdentityServer') +IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'20220126100216_InitialCreate') BEGIN INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion]) - VALUES (N'20210106103055_UpdateIdentityServer', N'5.0.1'); + VALUES (N'20220126100216_InitialCreate', N'6.0.1'); END; GO diff --git a/src/Atles.Client/Atles.Client.csproj b/src/Atles.Client/Atles.Client.csproj index 3a90c22f..807d3a09 100644 --- a/src/Atles.Client/Atles.Client.csproj +++ b/src/Atles.Client/Atles.Client.csproj @@ -1,7 +1,7 @@  - net5.0 + net6.0 service-worker-assets.js @@ -17,13 +17,13 @@ - - - - - - - + + + + + + + diff --git a/src/Atles.Data/Atles.Data.csproj b/src/Atles.Data/Atles.Data.csproj index 2468fc30..5d7be154 100644 --- a/src/Atles.Data/Atles.Data.csproj +++ b/src/Atles.Data/Atles.Data.csproj @@ -1,18 +1,18 @@  - net5.0 + net6.0 true - - - - - - + + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Atles.Data/IdentityDbContext.cs b/src/Atles.Data/IdentityDbContext.cs index ade66564..12f47d8a 100644 --- a/src/Atles.Data/IdentityDbContext.cs +++ b/src/Atles.Data/IdentityDbContext.cs @@ -1,4 +1,4 @@ -using IdentityServer4.EntityFramework.Options; +using Duende.IdentityServer.EntityFramework.Options; using Microsoft.AspNetCore.ApiAuthorization.IdentityServer; using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; diff --git a/src/Atles.Data/Migrations/IdentityMigrations/00000000000000_CreateIdentitySchema.Designer.cs b/src/Atles.Data/Migrations/IdentityMigrations/00000000000000_CreateIdentitySchema.Designer.cs deleted file mode 100644 index 423d63a0..00000000 --- a/src/Atles.Data/Migrations/IdentityMigrations/00000000000000_CreateIdentitySchema.Designer.cs +++ /dev/null @@ -1,358 +0,0 @@ -// - -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; - -namespace Atles.Data.Migrations.IdentityMigrations -{ - [DbContext(typeof(IdentityDbContext))] - [Migration("00000000000000_CreateIdentitySchema")] - partial class CreateIdentitySchema - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "3.0.0-rc1.19455.8") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("nvarchar(max)"); - - b.Property("Email") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("EmailConfirmed") - .HasColumnType("bit"); - - b.Property("LockoutEnabled") - .HasColumnType("bit"); - - b.Property("LockoutEnd") - .HasColumnType("datetimeoffset"); - - b.Property("NormalizedEmail") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("NormalizedUserName") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("PasswordHash") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumber") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("bit"); - - b.Property("SecurityStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("TwoFactorEnabled") - .HasColumnType("bit"); - - b.Property("UserName") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasName("UserNameIndex") - .HasFilter("[NormalizedUserName] IS NOT NULL"); - - b.ToTable("AspNetUsers"); - }); - - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.DeviceFlowCodes", b => - { - b.Property("UserCode") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("ClientId") - .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("CreationTime") - .HasColumnType("datetime2"); - - b.Property("Data") - .IsRequired() - .HasColumnType("nvarchar(max)") - .HasMaxLength(50000); - - b.Property("DeviceCode") - .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("Expiration") - .IsRequired() - .HasColumnType("datetime2"); - - b.Property("SubjectId") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.HasKey("UserCode"); - - b.HasIndex("DeviceCode") - .IsUnique(); - - b.HasIndex("Expiration"); - - b.ToTable("DeviceCodes"); - }); - - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b => - { - b.Property("Key") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("ClientId") - .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("CreationTime") - .HasColumnType("datetime2"); - - b.Property("Data") - .IsRequired() - .HasColumnType("nvarchar(max)") - .HasMaxLength(50000); - - b.Property("Expiration") - .HasColumnType("datetime2"); - - b.Property("SubjectId") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("Type") - .IsRequired() - .HasColumnType("nvarchar(50)") - .HasMaxLength(50); - - b.HasKey("Key"); - - b.HasIndex("Expiration"); - - b.HasIndex("SubjectId", "ClientId", "Type"); - - b.ToTable("PersistedGrants"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("NormalizedName") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasName("RoleNameIndex") - .HasFilter("[NormalizedName] IS NOT NULL"); - - b.ToTable("AspNetRoles"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("ProviderKey") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("ProviderDisplayName") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("nvarchar(450)"); - - b.Property("RoleId") - .HasColumnType("nvarchar(450)"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("nvarchar(450)"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("Name") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("Value") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Atles.Data/Migrations/IdentityMigrations/20210106103055_UpdateIdentityServer.cs b/src/Atles.Data/Migrations/IdentityMigrations/20210106103055_UpdateIdentityServer.cs deleted file mode 100644 index 97090c82..00000000 --- a/src/Atles.Data/Migrations/IdentityMigrations/20210106103055_UpdateIdentityServer.cs +++ /dev/null @@ -1,77 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -namespace Atles.Data.Migrations.IdentityMigrations -{ - public partial class UpdateIdentityServer : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "ConsumedTime", - table: "PersistedGrants", - type: "datetime2", - nullable: true); - - migrationBuilder.AddColumn( - name: "Description", - table: "PersistedGrants", - type: "nvarchar(200)", - maxLength: 200, - nullable: true); - - migrationBuilder.AddColumn( - name: "SessionId", - table: "PersistedGrants", - type: "nvarchar(100)", - maxLength: 100, - nullable: true); - - migrationBuilder.AddColumn( - name: "Description", - table: "DeviceCodes", - type: "nvarchar(200)", - maxLength: 200, - nullable: true); - - migrationBuilder.AddColumn( - name: "SessionId", - table: "DeviceCodes", - type: "nvarchar(100)", - maxLength: 100, - nullable: true); - - migrationBuilder.CreateIndex( - name: "IX_PersistedGrants_SubjectId_SessionId_Type", - table: "PersistedGrants", - columns: new[] { "SubjectId", "SessionId", "Type" }); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropIndex( - name: "IX_PersistedGrants_SubjectId_SessionId_Type", - table: "PersistedGrants"); - - migrationBuilder.DropColumn( - name: "ConsumedTime", - table: "PersistedGrants"); - - migrationBuilder.DropColumn( - name: "Description", - table: "PersistedGrants"); - - migrationBuilder.DropColumn( - name: "SessionId", - table: "PersistedGrants"); - - migrationBuilder.DropColumn( - name: "Description", - table: "DeviceCodes"); - - migrationBuilder.DropColumn( - name: "SessionId", - table: "DeviceCodes"); - } - } -} diff --git a/src/Atles.Data/Migrations/IdentityMigrations/20210106103055_UpdateIdentityServer.Designer.cs b/src/Atles.Data/Migrations/IdentityMigrations/20220126100216_InitialCreate.Designer.cs similarity index 82% rename from src/Atles.Data/Migrations/IdentityMigrations/20210106103055_UpdateIdentityServer.Designer.cs rename to src/Atles.Data/Migrations/IdentityMigrations/20220126100216_InitialCreate.Designer.cs index 6e2fa96b..ce96aa16 100644 --- a/src/Atles.Data/Migrations/IdentityMigrations/20210106103055_UpdateIdentityServer.Designer.cs +++ b/src/Atles.Data/Migrations/IdentityMigrations/20220126100216_InitialCreate.Designer.cs @@ -1,25 +1,30 @@ // - using System; +using Atles.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable namespace Atles.Data.Migrations.IdentityMigrations { [DbContext(typeof(IdentityDbContext))] - [Migration("20210106103055_UpdateIdentityServer")] - partial class UpdateIdentityServer + [Migration("20220126100216_InitialCreate")] + partial class InitialCreate { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .UseIdentityColumns() - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("ProductVersion", "5.0.1"); + .HasAnnotation("ProductVersion", "6.0.1") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.DeviceFlowCodes", b => + modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", b => { b.Property("UserCode") .HasMaxLength(200) @@ -66,10 +71,46 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("Expiration"); - b.ToTable("DeviceCodes"); + b.ToTable("DeviceCodes", (string)null); }); - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b => + modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.Key", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("Algorithm") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("Data") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("DataProtected") + .HasColumnType("bit"); + + b.Property("IsX509Certificate") + .HasColumnType("bit"); + + b.Property("Use") + .HasColumnType("nvarchar(450)"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("Use"); + + b.ToTable("Keys"); + }); + + modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", b => { b.Property("Key") .HasMaxLength(200) @@ -113,13 +154,15 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Key"); + b.HasIndex("ConsumedTime"); + b.HasIndex("Expiration"); b.HasIndex("SubjectId", "ClientId", "Type"); b.HasIndex("SubjectId", "SessionId", "Type"); - b.ToTable("PersistedGrants"); + b.ToTable("PersistedGrants", (string)null); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => @@ -146,15 +189,16 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasDatabaseName("RoleNameIndex") .HasFilter("[NormalizedName] IS NOT NULL"); - b.ToTable("AspNetRoles"); + b.ToTable("AspNetRoles", (string)null); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("int") - .UseIdentityColumn(); + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); b.Property("ClaimType") .HasColumnType("nvarchar(max)"); @@ -170,7 +214,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("RoleId"); - b.ToTable("AspNetRoleClaims"); + b.ToTable("AspNetRoleClaims", (string)null); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => @@ -235,15 +279,16 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasDatabaseName("UserNameIndex") .HasFilter("[NormalizedUserName] IS NOT NULL"); - b.ToTable("AspNetUsers"); + b.ToTable("AspNetUsers", (string)null); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("int") - .UseIdentityColumn(); + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); b.Property("ClaimType") .HasColumnType("nvarchar(max)"); @@ -259,7 +304,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("UserId"); - b.ToTable("AspNetUserClaims"); + b.ToTable("AspNetUserClaims", (string)null); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => @@ -283,7 +328,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("UserId"); - b.ToTable("AspNetUserLogins"); + b.ToTable("AspNetUserLogins", (string)null); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => @@ -298,7 +343,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("RoleId"); - b.ToTable("AspNetUserRoles"); + b.ToTable("AspNetUserRoles", (string)null); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => @@ -319,7 +364,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("UserId", "LoginProvider", "Name"); - b.ToTable("AspNetUserTokens"); + b.ToTable("AspNetUserTokens", (string)null); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => diff --git a/src/Atles.Data/Migrations/IdentityMigrations/00000000000000_CreateIdentitySchema.cs b/src/Atles.Data/Migrations/IdentityMigrations/20220126100216_InitialCreate.cs similarity index 52% rename from src/Atles.Data/Migrations/IdentityMigrations/00000000000000_CreateIdentitySchema.cs rename to src/Atles.Data/Migrations/IdentityMigrations/20220126100216_InitialCreate.cs index 2e304d7a..cc6ab267 100644 --- a/src/Atles.Data/Migrations/IdentityMigrations/00000000000000_CreateIdentitySchema.cs +++ b/src/Atles.Data/Migrations/IdentityMigrations/20220126100216_InitialCreate.cs @@ -1,9 +1,11 @@ using System; using Microsoft.EntityFrameworkCore.Migrations; +#nullable disable + namespace Atles.Data.Migrations.IdentityMigrations { - public partial class CreateIdentitySchema : Migration + public partial class InitialCreate : Migration { protected override void Up(MigrationBuilder migrationBuilder) { @@ -11,10 +13,10 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "AspNetRoles", columns: table => new { - Id = table.Column(nullable: false), - Name = table.Column(maxLength: 256, nullable: true), - NormalizedName = table.Column(maxLength: 256, nullable: true), - ConcurrencyStamp = table.Column(nullable: true) + Id = table.Column(type: "nvarchar(450)", nullable: false), + Name = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + NormalizedName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(max)", nullable: true) }, constraints: table => { @@ -25,21 +27,21 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "AspNetUsers", columns: table => new { - Id = table.Column(nullable: false), - UserName = table.Column(maxLength: 256, nullable: true), - NormalizedUserName = table.Column(maxLength: 256, nullable: true), - Email = table.Column(maxLength: 256, nullable: true), - NormalizedEmail = table.Column(maxLength: 256, nullable: true), - EmailConfirmed = table.Column(nullable: false), - PasswordHash = table.Column(nullable: true), - SecurityStamp = table.Column(nullable: true), - ConcurrencyStamp = table.Column(nullable: true), - PhoneNumber = table.Column(nullable: true), - PhoneNumberConfirmed = table.Column(nullable: false), - TwoFactorEnabled = table.Column(nullable: false), - LockoutEnd = table.Column(nullable: true), - LockoutEnabled = table.Column(nullable: false), - AccessFailedCount = table.Column(nullable: false) + Id = table.Column(type: "nvarchar(450)", nullable: false), + UserName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + NormalizedUserName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + Email = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + NormalizedEmail = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + EmailConfirmed = table.Column(type: "bit", nullable: false), + PasswordHash = table.Column(type: "nvarchar(max)", nullable: true), + SecurityStamp = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(max)", nullable: true), + PhoneNumber = table.Column(type: "nvarchar(max)", nullable: true), + PhoneNumberConfirmed = table.Column(type: "bit", nullable: false), + TwoFactorEnabled = table.Column(type: "bit", nullable: false), + LockoutEnd = table.Column(type: "datetimeoffset", nullable: true), + LockoutEnabled = table.Column(type: "bit", nullable: false), + AccessFailedCount = table.Column(type: "int", nullable: false) }, constraints: table => { @@ -50,30 +52,53 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "DeviceCodes", columns: table => new { - UserCode = table.Column(maxLength: 200, nullable: false), - DeviceCode = table.Column(maxLength: 200, nullable: false), - SubjectId = table.Column(maxLength: 200, nullable: true), - ClientId = table.Column(maxLength: 200, nullable: false), - CreationTime = table.Column(nullable: false), - Expiration = table.Column(nullable: false), - Data = table.Column(maxLength: 50000, nullable: false) + UserCode = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + DeviceCode = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + SubjectId = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), + SessionId = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + ClientId = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + Description = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + Expiration = table.Column(type: "datetime2", nullable: false), + Data = table.Column(type: "nvarchar(max)", maxLength: 50000, nullable: false) }, constraints: table => { table.PrimaryKey("PK_DeviceCodes", x => x.UserCode); }); + migrationBuilder.CreateTable( + name: "Keys", + columns: table => new + { + Id = table.Column(type: "nvarchar(450)", nullable: false), + Version = table.Column(type: "int", nullable: false), + Created = table.Column(type: "datetime2", nullable: false), + Use = table.Column(type: "nvarchar(450)", nullable: true), + Algorithm = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + IsX509Certificate = table.Column(type: "bit", nullable: false), + DataProtected = table.Column(type: "bit", nullable: false), + Data = table.Column(type: "nvarchar(max)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Keys", x => x.Id); + }); + migrationBuilder.CreateTable( name: "PersistedGrants", columns: table => new { - Key = table.Column(maxLength: 200, nullable: false), - Type = table.Column(maxLength: 50, nullable: false), - SubjectId = table.Column(maxLength: 200, nullable: true), - ClientId = table.Column(maxLength: 200, nullable: false), - CreationTime = table.Column(nullable: false), - Expiration = table.Column(nullable: true), - Data = table.Column(maxLength: 50000, nullable: false) + Key = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + Type = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + SubjectId = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), + SessionId = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + ClientId = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + Description = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + Expiration = table.Column(type: "datetime2", nullable: true), + ConsumedTime = table.Column(type: "datetime2", nullable: true), + Data = table.Column(type: "nvarchar(max)", maxLength: 50000, nullable: false) }, constraints: table => { @@ -84,11 +109,11 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "AspNetRoleClaims", columns: table => new { - Id = table.Column(nullable: false) + Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), - RoleId = table.Column(nullable: false), - ClaimType = table.Column(nullable: true), - ClaimValue = table.Column(nullable: true) + RoleId = table.Column(type: "nvarchar(450)", nullable: false), + ClaimType = table.Column(type: "nvarchar(max)", nullable: true), + ClaimValue = table.Column(type: "nvarchar(max)", nullable: true) }, constraints: table => { @@ -105,11 +130,11 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "AspNetUserClaims", columns: table => new { - Id = table.Column(nullable: false) + Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), - UserId = table.Column(nullable: false), - ClaimType = table.Column(nullable: true), - ClaimValue = table.Column(nullable: true) + UserId = table.Column(type: "nvarchar(450)", nullable: false), + ClaimType = table.Column(type: "nvarchar(max)", nullable: true), + ClaimValue = table.Column(type: "nvarchar(max)", nullable: true) }, constraints: table => { @@ -126,10 +151,10 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "AspNetUserLogins", columns: table => new { - LoginProvider = table.Column(maxLength: 128, nullable: false), - ProviderKey = table.Column(maxLength: 128, nullable: false), - ProviderDisplayName = table.Column(nullable: true), - UserId = table.Column(nullable: false) + LoginProvider = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + ProviderKey = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + ProviderDisplayName = table.Column(type: "nvarchar(max)", nullable: true), + UserId = table.Column(type: "nvarchar(450)", nullable: false) }, constraints: table => { @@ -146,8 +171,8 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "AspNetUserRoles", columns: table => new { - UserId = table.Column(nullable: false), - RoleId = table.Column(nullable: false) + UserId = table.Column(type: "nvarchar(450)", nullable: false), + RoleId = table.Column(type: "nvarchar(450)", nullable: false) }, constraints: table => { @@ -170,10 +195,10 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "AspNetUserTokens", columns: table => new { - UserId = table.Column(nullable: false), - LoginProvider = table.Column(maxLength: 128, nullable: false), - Name = table.Column(maxLength: 128, nullable: false), - Value = table.Column(nullable: true) + UserId = table.Column(type: "nvarchar(450)", nullable: false), + LoginProvider = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + Value = table.Column(type: "nvarchar(max)", nullable: true) }, constraints: table => { @@ -236,6 +261,16 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "DeviceCodes", column: "Expiration"); + migrationBuilder.CreateIndex( + name: "IX_Keys_Use", + table: "Keys", + column: "Use"); + + migrationBuilder.CreateIndex( + name: "IX_PersistedGrants_ConsumedTime", + table: "PersistedGrants", + column: "ConsumedTime"); + migrationBuilder.CreateIndex( name: "IX_PersistedGrants_Expiration", table: "PersistedGrants", @@ -245,6 +280,11 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "IX_PersistedGrants_SubjectId_ClientId_Type", table: "PersistedGrants", columns: new[] { "SubjectId", "ClientId", "Type" }); + + migrationBuilder.CreateIndex( + name: "IX_PersistedGrants_SubjectId_SessionId_Type", + table: "PersistedGrants", + columns: new[] { "SubjectId", "SessionId", "Type" }); } protected override void Down(MigrationBuilder migrationBuilder) @@ -267,6 +307,9 @@ protected override void Down(MigrationBuilder migrationBuilder) migrationBuilder.DropTable( name: "DeviceCodes"); + migrationBuilder.DropTable( + name: "Keys"); + migrationBuilder.DropTable( name: "PersistedGrants"); diff --git a/src/Atles.Data/Migrations/IdentityMigrations/IdentityDbContextModelSnapshot.cs b/src/Atles.Data/Migrations/IdentityMigrations/IdentityDbContextModelSnapshot.cs index d002e9e1..5c035117 100644 --- a/src/Atles.Data/Migrations/IdentityMigrations/IdentityDbContextModelSnapshot.cs +++ b/src/Atles.Data/Migrations/IdentityMigrations/IdentityDbContextModelSnapshot.cs @@ -6,7 +6,9 @@ using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -namespace Atles.Data.Migrations.ApplicationMigrations +#nullable disable + +namespace Atles.Data.Migrations.IdentityMigrations { [DbContext(typeof(IdentityDbContext))] partial class IdentityDbContextModelSnapshot : ModelSnapshot @@ -15,11 +17,12 @@ protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .UseIdentityColumns() - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("ProductVersion", "5.0.1"); + .HasAnnotation("ProductVersion", "6.0.1") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.DeviceFlowCodes", b => + modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", b => { b.Property("UserCode") .HasMaxLength(200) @@ -66,10 +69,46 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("Expiration"); - b.ToTable("DeviceCodes"); + b.ToTable("DeviceCodes", (string)null); + }); + + modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.Key", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("Algorithm") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("Data") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("DataProtected") + .HasColumnType("bit"); + + b.Property("IsX509Certificate") + .HasColumnType("bit"); + + b.Property("Use") + .HasColumnType("nvarchar(450)"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("Use"); + + b.ToTable("Keys"); }); - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b => + modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", b => { b.Property("Key") .HasMaxLength(200) @@ -113,13 +152,15 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasKey("Key"); + b.HasIndex("ConsumedTime"); + b.HasIndex("Expiration"); b.HasIndex("SubjectId", "ClientId", "Type"); b.HasIndex("SubjectId", "SessionId", "Type"); - b.ToTable("PersistedGrants"); + b.ToTable("PersistedGrants", (string)null); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => @@ -146,15 +187,16 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasDatabaseName("RoleNameIndex") .HasFilter("[NormalizedName] IS NOT NULL"); - b.ToTable("AspNetRoles"); + b.ToTable("AspNetRoles", (string)null); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("int") - .UseIdentityColumn(); + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); b.Property("ClaimType") .HasColumnType("nvarchar(max)"); @@ -170,7 +212,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("RoleId"); - b.ToTable("AspNetRoleClaims"); + b.ToTable("AspNetRoleClaims", (string)null); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => @@ -235,15 +277,16 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasDatabaseName("UserNameIndex") .HasFilter("[NormalizedUserName] IS NOT NULL"); - b.ToTable("AspNetUsers"); + b.ToTable("AspNetUsers", (string)null); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("int") - .UseIdentityColumn(); + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); b.Property("ClaimType") .HasColumnType("nvarchar(max)"); @@ -259,7 +302,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("UserId"); - b.ToTable("AspNetUserClaims"); + b.ToTable("AspNetUserClaims", (string)null); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => @@ -283,7 +326,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("UserId"); - b.ToTable("AspNetUserLogins"); + b.ToTable("AspNetUserLogins", (string)null); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => @@ -298,7 +341,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("RoleId"); - b.ToTable("AspNetUserRoles"); + b.ToTable("AspNetUserRoles", (string)null); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => @@ -319,7 +362,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasKey("UserId", "LoginProvider", "Name"); - b.ToTable("AspNetUserTokens"); + b.ToTable("AspNetUserTokens", (string)null); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => diff --git a/src/Atles.Domain.Handlers/Atles.Domain.Handlers.csproj b/src/Atles.Domain.Handlers/Atles.Domain.Handlers.csproj index 4a6bc0fe..8e99c90a 100644 --- a/src/Atles.Domain.Handlers/Atles.Domain.Handlers.csproj +++ b/src/Atles.Domain.Handlers/Atles.Domain.Handlers.csproj @@ -1,7 +1,7 @@  - net5.0 + net6.0 diff --git a/src/Atles.Domain.Models/Atles.Domain.Models.csproj b/src/Atles.Domain.Models/Atles.Domain.Models.csproj index df6ca108..725ce63d 100644 --- a/src/Atles.Domain.Models/Atles.Domain.Models.csproj +++ b/src/Atles.Domain.Models/Atles.Domain.Models.csproj @@ -1,7 +1,7 @@  - net5.0 + net6.0 true @@ -13,7 +13,7 @@ - + diff --git a/src/Atles.Infrastructure/Atles.Infrastructure.csproj b/src/Atles.Infrastructure/Atles.Infrastructure.csproj index 1719a465..399831f3 100644 --- a/src/Atles.Infrastructure/Atles.Infrastructure.csproj +++ b/src/Atles.Infrastructure/Atles.Infrastructure.csproj @@ -1,11 +1,11 @@ - net5.0 + net6.0 - + diff --git a/src/Atles.Reporting.Handlers/Atles.Reporting.Handlers.csproj b/src/Atles.Reporting.Handlers/Atles.Reporting.Handlers.csproj index 4aeb9f34..888e6f72 100644 --- a/src/Atles.Reporting.Handlers/Atles.Reporting.Handlers.csproj +++ b/src/Atles.Reporting.Handlers/Atles.Reporting.Handlers.csproj @@ -1,7 +1,7 @@ - net5.0 + net6.0 diff --git a/src/Atles.Reporting.Models/Atles.Reporting.Models.csproj b/src/Atles.Reporting.Models/Atles.Reporting.Models.csproj index 9312c973..05bc2d16 100644 --- a/src/Atles.Reporting.Models/Atles.Reporting.Models.csproj +++ b/src/Atles.Reporting.Models/Atles.Reporting.Models.csproj @@ -1,15 +1,15 @@  - net5.0 + net6.0 true - - - + + + diff --git a/src/Atles.Server/Atles.Server.csproj b/src/Atles.Server/Atles.Server.csproj index afb1762b..e0211f00 100644 --- a/src/Atles.Server/Atles.Server.csproj +++ b/src/Atles.Server/Atles.Server.csproj @@ -1,7 +1,7 @@  - net5.0 + net6.0 Atles.Server-35EFD1FC-2839-4B16-9DA2-F7DC412158E9 OutOfProcess AspNetCoreModule @@ -19,8 +19,8 @@ - - + + @@ -35,12 +35,12 @@ - - - - - - + + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/test/Atles.Domain.Handlers.Tests/Atles.Domain.Handlers.Tests.csproj b/test/Atles.Domain.Handlers.Tests/Atles.Domain.Handlers.Tests.csproj index 8733fde1..ea7bfebe 100644 --- a/test/Atles.Domain.Handlers.Tests/Atles.Domain.Handlers.Tests.csproj +++ b/test/Atles.Domain.Handlers.Tests/Atles.Domain.Handlers.Tests.csproj @@ -1,13 +1,13 @@ - net5.0 + net6.0 - - + + diff --git a/test/Atles.Domain.Models.Tests/Atles.Domain.Models.Tests.csproj b/test/Atles.Domain.Models.Tests/Atles.Domain.Models.Tests.csproj index 406f736d..55ce3635 100644 --- a/test/Atles.Domain.Models.Tests/Atles.Domain.Models.Tests.csproj +++ b/test/Atles.Domain.Models.Tests/Atles.Domain.Models.Tests.csproj @@ -1,12 +1,12 @@  - net5.0 + net6.0 - + diff --git a/test/Atles.Infrastructure.Tests/Atles.Infrastructure.Tests.csproj b/test/Atles.Infrastructure.Tests/Atles.Infrastructure.Tests.csproj index efa38b13..ff6e4e97 100644 --- a/test/Atles.Infrastructure.Tests/Atles.Infrastructure.Tests.csproj +++ b/test/Atles.Infrastructure.Tests/Atles.Infrastructure.Tests.csproj @@ -1,13 +1,13 @@ - net5.0 + net6.0 enable - +