From 8f0192b4814c68d47f2e6f90db72340e65a78fa8 Mon Sep 17 00:00:00 2001
From: Daniel Almeida
<115644988+daniel-almeida-konkconsulting@users.noreply.github.com>
Date: Thu, 28 Mar 2024 14:33:36 +0000
Subject: [PATCH 1/7] Performance Improvements with Database Indexes (#577)
* feat: add missing database indexes for relationship changes, metric statuses and identities
* feat: add migrations for database indexes for both providers
* chore: disable warning since indexes may include nullable properties
* fix: change migration order due to alter column statement on TierId
* chore: align postgres migration order with sql server order
---------
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
---
...40327091638_AddIdentityIndexes.Designer.cs | 897 +++++++++
.../20240327091638_AddIdentityIndexes.cs | 36 +
.../DevicesDbContextModelSnapshot.cs | 1780 ++++++++--------
...40326162207_AddIdentityIndexes.Designer.cs | 892 ++++++++
.../20240326162207_AddIdentityIndexes.cs | 36 +
.../ApplicationDbContextModelSnapshot.cs | 1792 +++++++++--------
.../IdentityEntityTypeConfiguration.cs | 4 +
...321141543_AddMetricStatusIndex.Designer.cs | 355 ++++
.../20240321141543_AddMetricStatusIndex.cs | 28 +
.../QuotasDbContextModelSnapshot.cs | 9 +-
...321141522_AddMetricStatusIndex.Designer.cs | 355 ++++
.../20240321141522_AddMetricStatusIndex.cs | 28 +
.../QuotasDbContextModelSnapshot.cs | 9 +-
.../MetricStatusEntityTypeConfiguration.cs | 6 +
...259_AddRelationshipChangeIndex.Designer.cs | 385 ++++
...240321141259_AddRelationshipChangeIndex.cs | 28 +
.../RelationshipsDbContextModelSnapshot.cs | 5 +
...151_AddRelationshipChangeIndex.Designer.cs | 385 ++++
...240321141151_AddRelationshipChangeIndex.cs | 28 +
.../ApplicationDbContextModelSnapshot.cs | 5 +
...ipChangeResponseEntityTypeConfiguration.cs | 4 +
21 files changed, 5281 insertions(+), 1786 deletions(-)
create mode 100644 Modules/Devices/src/Devices.Infrastructure.Database.Postgres/Migrations/20240327091638_AddIdentityIndexes.Designer.cs
create mode 100644 Modules/Devices/src/Devices.Infrastructure.Database.Postgres/Migrations/20240327091638_AddIdentityIndexes.cs
create mode 100644 Modules/Devices/src/Devices.Infrastructure.Database.SqlServer/Migrations/20240326162207_AddIdentityIndexes.Designer.cs
create mode 100644 Modules/Devices/src/Devices.Infrastructure.Database.SqlServer/Migrations/20240326162207_AddIdentityIndexes.cs
create mode 100644 Modules/Quotas/src/Quotas.Infrastructure.Database.Postgres/Migrations/20240321141543_AddMetricStatusIndex.Designer.cs
create mode 100644 Modules/Quotas/src/Quotas.Infrastructure.Database.Postgres/Migrations/20240321141543_AddMetricStatusIndex.cs
create mode 100644 Modules/Quotas/src/Quotas.Infrastructure.Database.SqlServer/Migrations/20240321141522_AddMetricStatusIndex.Designer.cs
create mode 100644 Modules/Quotas/src/Quotas.Infrastructure.Database.SqlServer/Migrations/20240321141522_AddMetricStatusIndex.cs
create mode 100644 Modules/Relationships/src/Relationships.Infrastructure.Database.Postgres/Migrations/20240321141259_AddRelationshipChangeIndex.Designer.cs
create mode 100644 Modules/Relationships/src/Relationships.Infrastructure.Database.Postgres/Migrations/20240321141259_AddRelationshipChangeIndex.cs
create mode 100644 Modules/Relationships/src/Relationships.Infrastructure.Database.SqlServer/Migrations/20240321141151_AddRelationshipChangeIndex.Designer.cs
create mode 100644 Modules/Relationships/src/Relationships.Infrastructure.Database.SqlServer/Migrations/20240321141151_AddRelationshipChangeIndex.cs
diff --git a/Modules/Devices/src/Devices.Infrastructure.Database.Postgres/Migrations/20240327091638_AddIdentityIndexes.Designer.cs b/Modules/Devices/src/Devices.Infrastructure.Database.Postgres/Migrations/20240327091638_AddIdentityIndexes.Designer.cs
new file mode 100644
index 0000000000..edcec133ef
--- /dev/null
+++ b/Modules/Devices/src/Devices.Infrastructure.Database.Postgres/Migrations/20240327091638_AddIdentityIndexes.Designer.cs
@@ -0,0 +1,897 @@
+//
+using System;
+using Backbone.Modules.Devices.Infrastructure.Persistence.Database;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+
+#nullable disable
+
+namespace Backbone.Modules.Devices.Infrastructure.Database.Postgres.Migrations
+{
+ [DbContext(typeof(DevicesDbContext))]
+ [Migration("20240327091638_AddIdentityIndexes")]
+ partial class AddIdentityIndexes
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "8.0.3")
+ .HasAnnotation("Relational:MaxIdentifierLength", 63);
+
+ NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
+
+ modelBuilder.Entity("Backbone.Modules.Devices.Domain.Aggregates.PushNotifications.PnsRegistration", b =>
+ {
+ b.Property("DeviceId")
+ .HasMaxLength(20)
+ .IsUnicode(false)
+ .HasColumnType("character(20)")
+ .IsFixedLength();
+
+ b.Property("AppId")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("DevicePushIdentifier")
+ .IsRequired()
+ .HasMaxLength(20)
+ .IsUnicode(false)
+ .HasColumnType("character(20)")
+ .IsFixedLength();
+
+ b.Property("Environment")
+ .HasColumnType("integer");
+
+ b.Property("Handle")
+ .IsRequired()
+ .HasMaxLength(200)
+ .IsUnicode(true)
+ .HasColumnType("character varying(200)")
+ .IsFixedLength(false);
+
+ b.Property("IdentityAddress")
+ .IsRequired()
+ .HasMaxLength(36)
+ .IsUnicode(false)
+ .HasColumnType("character(36)")
+ .IsFixedLength();
+
+ b.Property("UpdatedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.HasKey("DeviceId");
+
+ b.ToTable("PnsRegistrations");
+ });
+
+ modelBuilder.Entity("Backbone.Modules.Devices.Domain.Aggregates.Tier.Tier", b =>
+ {
+ b.Property("Id")
+ .HasMaxLength(20)
+ .IsUnicode(false)
+ .HasColumnType("character(20)")
+ .IsFixedLength();
+
+ b.Property("CanBeManuallyAssigned")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("boolean")
+ .HasDefaultValue(true);
+
+ b.Property("CanBeUsedAsDefaultForClient")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("boolean")
+ .HasDefaultValue(true);
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(30)
+ .IsUnicode(true)
+ .HasColumnType("character varying(30)")
+ .IsFixedLength(false);
+
+ b.HasKey("Id");
+
+ b.HasIndex("Name")
+ .IsUnique();
+
+ b.ToTable("Tiers");
+ });
+
+ modelBuilder.Entity("Backbone.Modules.Devices.Domain.Entities.Challenge", b =>
+ {
+ b.Property("Id")
+ .HasMaxLength(20)
+ .IsUnicode(false)
+ .HasColumnType("character(20)")
+ .IsFixedLength();
+
+ b.Property("ExpiresAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.HasKey("Id");
+
+ b.ToTable("Challenges", "Challenges", t =>
+ {
+ t.ExcludeFromMigrations();
+ });
+ });
+
+ modelBuilder.Entity("Backbone.Modules.Devices.Domain.Entities.Identities.ApplicationUser", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("text");
+
+ b.Property("AccessFailedCount")
+ .HasColumnType("integer");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasColumnType("text");
+
+ b.Property("CreatedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("DeviceId")
+ .IsRequired()
+ .HasMaxLength(20)
+ .IsUnicode(false)
+ .HasColumnType("character(20)")
+ .IsFixedLength();
+
+ b.Property("LastLoginAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("LockoutEnabled")
+ .HasColumnType("boolean");
+
+ b.Property("LockoutEnd")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("NormalizedUserName")
+ .HasMaxLength(256)
+ .HasColumnType("character varying(256)");
+
+ b.Property("PasswordHash")
+ .HasColumnType("text");
+
+ b.Property("SecurityStamp")
+ .HasColumnType("text");
+
+ b.Property("UserName")
+ .HasMaxLength(20)
+ .IsUnicode(false)
+ .HasColumnType("character(20)")
+ .IsFixedLength();
+
+ b.HasKey("Id");
+
+ b.HasIndex("DeviceId")
+ .IsUnique();
+
+ b.HasIndex("NormalizedUserName")
+ .IsUnique()
+ .HasDatabaseName("UserNameIndex");
+
+ b.ToTable("AspNetUsers", (string)null);
+ });
+
+ modelBuilder.Entity("Backbone.Modules.Devices.Domain.Entities.Identities.Device", b =>
+ {
+ b.Property("Id")
+ .HasMaxLength(20)
+ .IsUnicode(false)
+ .HasColumnType("character(20)")
+ .IsFixedLength();
+
+ b.Property("CreatedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("CreatedByDevice")
+ .IsRequired()
+ .HasMaxLength(20)
+ .IsUnicode(false)
+ .HasColumnType("character(20)")
+ .IsFixedLength();
+
+ b.Property("DeletedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("DeletedByDevice")
+ .HasMaxLength(20)
+ .IsUnicode(false)
+ .HasColumnType("character(20)")
+ .IsFixedLength();
+
+ b.Property("IdentityAddress")
+ .IsRequired()
+ .HasMaxLength(36)
+ .IsUnicode(false)
+ .HasColumnType("character(36)")
+ .IsFixedLength();
+
+ b.HasKey("Id");
+
+ b.HasIndex("IdentityAddress");
+
+ b.ToTable("Devices");
+ });
+
+ modelBuilder.Entity("Backbone.Modules.Devices.Domain.Entities.Identities.Identity", b =>
+ {
+ b.Property("Address")
+ .HasMaxLength(36)
+ .IsUnicode(false)
+ .HasColumnType("character(36)")
+ .IsFixedLength();
+
+ b.Property("ClientId")
+ .HasMaxLength(200)
+ .HasColumnType("character varying(200)");
+
+ b.Property("CreatedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("DeletionGracePeriodEndsAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("IdentityVersion")
+ .HasColumnType("smallint");
+
+ b.Property("PublicKey")
+ .IsRequired()
+ .HasColumnType("bytea");
+
+ b.Property("Status")
+ .HasColumnType("integer");
+
+ b.Property("TierId")
+ .IsRequired()
+ .HasMaxLength(20)
+ .IsUnicode(false)
+ .HasColumnType("character(20)")
+ .IsFixedLength();
+
+ b.Property("TierIdBeforeDeletion")
+ .HasMaxLength(20)
+ .IsUnicode(false)
+ .HasColumnType("character(20)")
+ .IsFixedLength();
+
+ b.HasKey("Address");
+
+ b.HasIndex("ClientId");
+
+ b.HasIndex("TierId");
+
+ b.ToTable("Identities");
+ });
+
+ modelBuilder.Entity("Backbone.Modules.Devices.Domain.Entities.Identities.IdentityDeletionProcess", b =>
+ {
+ b.Property("Id")
+ .HasMaxLength(20)
+ .IsUnicode(false)
+ .HasColumnType("character(20)")
+ .IsFixedLength();
+
+ b.Property("ApprovalReminder1SentAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("ApprovalReminder2SentAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("ApprovalReminder3SentAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("ApprovedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("ApprovedByDevice")
+ .HasMaxLength(20)
+ .IsUnicode(false)
+ .HasColumnType("character(20)")
+ .IsFixedLength();
+
+ b.Property("CancelledAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("CancelledByDevice")
+ .HasMaxLength(20)
+ .IsUnicode(false)
+ .HasColumnType("character(20)")
+ .IsFixedLength();
+
+ b.Property("CreatedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("GracePeriodEndsAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("GracePeriodReminder1SentAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("GracePeriodReminder2SentAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("GracePeriodReminder3SentAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("IdentityAddress")
+ .HasMaxLength(36)
+ .IsUnicode(false)
+ .HasColumnType("character(36)")
+ .IsFixedLength();
+
+ b.Property("RejectedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("RejectedByDevice")
+ .HasMaxLength(20)
+ .IsUnicode(false)
+ .HasColumnType("character(20)")
+ .IsFixedLength();
+
+ b.Property("Status")
+ .HasColumnType("integer");
+
+ b.HasKey("Id");
+
+ b.HasIndex("IdentityAddress");
+
+ b.ToTable("IdentityDeletionProcesses", (string)null);
+ });
+
+ modelBuilder.Entity("Backbone.Modules.Devices.Domain.Entities.Identities.IdentityDeletionProcessAuditLogEntry", b =>
+ {
+ b.Property("Id")
+ .HasMaxLength(20)
+ .IsUnicode(false)
+ .HasColumnType("character(20)")
+ .IsFixedLength();
+
+ b.Property("CreatedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("DeviceIdHash")
+ .HasColumnType("bytea");
+
+ b.Property("IdentityAddressHash")
+ .IsRequired()
+ .HasColumnType("bytea");
+
+ b.Property("IdentityDeletionProcessId")
+ .HasMaxLength(20)
+ .IsUnicode(false)
+ .HasColumnType("character(20)")
+ .IsFixedLength();
+
+ b.Property("Message")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("NewStatus")
+ .HasColumnType("integer");
+
+ b.Property("OldStatus")
+ .HasColumnType("integer");
+
+ b.HasKey("Id");
+
+ b.HasIndex("IdentityDeletionProcessId");
+
+ b.ToTable("IdentityDeletionProcessAuditLog", (string)null);
+ });
+
+ modelBuilder.Entity("Backbone.Modules.Devices.Infrastructure.OpenIddict.CustomOpenIddictEntityFrameworkCoreApplication", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("text");
+
+ b.Property("ApplicationType")
+ .HasMaxLength(50)
+ .HasColumnType("character varying(50)");
+
+ b.Property("ClientId")
+ .HasMaxLength(100)
+ .HasColumnType("character varying(100)");
+
+ b.Property("ClientSecret")
+ .HasColumnType("text");
+
+ b.Property("ClientType")
+ .HasMaxLength(50)
+ .HasColumnType("character varying(50)");
+
+ b.Property("ConcurrencyToken")
+ .IsConcurrencyToken()
+ .HasMaxLength(50)
+ .HasColumnType("character varying(50)");
+
+ b.Property("ConsentType")
+ .HasMaxLength(50)
+ .HasColumnType("character varying(50)");
+
+ b.Property("CreatedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("DefaultTier")
+ .IsRequired()
+ .HasMaxLength(20)
+ .IsUnicode(false)
+ .HasColumnType("character(20)")
+ .IsFixedLength();
+
+ b.Property("DisplayName")
+ .HasColumnType("text");
+
+ b.Property("DisplayNames")
+ .HasColumnType("text");
+
+ b.Property("JsonWebKeySet")
+ .HasColumnType("text");
+
+ b.Property("MaxIdentities")
+ .HasColumnType("integer");
+
+ b.Property("Permissions")
+ .HasColumnType("text");
+
+ b.Property("PostLogoutRedirectUris")
+ .HasColumnType("text");
+
+ b.Property("Properties")
+ .HasColumnType("text");
+
+ b.Property("RedirectUris")
+ .HasColumnType("text");
+
+ b.Property("Requirements")
+ .HasColumnType("text");
+
+ b.Property("Settings")
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ClientId")
+ .IsUnique();
+
+ b.HasIndex("DefaultTier");
+
+ b.ToTable("OpenIddictApplications", (string)null);
+ });
+
+ modelBuilder.Entity("Backbone.Modules.Devices.Infrastructure.OpenIddict.CustomOpenIddictEntityFrameworkCoreAuthorization", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("text");
+
+ b.Property("ApplicationId")
+ .HasColumnType("text");
+
+ b.Property("ConcurrencyToken")
+ .IsConcurrencyToken()
+ .HasMaxLength(50)
+ .HasColumnType("character varying(50)");
+
+ b.Property("CreationDate")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Properties")
+ .HasColumnType("text");
+
+ b.Property("Scopes")
+ .HasColumnType("text");
+
+ b.Property("Status")
+ .HasMaxLength(50)
+ .HasColumnType("character varying(50)");
+
+ b.Property("Subject")
+ .HasMaxLength(400)
+ .HasColumnType("character varying(400)");
+
+ b.Property("Type")
+ .HasMaxLength(50)
+ .HasColumnType("character varying(50)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ApplicationId", "Status", "Subject", "Type");
+
+ b.ToTable("OpenIddictAuthorizations", (string)null);
+ });
+
+ modelBuilder.Entity("Backbone.Modules.Devices.Infrastructure.OpenIddict.CustomOpenIddictEntityFrameworkCoreScope", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("text");
+
+ b.Property("ConcurrencyToken")
+ .IsConcurrencyToken()
+ .HasMaxLength(50)
+ .HasColumnType("character varying(50)");
+
+ b.Property("Description")
+ .HasColumnType("text");
+
+ b.Property("Descriptions")
+ .HasColumnType("text");
+
+ b.Property("DisplayName")
+ .HasColumnType("text");
+
+ b.Property("DisplayNames")
+ .HasColumnType("text");
+
+ b.Property("Name")
+ .HasMaxLength(200)
+ .HasColumnType("character varying(200)");
+
+ b.Property("Properties")
+ .HasColumnType("text");
+
+ b.Property("Resources")
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.HasIndex("Name")
+ .IsUnique();
+
+ b.ToTable("OpenIddictScopes", (string)null);
+ });
+
+ modelBuilder.Entity("Backbone.Modules.Devices.Infrastructure.OpenIddict.CustomOpenIddictEntityFrameworkCoreToken", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("text");
+
+ b.Property("ApplicationId")
+ .HasColumnType("text");
+
+ b.Property("AuthorizationId")
+ .HasColumnType("text");
+
+ b.Property("ConcurrencyToken")
+ .IsConcurrencyToken()
+ .HasMaxLength(50)
+ .HasColumnType("character varying(50)");
+
+ b.Property("CreationDate")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("ExpirationDate")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Payload")
+ .HasColumnType("text");
+
+ b.Property("Properties")
+ .HasColumnType("text");
+
+ b.Property("RedemptionDate")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("ReferenceId")
+ .HasMaxLength(100)
+ .HasColumnType("character varying(100)");
+
+ b.Property("Status")
+ .HasMaxLength(50)
+ .HasColumnType("character varying(50)");
+
+ b.Property("Subject")
+ .HasMaxLength(400)
+ .HasColumnType("character varying(400)");
+
+ b.Property("Type")
+ .HasMaxLength(50)
+ .HasColumnType("character varying(50)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AuthorizationId");
+
+ b.HasIndex("ReferenceId")
+ .IsUnique();
+
+ b.HasIndex("ApplicationId", "Status", "Subject", "Type");
+
+ b.ToTable("OpenIddictTokens", (string)null);
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("text");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasColumnType("text");
+
+ b.Property("Name")
+ .HasMaxLength(256)
+ .HasColumnType("character varying(256)");
+
+ b.Property("NormalizedName")
+ .HasMaxLength(256)
+ .HasColumnType("character varying(256)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedName")
+ .IsUnique()
+ .HasDatabaseName("RoleNameIndex");
+
+ b.ToTable("AspNetRoles", (string)null);
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("ClaimType")
+ .HasColumnType("text");
+
+ b.Property("ClaimValue")
+ .HasColumnType("text");
+
+ b.Property("RoleId")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("AspNetRoleClaims", (string)null);
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("ClaimType")
+ .HasColumnType("text");
+
+ b.Property("ClaimValue")
+ .HasColumnType("text");
+
+ b.Property("UserId")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("AspNetUserClaims", (string)null);
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b =>
+ {
+ b.Property("LoginProvider")
+ .HasColumnType("text");
+
+ b.Property("ProviderKey")
+ .HasColumnType("text");
+
+ b.Property("ProviderDisplayName")
+ .HasColumnType("text");
+
+ b.Property("UserId")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.HasKey("LoginProvider", "ProviderKey");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("AspNetUserLogins", (string)null);
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b =>
+ {
+ b.Property("UserId")
+ .HasColumnType("text");
+
+ b.Property("RoleId")
+ .HasColumnType("text");
+
+ b.HasKey("UserId", "RoleId");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("AspNetUserRoles", (string)null);
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b =>
+ {
+ b.Property("UserId")
+ .HasColumnType("text");
+
+ b.Property("LoginProvider")
+ .HasColumnType("text");
+
+ b.Property("Name")
+ .HasColumnType("text");
+
+ b.Property("Value")
+ .HasColumnType("text");
+
+ b.HasKey("UserId", "LoginProvider", "Name");
+
+ b.ToTable("AspNetUserTokens", (string)null);
+ });
+
+ modelBuilder.Entity("Backbone.Modules.Devices.Domain.Entities.Identities.ApplicationUser", b =>
+ {
+ b.HasOne("Backbone.Modules.Devices.Domain.Entities.Identities.Device", "Device")
+ .WithOne("User")
+ .HasForeignKey("Backbone.Modules.Devices.Domain.Entities.Identities.ApplicationUser", "DeviceId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Device");
+ });
+
+ modelBuilder.Entity("Backbone.Modules.Devices.Domain.Entities.Identities.Device", b =>
+ {
+ b.HasOne("Backbone.Modules.Devices.Domain.Entities.Identities.Identity", "Identity")
+ .WithMany("Devices")
+ .HasForeignKey("IdentityAddress")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Identity");
+ });
+
+ modelBuilder.Entity("Backbone.Modules.Devices.Domain.Entities.Identities.IdentityDeletionProcess", b =>
+ {
+ b.HasOne("Backbone.Modules.Devices.Domain.Entities.Identities.Identity", null)
+ .WithMany("DeletionProcesses")
+ .HasForeignKey("IdentityAddress");
+ });
+
+ modelBuilder.Entity("Backbone.Modules.Devices.Domain.Entities.Identities.IdentityDeletionProcessAuditLogEntry", b =>
+ {
+ b.HasOne("Backbone.Modules.Devices.Domain.Entities.Identities.IdentityDeletionProcess", null)
+ .WithMany("AuditLog")
+ .HasForeignKey("IdentityDeletionProcessId");
+ });
+
+ modelBuilder.Entity("Backbone.Modules.Devices.Infrastructure.OpenIddict.CustomOpenIddictEntityFrameworkCoreApplication", b =>
+ {
+ b.HasOne("Backbone.Modules.Devices.Domain.Aggregates.Tier.Tier", null)
+ .WithMany()
+ .HasForeignKey("DefaultTier")
+ .OnDelete(DeleteBehavior.Restrict)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Backbone.Modules.Devices.Infrastructure.OpenIddict.CustomOpenIddictEntityFrameworkCoreAuthorization", b =>
+ {
+ b.HasOne("Backbone.Modules.Devices.Infrastructure.OpenIddict.CustomOpenIddictEntityFrameworkCoreApplication", "Application")
+ .WithMany("Authorizations")
+ .HasForeignKey("ApplicationId");
+
+ b.Navigation("Application");
+ });
+
+ modelBuilder.Entity("Backbone.Modules.Devices.Infrastructure.OpenIddict.CustomOpenIddictEntityFrameworkCoreToken", b =>
+ {
+ b.HasOne("Backbone.Modules.Devices.Infrastructure.OpenIddict.CustomOpenIddictEntityFrameworkCoreApplication", "Application")
+ .WithMany("Tokens")
+ .HasForeignKey("ApplicationId");
+
+ b.HasOne("Backbone.Modules.Devices.Infrastructure.OpenIddict.CustomOpenIddictEntityFrameworkCoreAuthorization", "Authorization")
+ .WithMany("Tokens")
+ .HasForeignKey("AuthorizationId");
+
+ b.Navigation("Application");
+
+ b.Navigation("Authorization");
+ });
+
+ 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("Backbone.Modules.Devices.Domain.Entities.Identities.ApplicationUser", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b =>
+ {
+ b.HasOne("Backbone.Modules.Devices.Domain.Entities.Identities.ApplicationUser", 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("Backbone.Modules.Devices.Domain.Entities.Identities.ApplicationUser", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b =>
+ {
+ b.HasOne("Backbone.Modules.Devices.Domain.Entities.Identities.ApplicationUser", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Backbone.Modules.Devices.Domain.Entities.Identities.Device", b =>
+ {
+ b.Navigation("User")
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Backbone.Modules.Devices.Domain.Entities.Identities.Identity", b =>
+ {
+ b.Navigation("DeletionProcesses");
+
+ b.Navigation("Devices");
+ });
+
+ modelBuilder.Entity("Backbone.Modules.Devices.Domain.Entities.Identities.IdentityDeletionProcess", b =>
+ {
+ b.Navigation("AuditLog");
+ });
+
+ modelBuilder.Entity("Backbone.Modules.Devices.Infrastructure.OpenIddict.CustomOpenIddictEntityFrameworkCoreApplication", b =>
+ {
+ b.Navigation("Authorizations");
+
+ b.Navigation("Tokens");
+ });
+
+ modelBuilder.Entity("Backbone.Modules.Devices.Infrastructure.OpenIddict.CustomOpenIddictEntityFrameworkCoreAuthorization", b =>
+ {
+ b.Navigation("Tokens");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/Modules/Devices/src/Devices.Infrastructure.Database.Postgres/Migrations/20240327091638_AddIdentityIndexes.cs b/Modules/Devices/src/Devices.Infrastructure.Database.Postgres/Migrations/20240327091638_AddIdentityIndexes.cs
new file mode 100644
index 0000000000..13cdf76ccb
--- /dev/null
+++ b/Modules/Devices/src/Devices.Infrastructure.Database.Postgres/Migrations/20240327091638_AddIdentityIndexes.cs
@@ -0,0 +1,36 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace Backbone.Modules.Devices.Infrastructure.Database.Postgres.Migrations
+{
+ ///
+ public partial class AddIdentityIndexes : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateIndex(
+ name: "IX_Identities_ClientId",
+ table: "Identities",
+ column: "ClientId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Identities_TierId",
+ table: "Identities",
+ column: "TierId");
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropIndex(
+ name: "IX_Identities_ClientId",
+ table: "Identities");
+
+ migrationBuilder.DropIndex(
+ name: "IX_Identities_TierId",
+ table: "Identities");
+ }
+ }
+}
diff --git a/Modules/Devices/src/Devices.Infrastructure.Database.Postgres/Migrations/DevicesDbContextModelSnapshot.cs b/Modules/Devices/src/Devices.Infrastructure.Database.Postgres/Migrations/DevicesDbContextModelSnapshot.cs
index 7cfc541b20..01234522a8 100644
--- a/Modules/Devices/src/Devices.Infrastructure.Database.Postgres/Migrations/DevicesDbContextModelSnapshot.cs
+++ b/Modules/Devices/src/Devices.Infrastructure.Database.Postgres/Migrations/DevicesDbContextModelSnapshot.cs
@@ -1,890 +1,894 @@
-//
-using System;
-using Backbone.Modules.Devices.Infrastructure.Persistence.Database;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
-
-#nullable disable
-
-namespace Devices.Infrastructure.Database.Postgres.Migrations
-{
- [DbContext(typeof(DevicesDbContext))]
- partial class DevicesDbContextModelSnapshot : ModelSnapshot
- {
- protected override void BuildModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder
+//
+using System;
+using Backbone.Modules.Devices.Infrastructure.Persistence.Database;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+
+#nullable disable
+
+namespace Devices.Infrastructure.Database.Postgres.Migrations
+{
+ [DbContext(typeof(DevicesDbContext))]
+ partial class DevicesDbContextModelSnapshot : ModelSnapshot
+ {
+ protected override void BuildModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
.HasAnnotation("ProductVersion", "8.0.3")
- .HasAnnotation("Relational:MaxIdentifierLength", 63);
-
- NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
-
- modelBuilder.Entity("Backbone.Modules.Devices.Domain.Aggregates.PushNotifications.PnsRegistration", b =>
- {
- b.Property("DeviceId")
- .HasMaxLength(20)
- .IsUnicode(false)
- .HasColumnType("character(20)")
- .IsFixedLength();
-
- b.Property("AppId")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property("DevicePushIdentifier")
- .IsRequired()
- .HasMaxLength(20)
- .IsUnicode(false)
- .HasColumnType("character(20)")
- .IsFixedLength();
-
- b.Property("Environment")
- .HasColumnType("integer");
-
- b.Property("Handle")
- .IsRequired()
- .HasMaxLength(200)
- .IsUnicode(true)
- .HasColumnType("character varying(200)")
- .IsFixedLength(false);
-
- b.Property("IdentityAddress")
- .IsRequired()
- .HasMaxLength(36)
- .IsUnicode(false)
- .HasColumnType("character(36)")
- .IsFixedLength();
-
- b.Property("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("DeviceId");
-
- b.ToTable("PnsRegistrations");
- });
-
- modelBuilder.Entity("Backbone.Modules.Devices.Domain.Aggregates.Tier.Tier", b =>
- {
- b.Property("Id")
- .HasMaxLength(20)
- .IsUnicode(false)
- .HasColumnType("character(20)")
- .IsFixedLength();
-
- b.Property("CanBeManuallyAssigned")
- .ValueGeneratedOnAdd()
- .HasColumnType("boolean")
- .HasDefaultValue(true);
-
- b.Property("CanBeUsedAsDefaultForClient")
- .ValueGeneratedOnAdd()
- .HasColumnType("boolean")
- .HasDefaultValue(true);
-
- b.Property("Name")
- .IsRequired()
- .HasMaxLength(30)
- .IsUnicode(true)
- .HasColumnType("character varying(30)")
- .IsFixedLength(false);
-
- b.HasKey("Id");
-
- b.HasIndex("Name")
- .IsUnique();
-
- b.ToTable("Tiers");
- });
-
- modelBuilder.Entity("Backbone.Modules.Devices.Domain.Entities.Challenge", b =>
- {
- b.Property("Id")
- .HasMaxLength(20)
- .IsUnicode(false)
- .HasColumnType("character(20)")
- .IsFixedLength();
-
- b.Property("ExpiresAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("Id");
-
- b.ToTable("Challenges", "Challenges", t =>
- {
- t.ExcludeFromMigrations();
- });
- });
-
- modelBuilder.Entity("Backbone.Modules.Devices.Domain.Entities.Identities.ApplicationUser", b =>
- {
- b.Property("Id")
- .HasColumnType("text");
-
- b.Property("AccessFailedCount")
- .HasColumnType("integer");
-
- b.Property("ConcurrencyStamp")
- .IsConcurrencyToken()
- .HasColumnType("text");
-
- b.Property("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property("DeviceId")
- .IsRequired()
- .HasMaxLength(20)
- .IsUnicode(false)
- .HasColumnType("character(20)")
- .IsFixedLength();
-
- b.Property("LastLoginAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property("LockoutEnabled")
- .HasColumnType("boolean");
-
- b.Property("LockoutEnd")
- .HasColumnType("timestamp with time zone");
-
- b.Property("NormalizedUserName")
- .HasMaxLength(256)
- .HasColumnType("character varying(256)");
-
- b.Property("PasswordHash")
- .HasColumnType("text");
-
- b.Property("SecurityStamp")
- .HasColumnType("text");
-
- b.Property("UserName")
- .HasMaxLength(20)
- .IsUnicode(false)
- .HasColumnType("character(20)")
- .IsFixedLength();
-
- b.HasKey("Id");
-
- b.HasIndex("DeviceId")
- .IsUnique();
-
- b.HasIndex("NormalizedUserName")
- .IsUnique()
- .HasDatabaseName("UserNameIndex");
-
- b.ToTable("AspNetUsers", (string)null);
- });
-
- modelBuilder.Entity("Backbone.Modules.Devices.Domain.Entities.Identities.Device", b =>
- {
- b.Property("Id")
- .HasMaxLength(20)
- .IsUnicode(false)
- .HasColumnType("character(20)")
- .IsFixedLength();
-
- b.Property("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property("CreatedByDevice")
- .IsRequired()
- .HasMaxLength(20)
- .IsUnicode(false)
- .HasColumnType("character(20)")
- .IsFixedLength();
-
- b.Property("DeletedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property("DeletedByDevice")
- .HasMaxLength(20)
- .IsUnicode(false)
- .HasColumnType("character(20)")
- .IsFixedLength();
-
- b.Property("IdentityAddress")
- .IsRequired()
- .HasMaxLength(36)
- .IsUnicode(false)
- .HasColumnType("character(36)")
- .IsFixedLength();
-
- b.HasKey("Id");
-
- b.HasIndex("IdentityAddress");
-
- b.ToTable("Devices");
- });
-
- modelBuilder.Entity("Backbone.Modules.Devices.Domain.Entities.Identities.Identity", b =>
- {
- b.Property("Address")
- .HasMaxLength(36)
- .IsUnicode(false)
- .HasColumnType("character(36)")
- .IsFixedLength();
-
- b.Property("ClientId")
- .HasMaxLength(200)
- .HasColumnType("character varying(200)");
-
- b.Property("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property("DeletionGracePeriodEndsAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property("IdentityVersion")
- .HasColumnType("smallint");
-
- b.Property("PublicKey")
- .IsRequired()
- .HasColumnType("bytea");
-
- b.Property("Status")
- .HasColumnType("integer");
-
- b.Property("TierId")
+ .HasAnnotation("Relational:MaxIdentifierLength", 63);
+
+ NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
+
+ modelBuilder.Entity("Backbone.Modules.Devices.Domain.Aggregates.PushNotifications.PnsRegistration", b =>
+ {
+ b.Property("DeviceId")
+ .HasMaxLength(20)
+ .IsUnicode(false)
+ .HasColumnType("character(20)")
+ .IsFixedLength();
+
+ b.Property("AppId")
.IsRequired()
- .HasMaxLength(20)
- .IsUnicode(false)
- .HasColumnType("character(20)")
- .IsFixedLength();
-
- b.Property("TierIdBeforeDeletion")
- .HasMaxLength(20)
- .IsUnicode(false)
- .HasColumnType("character(20)")
- .IsFixedLength();
-
- b.HasKey("Address");
-
- b.ToTable("Identities");
- });
-
- modelBuilder.Entity("Backbone.Modules.Devices.Domain.Entities.Identities.IdentityDeletionProcess", b =>
- {
- b.Property("Id")
- .HasMaxLength(20)
- .IsUnicode(false)
- .HasColumnType("character(20)")
- .IsFixedLength();
-
- b.Property("ApprovalReminder1SentAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property("ApprovalReminder2SentAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property("ApprovalReminder3SentAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property("ApprovedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property("ApprovedByDevice")
- .HasMaxLength(20)
- .IsUnicode(false)
- .HasColumnType("character(20)")
- .IsFixedLength();
-
- b.Property("CancelledAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property("CancelledByDevice")
- .HasMaxLength(20)
- .IsUnicode(false)
- .HasColumnType("character(20)")
- .IsFixedLength();
-
- b.Property("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property("GracePeriodEndsAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property("GracePeriodReminder1SentAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property("GracePeriodReminder2SentAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property("GracePeriodReminder3SentAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property("IdentityAddress")
- .HasMaxLength(36)
- .IsUnicode(false)
- .HasColumnType("character(36)")
- .IsFixedLength();
-
- b.Property("RejectedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property("RejectedByDevice")
- .HasMaxLength(20)
- .IsUnicode(false)
- .HasColumnType("character(20)")
- .IsFixedLength();
-
- b.Property("Status")
- .HasColumnType("integer");
-
- b.HasKey("Id");
-
- b.HasIndex("IdentityAddress");
-
- b.ToTable("IdentityDeletionProcesses", (string)null);
- });
-
- modelBuilder.Entity("Backbone.Modules.Devices.Domain.Entities.Identities.IdentityDeletionProcessAuditLogEntry", b =>
- {
- b.Property("Id")
- .HasMaxLength(20)
- .IsUnicode(false)
- .HasColumnType("character(20)")
- .IsFixedLength();
-
- b.Property("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property("DeviceIdHash")
- .HasColumnType("bytea");
-
- b.Property("IdentityAddressHash")
- .IsRequired()
- .HasColumnType("bytea");
-
- b.Property("IdentityDeletionProcessId")
- .HasMaxLength(20)
- .IsUnicode(false)
- .HasColumnType("character(20)")
- .IsFixedLength();
-
- b.Property("Message")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property("NewStatus")
- .HasColumnType("integer");
-
- b.Property("OldStatus")
- .HasColumnType("integer");
-
- b.HasKey("Id");
-
- b.HasIndex("IdentityDeletionProcessId");
-
- b.ToTable("IdentityDeletionProcessAuditLog", (string)null);
- });
-
- modelBuilder.Entity("Backbone.Modules.Devices.Infrastructure.OpenIddict.CustomOpenIddictEntityFrameworkCoreApplication", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("text");
-
- b.Property("ApplicationType")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property("ClientId")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property("ClientSecret")
- .HasColumnType("text");
-
- b.Property("ClientType")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property("ConcurrencyToken")
- .IsConcurrencyToken()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property("ConsentType")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property("DefaultTier")
- .IsRequired()
- .HasMaxLength(20)
- .IsUnicode(false)
- .HasColumnType("character(20)")
- .IsFixedLength();
-
- b.Property("DisplayName")
- .HasColumnType("text");
-
- b.Property("DisplayNames")
- .HasColumnType("text");
-
- b.Property("JsonWebKeySet")
- .HasColumnType("text");
-
- b.Property("MaxIdentities")
- .HasColumnType("integer");
-
- b.Property("Permissions")
- .HasColumnType("text");
-
- b.Property("PostLogoutRedirectUris")
- .HasColumnType("text");
-
- b.Property("Properties")
- .HasColumnType("text");
-
- b.Property("RedirectUris")
- .HasColumnType("text");
-
- b.Property("Requirements")
- .HasColumnType("text");
-
- b.Property("Settings")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.HasIndex("ClientId")
- .IsUnique();
-
- b.HasIndex("DefaultTier");
-
- b.ToTable("OpenIddictApplications", (string)null);
- });
-
- modelBuilder.Entity("Backbone.Modules.Devices.Infrastructure.OpenIddict.CustomOpenIddictEntityFrameworkCoreAuthorization", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("text");
-
- b.Property("ApplicationId")
- .HasColumnType("text");
-
- b.Property("ConcurrencyToken")
- .IsConcurrencyToken()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property("CreationDate")
- .HasColumnType("timestamp with time zone");
-
- b.Property("Properties")
- .HasColumnType("text");
-
- b.Property("Scopes")
- .HasColumnType("text");
-
- b.Property("Status")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property("Subject")
- .HasMaxLength(400)
- .HasColumnType("character varying(400)");
-
- b.Property("Type")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.HasKey("Id");
-
- b.HasIndex("ApplicationId", "Status", "Subject", "Type");
-
- b.ToTable("OpenIddictAuthorizations", (string)null);
- });
-
- modelBuilder.Entity("Backbone.Modules.Devices.Infrastructure.OpenIddict.CustomOpenIddictEntityFrameworkCoreScope", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("text");
-
- b.Property("ConcurrencyToken")
- .IsConcurrencyToken()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property("Description")
- .HasColumnType("text");
-
- b.Property("Descriptions")
- .HasColumnType("text");
-
- b.Property("DisplayName")
- .HasColumnType("text");
-
- b.Property("DisplayNames")
- .HasColumnType("text");
-
- b.Property("Name")
- .HasMaxLength(200)
- .HasColumnType("character varying(200)");
-
- b.Property("Properties")
- .HasColumnType("text");
-
- b.Property("Resources")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.HasIndex("Name")
- .IsUnique();
-
- b.ToTable("OpenIddictScopes", (string)null);
- });
-
- modelBuilder.Entity("Backbone.Modules.Devices.Infrastructure.OpenIddict.CustomOpenIddictEntityFrameworkCoreToken", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("text");
-
- b.Property