diff --git a/src/Umbraco.Cms.Api.Common/Umbraco.Cms.Api.Common.csproj b/src/Umbraco.Cms.Api.Common/Umbraco.Cms.Api.Common.csproj
index 2057a5d9b5..edf3fd1f98 100644
--- a/src/Umbraco.Cms.Api.Common/Umbraco.Cms.Api.Common.csproj
+++ b/src/Umbraco.Cms.Api.Common/Umbraco.Cms.Api.Common.csproj
@@ -14,6 +14,9 @@
+
+
+
diff --git a/src/Umbraco.Cms.Api.Delivery/DependencyInjection/UmbracoBuilderExtensions.cs b/src/Umbraco.Cms.Api.Delivery/DependencyInjection/UmbracoBuilderExtensions.cs
index 37d84bc273..3c10318b07 100644
--- a/src/Umbraco.Cms.Api.Delivery/DependencyInjection/UmbracoBuilderExtensions.cs
+++ b/src/Umbraco.Cms.Api.Delivery/DependencyInjection/UmbracoBuilderExtensions.cs
@@ -1,7 +1,6 @@
using System.Text.Json;
using System.Text.Json.Serialization;
using Microsoft.Extensions.DependencyInjection;
-using Umbraco.Cms.Api.Common.Configuration;
using Umbraco.Cms.Api.Common.DependencyInjection;
using Umbraco.Cms.Api.Delivery.Accessors;
using Umbraco.Cms.Api.Delivery.Configuration;
@@ -33,6 +32,7 @@ public static class UmbracoBuilderExtensions
builder.Services.ConfigureOptions();
builder.AddUmbracoApiOpenApiUI();
+ builder.AddUmbracoEFCoreDbContext();
builder
.Services
.AddControllers()
@@ -47,3 +47,4 @@ public static class UmbracoBuilderExtensions
return builder;
}
}
+
diff --git a/src/Umbraco.Cms.Persistence.EFCore.SqlServer/EFCoreSqlServerComposer.cs b/src/Umbraco.Cms.Persistence.EFCore.SqlServer/EFCoreSqlServerComposer.cs
new file mode 100644
index 0000000000..a852fe2c45
--- /dev/null
+++ b/src/Umbraco.Cms.Persistence.EFCore.SqlServer/EFCoreSqlServerComposer.cs
@@ -0,0 +1,15 @@
+using Microsoft.Extensions.DependencyInjection;
+using Umbraco.Cms.Core.Composing;
+using Umbraco.Cms.Core.DependencyInjection;
+using Umbraco.Cms.Persistence.EFCore.Migrations;
+
+namespace Umbraco.Cms.Persistence.EFCore.SqlServer;
+
+public class EFCoreSqlServerComposer : IComposer
+{
+ public void Compose(IUmbracoBuilder builder)
+ {
+ builder.Services.AddSingleton();
+ builder.Services.AddSingleton();
+ }
+}
diff --git a/src/Umbraco.Cms.Persistence.EFCore.SqlServer/Migrations/20230622184303_InitialCreate.Designer.cs b/src/Umbraco.Cms.Persistence.EFCore.SqlServer/Migrations/20230622184303_InitialCreate.Designer.cs
new file mode 100644
index 0000000000..602cd3a279
--- /dev/null
+++ b/src/Umbraco.Cms.Persistence.EFCore.SqlServer/Migrations/20230622184303_InitialCreate.Designer.cs
@@ -0,0 +1,266 @@
+//
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace Umbraco.Cms.Persistence.EFCore.SqlServer.Migrations
+{
+ [DbContext(typeof(UmbracoDbContext))]
+ [Migration("20230622184303_InitialCreate")]
+ partial class InitialCreate
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "7.0.7")
+ .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+ SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
+
+ modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreApplication", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("ClientId")
+ .HasMaxLength(100)
+ .HasColumnType("nvarchar(100)");
+
+ b.Property("ClientSecret")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ConcurrencyToken")
+ .IsConcurrencyToken()
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("ConsentType")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("DisplayName")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("DisplayNames")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Permissions")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("PostLogoutRedirectUris")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Properties")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("RedirectUris")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Requirements")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Type")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ClientId")
+ .IsUnique()
+ .HasFilter("[ClientId] IS NOT NULL");
+
+ b.ToTable("umbracoOpenIddictApplications", (string)null);
+ });
+
+ modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreAuthorization", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("ApplicationId")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("ConcurrencyToken")
+ .IsConcurrencyToken()
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("CreationDate")
+ .HasColumnType("datetime2");
+
+ b.Property("Properties")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Scopes")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Status")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("Subject")
+ .HasMaxLength(400)
+ .HasColumnType("nvarchar(400)");
+
+ b.Property("Type")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ApplicationId", "Status", "Subject", "Type");
+
+ b.ToTable("umbracoOpenIddictAuthorizations", (string)null);
+ });
+
+ modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreScope", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("ConcurrencyToken")
+ .IsConcurrencyToken()
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("Description")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Descriptions")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("DisplayName")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("DisplayNames")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Name")
+ .HasMaxLength(200)
+ .HasColumnType("nvarchar(200)");
+
+ b.Property("Properties")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Resources")
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("Name")
+ .IsUnique()
+ .HasFilter("[Name] IS NOT NULL");
+
+ b.ToTable("umbracoOpenIddictScopes", (string)null);
+ });
+
+ modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreToken", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("ApplicationId")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("AuthorizationId")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("ConcurrencyToken")
+ .IsConcurrencyToken()
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("CreationDate")
+ .HasColumnType("datetime2");
+
+ b.Property("ExpirationDate")
+ .HasColumnType("datetime2");
+
+ b.Property("Payload")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Properties")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("RedemptionDate")
+ .HasColumnType("datetime2");
+
+ b.Property("ReferenceId")
+ .HasMaxLength(100)
+ .HasColumnType("nvarchar(100)");
+
+ b.Property("Status")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("Subject")
+ .HasMaxLength(400)
+ .HasColumnType("nvarchar(400)");
+
+ b.Property("Type")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AuthorizationId");
+
+ b.HasIndex("ReferenceId")
+ .IsUnique()
+ .HasFilter("[ReferenceId] IS NOT NULL");
+
+ b.HasIndex("ApplicationId", "Status", "Subject", "Type");
+
+ b.ToTable("umbracoOpenIddictTokens", (string)null);
+ });
+
+ modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreAuthorization", b =>
+ {
+ b.HasOne("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreApplication", "Application")
+ .WithMany("Authorizations")
+ .HasForeignKey("ApplicationId");
+
+ b.Navigation("Application");
+ });
+
+ modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreToken", b =>
+ {
+ b.HasOne("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreApplication", "Application")
+ .WithMany("Tokens")
+ .HasForeignKey("ApplicationId");
+
+ b.HasOne("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreAuthorization", "Authorization")
+ .WithMany("Tokens")
+ .HasForeignKey("AuthorizationId");
+
+ b.Navigation("Application");
+
+ b.Navigation("Authorization");
+ });
+
+ modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreApplication", b =>
+ {
+ b.Navigation("Authorizations");
+
+ b.Navigation("Tokens");
+ });
+
+ modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreAuthorization", b =>
+ {
+ b.Navigation("Tokens");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/src/Umbraco.Cms.Persistence.EFCore.SqlServer/Migrations/20230622184303_InitialCreate.cs b/src/Umbraco.Cms.Persistence.EFCore.SqlServer/Migrations/20230622184303_InitialCreate.cs
new file mode 100644
index 0000000000..9bf5191959
--- /dev/null
+++ b/src/Umbraco.Cms.Persistence.EFCore.SqlServer/Migrations/20230622184303_InitialCreate.cs
@@ -0,0 +1,166 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace Umbraco.Cms.Persistence.EFCore.SqlServer.Migrations
+{
+ ///
+ public partial class InitialCreate : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateTable(
+ name: "umbracoOpenIddictApplications",
+ columns: table => new
+ {
+ Id = table.Column(type: "nvarchar(450)", nullable: false),
+ ClientId = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true),
+ ClientSecret = table.Column(type: "nvarchar(max)", nullable: true),
+ ConcurrencyToken = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true),
+ ConsentType = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true),
+ DisplayName = table.Column(type: "nvarchar(max)", nullable: true),
+ DisplayNames = table.Column(type: "nvarchar(max)", nullable: true),
+ Permissions = table.Column(type: "nvarchar(max)", nullable: true),
+ PostLogoutRedirectUris = table.Column(type: "nvarchar(max)", nullable: true),
+ Properties = table.Column(type: "nvarchar(max)", nullable: true),
+ RedirectUris = table.Column(type: "nvarchar(max)", nullable: true),
+ Requirements = table.Column(type: "nvarchar(max)", nullable: true),
+ Type = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_umbracoOpenIddictApplications", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "umbracoOpenIddictScopes",
+ columns: table => new
+ {
+ Id = table.Column(type: "nvarchar(450)", nullable: false),
+ ConcurrencyToken = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true),
+ Description = table.Column(type: "nvarchar(max)", nullable: true),
+ Descriptions = table.Column(type: "nvarchar(max)", nullable: true),
+ DisplayName = table.Column(type: "nvarchar(max)", nullable: true),
+ DisplayNames = table.Column(type: "nvarchar(max)", nullable: true),
+ Name = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true),
+ Properties = table.Column(type: "nvarchar(max)", nullable: true),
+ Resources = table.Column(type: "nvarchar(max)", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_umbracoOpenIddictScopes", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "umbracoOpenIddictAuthorizations",
+ columns: table => new
+ {
+ Id = table.Column(type: "nvarchar(450)", nullable: false),
+ ApplicationId = table.Column(type: "nvarchar(450)", nullable: true),
+ ConcurrencyToken = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true),
+ CreationDate = table.Column(type: "datetime2", nullable: true),
+ Properties = table.Column(type: "nvarchar(max)", nullable: true),
+ Scopes = table.Column(type: "nvarchar(max)", nullable: true),
+ Status = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true),
+ Subject = table.Column(type: "nvarchar(400)", maxLength: 400, nullable: true),
+ Type = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_umbracoOpenIddictAuthorizations", x => x.Id);
+ table.ForeignKey(
+ name: "FK_umbracoOpenIddictAuthorizations_umbracoOpenIddictApplications_ApplicationId",
+ column: x => x.ApplicationId,
+ principalTable: "umbracoOpenIddictApplications",
+ principalColumn: "Id");
+ });
+
+ migrationBuilder.CreateTable(
+ name: "umbracoOpenIddictTokens",
+ columns: table => new
+ {
+ Id = table.Column(type: "nvarchar(450)", nullable: false),
+ ApplicationId = table.Column(type: "nvarchar(450)", nullable: true),
+ AuthorizationId = table.Column(type: "nvarchar(450)", nullable: true),
+ ConcurrencyToken = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true),
+ CreationDate = table.Column(type: "datetime2", nullable: true),
+ ExpirationDate = table.Column(type: "datetime2", nullable: true),
+ Payload = table.Column(type: "nvarchar(max)", nullable: true),
+ Properties = table.Column(type: "nvarchar(max)", nullable: true),
+ RedemptionDate = table.Column(type: "datetime2", nullable: true),
+ ReferenceId = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true),
+ Status = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true),
+ Subject = table.Column(type: "nvarchar(400)", maxLength: 400, nullable: true),
+ Type = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_umbracoOpenIddictTokens", x => x.Id);
+ table.ForeignKey(
+ name: "FK_umbracoOpenIddictTokens_umbracoOpenIddictApplications_ApplicationId",
+ column: x => x.ApplicationId,
+ principalTable: "umbracoOpenIddictApplications",
+ principalColumn: "Id");
+ table.ForeignKey(
+ name: "FK_umbracoOpenIddictTokens_umbracoOpenIddictAuthorizations_AuthorizationId",
+ column: x => x.AuthorizationId,
+ principalTable: "umbracoOpenIddictAuthorizations",
+ principalColumn: "Id");
+ });
+
+ migrationBuilder.CreateIndex(
+ name: "IX_umbracoOpenIddictApplications_ClientId",
+ table: "umbracoOpenIddictApplications",
+ column: "ClientId",
+ unique: true,
+ filter: "[ClientId] IS NOT NULL");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_umbracoOpenIddictAuthorizations_ApplicationId_Status_Subject_Type",
+ table: "umbracoOpenIddictAuthorizations",
+ columns: new[] { "ApplicationId", "Status", "Subject", "Type" });
+
+ migrationBuilder.CreateIndex(
+ name: "IX_umbracoOpenIddictScopes_Name",
+ table: "umbracoOpenIddictScopes",
+ column: "Name",
+ unique: true,
+ filter: "[Name] IS NOT NULL");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_umbracoOpenIddictTokens_ApplicationId_Status_Subject_Type",
+ table: "umbracoOpenIddictTokens",
+ columns: new[] { "ApplicationId", "Status", "Subject", "Type" });
+
+ migrationBuilder.CreateIndex(
+ name: "IX_umbracoOpenIddictTokens_AuthorizationId",
+ table: "umbracoOpenIddictTokens",
+ column: "AuthorizationId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_umbracoOpenIddictTokens_ReferenceId",
+ table: "umbracoOpenIddictTokens",
+ column: "ReferenceId",
+ unique: true,
+ filter: "[ReferenceId] IS NOT NULL");
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "umbracoOpenIddictScopes");
+
+ migrationBuilder.DropTable(
+ name: "umbracoOpenIddictTokens");
+
+ migrationBuilder.DropTable(
+ name: "umbracoOpenIddictAuthorizations");
+
+ migrationBuilder.DropTable(
+ name: "umbracoOpenIddictApplications");
+ }
+ }
+}
diff --git a/src/Umbraco.Cms.Persistence.EFCore.SqlServer/Migrations/UmbracoOpenIddictDbContextModelSnapshot.cs b/src/Umbraco.Cms.Persistence.EFCore.SqlServer/Migrations/UmbracoOpenIddictDbContextModelSnapshot.cs
new file mode 100644
index 0000000000..fcaa36348f
--- /dev/null
+++ b/src/Umbraco.Cms.Persistence.EFCore.SqlServer/Migrations/UmbracoOpenIddictDbContextModelSnapshot.cs
@@ -0,0 +1,264 @@
+//
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Umbraco.Cms.Persistence.EFCore;
+
+#nullable disable
+
+namespace Umbraco.Cms.Persistence.EFCore.SqlServer.Migrations
+{
+ [DbContext(typeof(UmbracoDbContext))]
+ partial class UmbracoOpenIddictDbContextModelSnapshot : ModelSnapshot
+ {
+ protected override void BuildModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "7.0.7")
+ .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+ SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
+
+ modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreApplication", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("ClientId")
+ .HasMaxLength(100)
+ .HasColumnType("nvarchar(100)");
+
+ b.Property("ClientSecret")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ConcurrencyToken")
+ .IsConcurrencyToken()
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("ConsentType")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("DisplayName")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("DisplayNames")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Permissions")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("PostLogoutRedirectUris")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Properties")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("RedirectUris")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Requirements")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Type")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ClientId")
+ .IsUnique()
+ .HasFilter("[ClientId] IS NOT NULL");
+
+ b.ToTable("umbracoOpenIddictApplications", (string)null);
+ });
+
+ modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreAuthorization", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("ApplicationId")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("ConcurrencyToken")
+ .IsConcurrencyToken()
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("CreationDate")
+ .HasColumnType("datetime2");
+
+ b.Property("Properties")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Scopes")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Status")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("Subject")
+ .HasMaxLength(400)
+ .HasColumnType("nvarchar(400)");
+
+ b.Property("Type")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ApplicationId", "Status", "Subject", "Type");
+
+ b.ToTable("umbracoOpenIddictAuthorizations", (string)null);
+ });
+
+ modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreScope", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("ConcurrencyToken")
+ .IsConcurrencyToken()
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("Description")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Descriptions")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("DisplayName")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("DisplayNames")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Name")
+ .HasMaxLength(200)
+ .HasColumnType("nvarchar(200)");
+
+ b.Property("Properties")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Resources")
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("Name")
+ .IsUnique()
+ .HasFilter("[Name] IS NOT NULL");
+
+ b.ToTable("umbracoOpenIddictScopes", (string)null);
+ });
+
+ modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreToken", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("ApplicationId")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("AuthorizationId")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("ConcurrencyToken")
+ .IsConcurrencyToken()
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("CreationDate")
+ .HasColumnType("datetime2");
+
+ b.Property("ExpirationDate")
+ .HasColumnType("datetime2");
+
+ b.Property("Payload")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Properties")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("RedemptionDate")
+ .HasColumnType("datetime2");
+
+ b.Property("ReferenceId")
+ .HasMaxLength(100)
+ .HasColumnType("nvarchar(100)");
+
+ b.Property("Status")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("Subject")
+ .HasMaxLength(400)
+ .HasColumnType("nvarchar(400)");
+
+ b.Property("Type")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AuthorizationId");
+
+ b.HasIndex("ReferenceId")
+ .IsUnique()
+ .HasFilter("[ReferenceId] IS NOT NULL");
+
+ b.HasIndex("ApplicationId", "Status", "Subject", "Type");
+
+ b.ToTable("umbracoOpenIddictTokens", (string)null);
+ });
+
+ modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreAuthorization", b =>
+ {
+ b.HasOne("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreApplication", "Application")
+ .WithMany("Authorizations")
+ .HasForeignKey("ApplicationId");
+
+ b.Navigation("Application");
+ });
+
+ modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreToken", b =>
+ {
+ b.HasOne("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreApplication", "Application")
+ .WithMany("Tokens")
+ .HasForeignKey("ApplicationId");
+
+ b.HasOne("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreAuthorization", "Authorization")
+ .WithMany("Tokens")
+ .HasForeignKey("AuthorizationId");
+
+ b.Navigation("Application");
+
+ b.Navigation("Authorization");
+ });
+
+ modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreApplication", b =>
+ {
+ b.Navigation("Authorizations");
+
+ b.Navigation("Tokens");
+ });
+
+ modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreAuthorization", b =>
+ {
+ b.Navigation("Tokens");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/src/Umbraco.Cms.Persistence.EFCore.SqlServer/SqlServerMigrationProvider.cs b/src/Umbraco.Cms.Persistence.EFCore.SqlServer/SqlServerMigrationProvider.cs
new file mode 100644
index 0000000000..45e431eb8f
--- /dev/null
+++ b/src/Umbraco.Cms.Persistence.EFCore.SqlServer/SqlServerMigrationProvider.cs
@@ -0,0 +1,33 @@
+using Microsoft.EntityFrameworkCore;
+using Umbraco.Cms.Persistence.EFCore.Migrations;
+using Umbraco.Extensions;
+
+namespace Umbraco.Cms.Persistence.EFCore.SqlServer;
+
+public class SqlServerMigrationProvider : IMigrationProvider
+{
+ private readonly IDbContextFactory _dbContextFactory;
+
+ public SqlServerMigrationProvider(IDbContextFactory dbContextFactory) => _dbContextFactory = dbContextFactory;
+
+ public string ProviderName => "Microsoft.Data.SqlClient";
+
+ public async Task MigrateAsync(EFCoreMigration migration)
+ {
+ UmbracoDbContext context = await _dbContextFactory.CreateDbContextAsync();
+ await context.MigrateDatabaseAsync(GetMigrationType(migration));
+ }
+
+ public async Task MigrateAllAsync()
+ {
+ UmbracoDbContext context = await _dbContextFactory.CreateDbContextAsync();
+ await context.Database.MigrateAsync();
+ }
+
+ private static Type GetMigrationType(EFCoreMigration migration) =>
+ migration switch
+ {
+ EFCoreMigration.InitialCreate => typeof(Migrations.InitialCreate),
+ _ => throw new ArgumentOutOfRangeException(nameof(migration), $@"Not expected migration value: {migration}")
+ };
+}
diff --git a/src/Umbraco.Cms.Persistence.EFCore.SqlServer/SqlServerMigrationProviderSetup.cs b/src/Umbraco.Cms.Persistence.EFCore.SqlServer/SqlServerMigrationProviderSetup.cs
new file mode 100644
index 0000000000..6b161fc47f
--- /dev/null
+++ b/src/Umbraco.Cms.Persistence.EFCore.SqlServer/SqlServerMigrationProviderSetup.cs
@@ -0,0 +1,14 @@
+using Microsoft.EntityFrameworkCore;
+using Umbraco.Cms.Persistence.EFCore.Migrations;
+
+namespace Umbraco.Cms.Persistence.EFCore.SqlServer;
+
+public class SqlServerMigrationProviderSetup : IMigrationProviderSetup
+{
+ public string ProviderName => "Microsoft.Data.SqlClient";
+
+ public void Setup(DbContextOptionsBuilder builder, string? connectionString)
+ {
+ builder.UseSqlServer(connectionString, x => x.MigrationsAssembly(GetType().Assembly.FullName));
+ }
+}
diff --git a/src/Umbraco.Cms.Persistence.EFCore.SqlServer/Umbraco.Cms.Persistence.EFCore.SqlServer.csproj b/src/Umbraco.Cms.Persistence.EFCore.SqlServer/Umbraco.Cms.Persistence.EFCore.SqlServer.csproj
new file mode 100644
index 0000000000..946c08556f
--- /dev/null
+++ b/src/Umbraco.Cms.Persistence.EFCore.SqlServer/Umbraco.Cms.Persistence.EFCore.SqlServer.csproj
@@ -0,0 +1,15 @@
+
+
+ Umbraco CMS - EF Core - SqlServer migrations
+
+ false
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Umbraco.Cms.Persistence.EFCore.Sqlite/EFCoreSqliteComposer.cs b/src/Umbraco.Cms.Persistence.EFCore.Sqlite/EFCoreSqliteComposer.cs
new file mode 100644
index 0000000000..afa3237db5
--- /dev/null
+++ b/src/Umbraco.Cms.Persistence.EFCore.Sqlite/EFCoreSqliteComposer.cs
@@ -0,0 +1,15 @@
+using Microsoft.Extensions.DependencyInjection;
+using Umbraco.Cms.Core.Composing;
+using Umbraco.Cms.Core.DependencyInjection;
+using Umbraco.Cms.Persistence.EFCore.Migrations;
+
+namespace Umbraco.Cms.Persistence.EFCore.Sqlite;
+
+public class EFCoreSqliteComposer : IComposer
+{
+ public void Compose(IUmbracoBuilder builder)
+ {
+ builder.Services.AddSingleton();
+ builder.Services.AddSingleton();
+ }
+}
diff --git a/src/Umbraco.Cms.Persistence.EFCore.Sqlite/Migrations/20230622183638_InitialCreate.Designer.cs b/src/Umbraco.Cms.Persistence.EFCore.Sqlite/Migrations/20230622183638_InitialCreate.Designer.cs
new file mode 100644
index 0000000000..611f1c31cb
--- /dev/null
+++ b/src/Umbraco.Cms.Persistence.EFCore.Sqlite/Migrations/20230622183638_InitialCreate.Designer.cs
@@ -0,0 +1,258 @@
+//
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace Umbraco.Cms.Persistence.EFCore.Sqlite.Migrations
+{
+ [DbContext(typeof(UmbracoDbContext))]
+ [Migration("20230622183638_InitialCreate")]
+ partial class InitialCreate
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder.HasAnnotation("ProductVersion", "7.0.7");
+
+ modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreApplication", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("TEXT");
+
+ b.Property("ClientId")
+ .HasMaxLength(100)
+ .HasColumnType("TEXT");
+
+ b.Property("ClientSecret")
+ .HasColumnType("TEXT");
+
+ b.Property("ConcurrencyToken")
+ .IsConcurrencyToken()
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.Property("ConsentType")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.Property("DisplayName")
+ .HasColumnType("TEXT");
+
+ b.Property("DisplayNames")
+ .HasColumnType("TEXT");
+
+ 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("Type")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ClientId")
+ .IsUnique();
+
+ b.ToTable("umbracoOpenIddictApplications", (string)null);
+ });
+
+ modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreAuthorization", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("TEXT");
+
+ b.Property("ApplicationId")
+ .HasColumnType("TEXT");
+
+ b.Property("ConcurrencyToken")
+ .IsConcurrencyToken()
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.Property("CreationDate")
+ .HasColumnType("TEXT");
+
+ b.Property("Properties")
+ .HasColumnType("TEXT");
+
+ b.Property("Scopes")
+ .HasColumnType("TEXT");
+
+ b.Property("Status")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.Property("Subject")
+ .HasMaxLength(400)
+ .HasColumnType("TEXT");
+
+ b.Property("Type")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ApplicationId", "Status", "Subject", "Type");
+
+ b.ToTable("umbracoOpenIddictAuthorizations", (string)null);
+ });
+
+ modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreScope", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("TEXT");
+
+ b.Property("ConcurrencyToken")
+ .IsConcurrencyToken()
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ 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("TEXT");
+
+ b.Property("Properties")
+ .HasColumnType("TEXT");
+
+ b.Property("Resources")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("Name")
+ .IsUnique();
+
+ b.ToTable("umbracoOpenIddictScopes", (string)null);
+ });
+
+ modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreToken", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("TEXT");
+
+ b.Property("ApplicationId")
+ .HasColumnType("TEXT");
+
+ b.Property("AuthorizationId")
+ .HasColumnType("TEXT");
+
+ b.Property("ConcurrencyToken")
+ .IsConcurrencyToken()
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.Property("CreationDate")
+ .HasColumnType("TEXT");
+
+ b.Property("ExpirationDate")
+ .HasColumnType("TEXT");
+
+ b.Property("Payload")
+ .HasColumnType("TEXT");
+
+ b.Property("Properties")
+ .HasColumnType("TEXT");
+
+ b.Property("RedemptionDate")
+ .HasColumnType("TEXT");
+
+ b.Property("ReferenceId")
+ .HasMaxLength(100)
+ .HasColumnType("TEXT");
+
+ b.Property("Status")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.Property("Subject")
+ .HasMaxLength(400)
+ .HasColumnType("TEXT");
+
+ b.Property("Type")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AuthorizationId");
+
+ b.HasIndex("ReferenceId")
+ .IsUnique();
+
+ b.HasIndex("ApplicationId", "Status", "Subject", "Type");
+
+ b.ToTable("umbracoOpenIddictTokens", (string)null);
+ });
+
+ modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreAuthorization", b =>
+ {
+ b.HasOne("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreApplication", "Application")
+ .WithMany("Authorizations")
+ .HasForeignKey("ApplicationId");
+
+ b.Navigation("Application");
+ });
+
+ modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreToken", b =>
+ {
+ b.HasOne("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreApplication", "Application")
+ .WithMany("Tokens")
+ .HasForeignKey("ApplicationId");
+
+ b.HasOne("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreAuthorization", "Authorization")
+ .WithMany("Tokens")
+ .HasForeignKey("AuthorizationId");
+
+ b.Navigation("Application");
+
+ b.Navigation("Authorization");
+ });
+
+ modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreApplication", b =>
+ {
+ b.Navigation("Authorizations");
+
+ b.Navigation("Tokens");
+ });
+
+ modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreAuthorization", b =>
+ {
+ b.Navigation("Tokens");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/src/Umbraco.Cms.Persistence.EFCore.Sqlite/Migrations/20230622183638_InitialCreate.cs b/src/Umbraco.Cms.Persistence.EFCore.Sqlite/Migrations/20230622183638_InitialCreate.cs
new file mode 100644
index 0000000000..ea1b21ac3f
--- /dev/null
+++ b/src/Umbraco.Cms.Persistence.EFCore.Sqlite/Migrations/20230622183638_InitialCreate.cs
@@ -0,0 +1,163 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace Umbraco.Cms.Persistence.EFCore.Sqlite.Migrations
+{
+ ///
+ public partial class InitialCreate : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateTable(
+ name: "umbracoOpenIddictApplications",
+ columns: table => new
+ {
+ Id = table.Column(type: "TEXT", nullable: false),
+ ClientId = table.Column(type: "TEXT", maxLength: 100, nullable: true),
+ ClientSecret = table.Column(type: "TEXT", nullable: true),
+ ConcurrencyToken = table.Column(type: "TEXT", maxLength: 50, nullable: true),
+ ConsentType = table.Column(type: "TEXT", maxLength: 50, nullable: true),
+ DisplayName = table.Column(type: "TEXT", nullable: true),
+ DisplayNames = table.Column(type: "TEXT", nullable: true),
+ Permissions = table.Column(type: "TEXT", nullable: true),
+ PostLogoutRedirectUris = table.Column(type: "TEXT", nullable: true),
+ Properties = table.Column(type: "TEXT", nullable: true),
+ RedirectUris = table.Column(type: "TEXT", nullable: true),
+ Requirements = table.Column(type: "TEXT", nullable: true),
+ Type = table.Column(type: "TEXT", maxLength: 50, nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_umbracoOpenIddictApplications", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "umbracoOpenIddictScopes",
+ columns: table => new
+ {
+ Id = table.Column(type: "TEXT", nullable: false),
+ ConcurrencyToken = table.Column(type: "TEXT", maxLength: 50, nullable: true),
+ Description = table.Column(type: "TEXT", nullable: true),
+ Descriptions = table.Column(type: "TEXT", nullable: true),
+ DisplayName = table.Column(type: "TEXT", nullable: true),
+ DisplayNames = table.Column(type: "TEXT", nullable: true),
+ Name = table.Column(type: "TEXT", maxLength: 200, nullable: true),
+ Properties = table.Column(type: "TEXT", nullable: true),
+ Resources = table.Column(type: "TEXT", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_umbracoOpenIddictScopes", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "umbracoOpenIddictAuthorizations",
+ columns: table => new
+ {
+ Id = table.Column(type: "TEXT", nullable: false),
+ ApplicationId = table.Column(type: "TEXT", nullable: true),
+ ConcurrencyToken = table.Column(type: "TEXT", maxLength: 50, nullable: true),
+ CreationDate = table.Column(type: "TEXT", nullable: true),
+ Properties = table.Column(type: "TEXT", nullable: true),
+ Scopes = table.Column(type: "TEXT", nullable: true),
+ Status = table.Column(type: "TEXT", maxLength: 50, nullable: true),
+ Subject = table.Column(type: "TEXT", maxLength: 400, nullable: true),
+ Type = table.Column(type: "TEXT", maxLength: 50, nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_umbracoOpenIddictAuthorizations", x => x.Id);
+ table.ForeignKey(
+ name: "FK_umbracoOpenIddictAuthorizations_umbracoOpenIddictApplications_ApplicationId",
+ column: x => x.ApplicationId,
+ principalTable: "umbracoOpenIddictApplications",
+ principalColumn: "Id");
+ });
+
+ migrationBuilder.CreateTable(
+ name: "umbracoOpenIddictTokens",
+ columns: table => new
+ {
+ Id = table.Column(type: "TEXT", nullable: false),
+ ApplicationId = table.Column(type: "TEXT", nullable: true),
+ AuthorizationId = table.Column(type: "TEXT", nullable: true),
+ ConcurrencyToken = table.Column(type: "TEXT", maxLength: 50, nullable: true),
+ CreationDate = table.Column(type: "TEXT", nullable: true),
+ ExpirationDate = table.Column(type: "TEXT", nullable: true),
+ Payload = table.Column(type: "TEXT", nullable: true),
+ Properties = table.Column(type: "TEXT", nullable: true),
+ RedemptionDate = table.Column(type: "TEXT", nullable: true),
+ ReferenceId = table.Column(type: "TEXT", maxLength: 100, nullable: true),
+ Status = table.Column(type: "TEXT", maxLength: 50, nullable: true),
+ Subject = table.Column(type: "TEXT", maxLength: 400, nullable: true),
+ Type = table.Column(type: "TEXT", maxLength: 50, nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_umbracoOpenIddictTokens", x => x.Id);
+ table.ForeignKey(
+ name: "FK_umbracoOpenIddictTokens_umbracoOpenIddictApplications_ApplicationId",
+ column: x => x.ApplicationId,
+ principalTable: "umbracoOpenIddictApplications",
+ principalColumn: "Id");
+ table.ForeignKey(
+ name: "FK_umbracoOpenIddictTokens_umbracoOpenIddictAuthorizations_AuthorizationId",
+ column: x => x.AuthorizationId,
+ principalTable: "umbracoOpenIddictAuthorizations",
+ principalColumn: "Id");
+ });
+
+ migrationBuilder.CreateIndex(
+ name: "IX_umbracoOpenIddictApplications_ClientId",
+ table: "umbracoOpenIddictApplications",
+ column: "ClientId",
+ unique: true);
+
+ migrationBuilder.CreateIndex(
+ name: "IX_umbracoOpenIddictAuthorizations_ApplicationId_Status_Subject_Type",
+ table: "umbracoOpenIddictAuthorizations",
+ columns: new[] { "ApplicationId", "Status", "Subject", "Type" });
+
+ migrationBuilder.CreateIndex(
+ name: "IX_umbracoOpenIddictScopes_Name",
+ table: "umbracoOpenIddictScopes",
+ column: "Name",
+ unique: true);
+
+ migrationBuilder.CreateIndex(
+ name: "IX_umbracoOpenIddictTokens_ApplicationId_Status_Subject_Type",
+ table: "umbracoOpenIddictTokens",
+ columns: new[] { "ApplicationId", "Status", "Subject", "Type" });
+
+ migrationBuilder.CreateIndex(
+ name: "IX_umbracoOpenIddictTokens_AuthorizationId",
+ table: "umbracoOpenIddictTokens",
+ column: "AuthorizationId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_umbracoOpenIddictTokens_ReferenceId",
+ table: "umbracoOpenIddictTokens",
+ column: "ReferenceId",
+ unique: true);
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "umbracoOpenIddictScopes");
+
+ migrationBuilder.DropTable(
+ name: "umbracoOpenIddictTokens");
+
+ migrationBuilder.DropTable(
+ name: "umbracoOpenIddictAuthorizations");
+
+ migrationBuilder.DropTable(
+ name: "umbracoOpenIddictApplications");
+ }
+ }
+}
diff --git a/src/Umbraco.Cms.Persistence.EFCore.Sqlite/Migrations/UmbracoOpenIddictDbContextModelSnapshot.cs b/src/Umbraco.Cms.Persistence.EFCore.Sqlite/Migrations/UmbracoOpenIddictDbContextModelSnapshot.cs
new file mode 100644
index 0000000000..da82993433
--- /dev/null
+++ b/src/Umbraco.Cms.Persistence.EFCore.Sqlite/Migrations/UmbracoOpenIddictDbContextModelSnapshot.cs
@@ -0,0 +1,256 @@
+//
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Umbraco.Cms.Persistence.EFCore;
+
+#nullable disable
+
+namespace Umbraco.Cms.Persistence.EFCore.Sqlite.Migrations
+{
+ [DbContext(typeof(UmbracoDbContext))]
+ partial class UmbracoOpenIddictDbContextModelSnapshot : ModelSnapshot
+ {
+ protected override void BuildModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder.HasAnnotation("ProductVersion", "7.0.7");
+
+ modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreApplication", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("TEXT");
+
+ b.Property("ClientId")
+ .HasMaxLength(100)
+ .HasColumnType("TEXT");
+
+ b.Property("ClientSecret")
+ .HasColumnType("TEXT");
+
+ b.Property("ConcurrencyToken")
+ .IsConcurrencyToken()
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.Property("ConsentType")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.Property("DisplayName")
+ .HasColumnType("TEXT");
+
+ b.Property("DisplayNames")
+ .HasColumnType("TEXT");
+
+ 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("Type")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ClientId")
+ .IsUnique();
+
+ b.ToTable("umbracoOpenIddictApplications", (string)null);
+ });
+
+ modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreAuthorization", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("TEXT");
+
+ b.Property("ApplicationId")
+ .HasColumnType("TEXT");
+
+ b.Property("ConcurrencyToken")
+ .IsConcurrencyToken()
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.Property("CreationDate")
+ .HasColumnType("TEXT");
+
+ b.Property("Properties")
+ .HasColumnType("TEXT");
+
+ b.Property("Scopes")
+ .HasColumnType("TEXT");
+
+ b.Property("Status")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.Property("Subject")
+ .HasMaxLength(400)
+ .HasColumnType("TEXT");
+
+ b.Property("Type")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ApplicationId", "Status", "Subject", "Type");
+
+ b.ToTable("umbracoOpenIddictAuthorizations", (string)null);
+ });
+
+ modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreScope", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("TEXT");
+
+ b.Property("ConcurrencyToken")
+ .IsConcurrencyToken()
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.Property("Description")
+ .HasColumnType("TEXT");
+
+ b.Property("Descriptions")
+ .HasColumnType("TEXT");
+
+ b.Property("DisplayName")
+ .HasColumnType("TEXT");
+
+ b.Property