Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Update AliasClientDb project (#2159)
Leendert de Borsta8febeffa039
diff --git a/apps/server/Databases/AliasClientDb/AliasClientDbContext.cs b/apps/server/Databases/AliasClientDb/AliasClientDbContext.csindex 579607b92..a9b98f93d 100644--- a/apps/server/Databases/AliasClientDb/AliasClientDbContext.cs+++ b/apps/server/Databases/AliasClientDb/AliasClientDbContext.cs@@ -109,6 +109,11 @@ public class AliasClientDbContext : DbContext/// </summary>public DbSet<ItemTag> ItemTags { get; set; }+ /// <summary>+ /// Gets or sets the CodecOverflows DbSet.+ /// </summary>+ public DbSet<CodecOverflow> CodecOverflows { get; set; }+/// <summary>/// The OnModelCreating method./// </summary>diff --git a/apps/server/Databases/AliasClientDb/CodecOverflow.cs b/apps/server/Databases/AliasClientDb/CodecOverflow.csnew file mode 100644index 000000000..ae3278e3b--- /dev/null+++ b/apps/server/Databases/AliasClientDb/CodecOverflow.cs@@ -0,0 +1,27 @@+//-----------------------------------------------------------------------+// <copyright file="CodecOverflow.cs" company="aliasvault">+// Copyright (c) aliasvault. All rights reserved.+// Licensed under the AGPLv3 license. See LICENSE.md file in the project root for full license information.+// </copyright>+//-----------------------------------------------------------------------++namespace AliasClientDb;++using System.ComponentModel.DataAnnotations;++/// <summary>+/// Table to store codec overflow data that cannot be materialized into the local schema.+/// </summary>+public class CodecOverflow+{+ /// <summary>+ /// Gets or sets the primary key. The codec writes a single row with a fixed sentinel id.+ /// </summary>+ [Key]+ public Guid Id { get; set; }++ /// <summary>+ /// Gets or sets the serialized overflow payload (JSON, shape owned by the Rust vault codec).+ /// </summary>+ public string Data { get; set; } = null!;+}diff --git a/apps/server/Databases/AliasClientDb/Migrations/20260721081936_2.1.0-AddCodecOverflows.Designer.cs b/apps/server/Databases/AliasClientDb/Migrations/20260721081936_2.1.0-AddCodecOverflows.Designer.csnew file mode 100644index 000000000..ce7de2440--- /dev/null+++ b/apps/server/Databases/AliasClientDb/Migrations/20260721081936_2.1.0-AddCodecOverflows.Designer.cs@@ -0,0 +1,690 @@+// <auto-generated />+using System;+using AliasClientDb;+using Microsoft.EntityFrameworkCore;+using Microsoft.EntityFrameworkCore.Infrastructure;+using Microsoft.EntityFrameworkCore.Migrations;+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;++#nullable disable++namespace AliasClientDb.Migrations+{+ [DbContext(typeof(AliasClientDbContext))]+ [Migration("20260721081936_2.1.0-AddCodecOverflows")]+ partial class _210AddCodecOverflows+ {+ /// <inheritdoc />+ protected override void BuildTargetModel(ModelBuilder modelBuilder)+ {+#pragma warning disable 612, 618+ modelBuilder+ .HasAnnotation("ProductVersion", "10.0.10")+ .HasAnnotation("Proxies:ChangeTracking", false)+ .HasAnnotation("Proxies:CheckEquality", false)+ .HasAnnotation("Proxies:LazyLoading", true);++ modelBuilder.Entity("AliasClientDb.Attachment", b =>+ {+ b.Property<Guid>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("TEXT");++ b.Property<byte[]>("Blob")+ .IsRequired()+ .HasColumnType("BLOB");++ b.Property<DateTime>("CreatedAt")+ .HasColumnType("TEXT");++ b.Property<string>("Filename")+ .IsRequired()+ .HasMaxLength(255)+ .HasColumnType("TEXT");++ b.Property<bool>("IsDeleted")+ .HasColumnType("INTEGER");++ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<DateTime>("UpdatedAt")+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("ItemId");++ b.ToTable("Attachments");+ });++ modelBuilder.Entity("AliasClientDb.CodecOverflow", b =>+ {+ b.Property<Guid>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("TEXT");++ b.Property<string>("Data")+ .IsRequired()+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.ToTable("CodecOverflows");+ });++ modelBuilder.Entity("AliasClientDb.EncryptionKey", b =>+ {+ b.Property<Guid>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("TEXT");++ b.Property<DateTime>("CreatedAt")+ .HasColumnType("TEXT");++ b.Property<bool>("IsDeleted")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsPrimary")+ .HasColumnType("INTEGER");++ b.Property<string>("PrivateKey")+ .IsRequired()+ .HasMaxLength(2000)+ .HasColumnType("TEXT");++ b.Property<string>("PublicKey")+ .IsRequired()+ .HasMaxLength(2000)+ .HasColumnType("TEXT");++ b.Property<DateTime>("UpdatedAt")+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.ToTable("EncryptionKeys");+ });++ modelBuilder.Entity("AliasClientDb.FieldDefinition", b =>+ {+ b.Property<Guid>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("TEXT");++ b.Property<string>("ApplicableToTypes")+ .HasColumnType("TEXT");++ b.Property<DateTime>("CreatedAt")+ .HasColumnType("TEXT");++ b.Property<bool>("EnableHistory")+ .HasColumnType("INTEGER");++ b.Property<string>("FieldType")+ .IsRequired()+ .HasMaxLength(50)+ .HasColumnType("TEXT");++ b.Property<bool>("IsDeleted")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsHidden")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsMultiValue")+ .HasColumnType("INTEGER");++ b.Property<string>("Label")+ .IsRequired()+ .HasMaxLength(255)+ .HasColumnType("TEXT");++ b.Property<DateTime>("UpdatedAt")+ .HasColumnType("TEXT");++ b.Property<int>("Weight")+ .HasColumnType("INTEGER");++ b.HasKey("Id");++ b.ToTable("FieldDefinitions");+ });++ modelBuilder.Entity("AliasClientDb.FieldHistory", b =>+ {+ b.Property<Guid>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("TEXT");++ b.Property<DateTime>("ChangedAt")+ .HasColumnType("TEXT");++ b.Property<DateTime>("CreatedAt")+ .HasColumnType("TEXT");++ b.Property<Guid?>("FieldDefinitionId")+ .HasColumnType("TEXT");++ b.Property<string>("FieldKey")+ .HasMaxLength(100)+ .HasColumnType("TEXT");++ b.Property<bool>("IsDeleted")+ .HasColumnType("INTEGER");++ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<DateTime>("UpdatedAt")+ .HasColumnType("TEXT");++ b.Property<string>("ValueSnapshot")+ .IsRequired()+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("FieldDefinitionId");++ b.HasIndex("ItemId");++ b.ToTable("FieldHistories");+ });++ modelBuilder.Entity("AliasClientDb.FieldValue", b =>+ {+ b.Property<Guid>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("TEXT");++ b.Property<DateTime>("CreatedAt")+ .HasColumnType("TEXT");++ b.Property<Guid?>("FieldDefinitionId")+ .HasColumnType("TEXT");++ b.Property<string>("FieldKey")+ .HasMaxLength(100)+ .HasColumnType("TEXT");++ b.Property<bool>("IsDeleted")+ .HasColumnType("INTEGER");++ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<DateTime>("UpdatedAt")+ .HasColumnType("TEXT");++ b.Property<string>("Value")+ .HasColumnType("TEXT");++ b.Property<int>("Weight")+ .HasColumnType("INTEGER");++ b.HasKey("Id");++ b.HasIndex("FieldDefinitionId");++ b.HasIndex("FieldKey");++ b.HasIndex("ItemId");++ b.HasIndex("ItemId", "FieldKey");++ b.HasIndex("ItemId", "FieldDefinitionId", "Weight");++ b.ToTable("FieldValues");+ });++ modelBuilder.Entity("AliasClientDb.Folder", b =>+ {+ b.Property<Guid>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("TEXT");++ b.Property<DateTime>("CreatedAt")+ .HasColumnType("TEXT");++ b.Property<bool>("IsDeleted")+ .HasColumnType("INTEGER");++ b.Property<string>("Name")+ .IsRequired()+ .HasMaxLength(255)+ .HasColumnType("TEXT");++ b.Property<Guid?>("ParentFolderId")+ .HasColumnType("TEXT");++ b.Property<DateTime>("UpdatedAt")+ .HasColumnType("TEXT");++ b.Property<int>("Weight")+ .HasColumnType("INTEGER");++ b.HasKey("Id");++ b.HasIndex("ParentFolderId");++ b.ToTable("Folders");+ });++ modelBuilder.Entity("AliasClientDb.Item", b =>+ {+ b.Property<Guid>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("TEXT");++ b.Property<DateTime>("CreatedAt")+ .HasColumnType("TEXT");++ b.Property<DateTime?>("DeletedAt")+ .HasColumnType("TEXT");++ b.Property<Guid?>("FolderId")+ .HasColumnType("TEXT");++ b.Property<bool>("IsDeleted")+ .HasColumnType("INTEGER");++ b.Property<string>("ItemType")+ .IsRequired()+ .HasMaxLength(50)+ .HasColumnType("TEXT");++ b.Property<Guid?>("LogoId")+ .HasColumnType("TEXT");++ b.Property<string>("Name")+ .HasMaxLength(255)+ .HasColumnType("TEXT");++ b.Property<DateTime>("UpdatedAt")+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("FolderId");++ b.HasIndex("LogoId");++ b.ToTable("Items");+ });++ modelBuilder.Entity("AliasClientDb.ItemTag", b =>+ {+ b.Property<Guid>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("TEXT");++ b.Property<DateTime>("CreatedAt")+ .HasColumnType("TEXT");++ b.Property<bool>("IsDeleted")+ .HasColumnType("INTEGER");++ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<Guid>("TagId")+ .HasColumnType("TEXT");++ b.Property<DateTime>("UpdatedAt")+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("ItemId");++ b.HasIndex("TagId");++ b.HasIndex("ItemId", "TagId")+ .IsUnique();++ b.ToTable("ItemTags");+ });++ modelBuilder.Entity("AliasClientDb.Logo", b =>+ {+ b.Property<Guid>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("TEXT");++ b.Property<DateTime>("CreatedAt")+ .HasColumnType("TEXT");++ b.Property<DateTime?>("FetchedAt")+ .HasColumnType("TEXT");++ b.Property<byte[]>("FileData")+ .HasColumnType("BLOB");++ b.Property<bool>("IsDeleted")+ .HasColumnType("INTEGER");++ b.Property<string>("MimeType")+ .HasMaxLength(100)+ .HasColumnType("TEXT");++ b.Property<string>("Source")+ .IsRequired()+ .HasMaxLength(255)+ .HasColumnType("TEXT");++ b.Property<DateTime>("UpdatedAt")+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("Source")+ .IsUnique();++ b.ToTable("Logos");+ });++ modelBuilder.Entity("AliasClientDb.Passkey", b =>+ {+ b.Property<Guid>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("TEXT");++ b.Property<byte[]>("AdditionalData")+ .HasColumnType("BLOB");++ b.Property<DateTime>("CreatedAt")+ .HasColumnType("TEXT");++ b.Property<string>("DisplayName")+ .IsRequired()+ .HasMaxLength(255)+ .HasColumnType("TEXT");++ b.Property<bool>("IsDeleted")+ .HasColumnType("INTEGER");++ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<byte[]>("PrfKey")+ .HasMaxLength(64)+ .HasColumnType("BLOB");++ b.Property<string>("PrivateKey")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<string>("PublicKey")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<string>("RpId")+ .IsRequired()+ .HasMaxLength(255)+ .HasColumnType("TEXT")+ .UseCollation("NOCASE");++ b.Property<DateTime>("UpdatedAt")+ .HasColumnType("TEXT");++ b.Property<byte[]>("UserHandle")+ .IsRequired()+ .HasColumnType("BLOB");++ b.HasKey("Id");++ b.HasIndex("ItemId");++ b.HasIndex("RpId");++ b.ToTable("Passkeys");+ });++ modelBuilder.Entity("AliasClientDb.Setting", b =>+ {+ b.Property<string>("Key")+ .HasMaxLength(255)+ .HasColumnType("TEXT");++ b.Property<DateTime>("CreatedAt")+ .HasColumnType("TEXT");++ b.Property<bool>("IsDeleted")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("UpdatedAt")+ .HasColumnType("TEXT");++ b.Property<string>("Value")+ .HasColumnType("TEXT");++ b.HasKey("Key");++ b.ToTable("Settings");+ });++ modelBuilder.Entity("AliasClientDb.Tag", b =>+ {+ b.Property<Guid>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("TEXT");++ b.Property<string>("Color")+ .HasMaxLength(50)+ .HasColumnType("TEXT");++ b.Property<DateTime>("CreatedAt")+ .HasColumnType("TEXT");++ b.Property<int>("DisplayOrder")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsDeleted")+ .HasColumnType("INTEGER");++ b.Property<string>("Name")+ .IsRequired()+ .HasMaxLength(255)+ .HasColumnType("TEXT");++ b.Property<DateTime>("UpdatedAt")+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("Name");++ b.ToTable("Tags");+ });++ modelBuilder.Entity("AliasClientDb.TotpCode", b =>+ {+ b.Property<Guid>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("TEXT");++ b.Property<DateTime>("CreatedAt")+ .HasColumnType("TEXT");++ b.Property<bool>("IsDeleted")+ .HasColumnType("INTEGER");++ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<string>("Name")+ .IsRequired()+ .HasMaxLength(255)+ .HasColumnType("TEXT");++ b.Property<string>("SecretKey")+ .IsRequired()+ .HasMaxLength(255)+ .HasColumnType("TEXT");++ b.Property<DateTime>("UpdatedAt")+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("ItemId");++ b.ToTable("TotpCodes");+ });++ modelBuilder.Entity("AliasClientDb.Attachment", b =>+ {+ b.HasOne("AliasClientDb.Item", "Item")+ .WithMany("Attachments")+ .HasForeignKey("ItemId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Item");+ });++ modelBuilder.Entity("AliasClientDb.FieldHistory", b =>+ {+ b.HasOne("AliasClientDb.FieldDefinition", "FieldDefinition")+ .WithMany("FieldHistories")+ .HasForeignKey("FieldDefinitionId")+ .OnDelete(DeleteBehavior.Cascade);++ b.HasOne("AliasClientDb.Item", "Item")+ .WithMany()+ .HasForeignKey("ItemId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("FieldDefinition");++ b.Navigation("Item");+ });++ modelBuilder.Entity("AliasClientDb.FieldValue", b =>+ {+ b.HasOne("AliasClientDb.FieldDefinition", "FieldDefinition")+ .WithMany("FieldValues")+ .HasForeignKey("FieldDefinitionId")+ .OnDelete(DeleteBehavior.Cascade);++ b.HasOne("AliasClientDb.Item", "Item")+ .WithMany("FieldValues")+ .HasForeignKey("ItemId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("FieldDefinition");++ b.Navigation("Item");+ });++ modelBuilder.Entity("AliasClientDb.Folder", b =>+ {+ b.HasOne("AliasClientDb.Folder", "ParentFolder")+ .WithMany("ChildFolders")+ .HasForeignKey("ParentFolderId")+ .OnDelete(DeleteBehavior.Cascade);++ b.Navigation("ParentFolder");+ });++ modelBuilder.Entity("AliasClientDb.Item", b =>+ {+ b.HasOne("AliasClientDb.Folder", "Folder")+ .WithMany("Items")+ .HasForeignKey("FolderId")+ .OnDelete(DeleteBehavior.SetNull);++ b.HasOne("AliasClientDb.Logo", "Logo")+ .WithMany("Items")+ .HasForeignKey("LogoId")+ .OnDelete(DeleteBehavior.SetNull);++ b.Navigation("Folder");++ b.Navigation("Logo");+ });++ modelBuilder.Entity("AliasClientDb.ItemTag", b =>+ {+ b.HasOne("AliasClientDb.Item", "Item")+ .WithMany("ItemTags")+ .HasForeignKey("ItemId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.HasOne("AliasClientDb.Tag", "Tag")+ .WithMany("ItemTags")+ .HasForeignKey("TagId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Item");++ b.Navigation("Tag");+ });++ modelBuilder.Entity("AliasClientDb.Passkey", b =>+ {+ b.HasOne("AliasClientDb.Item", "Item")+ .WithMany("Passkeys")+ .HasForeignKey("ItemId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Item");+ });++ modelBuilder.Entity("AliasClientDb.TotpCode", b =>+ {+ b.HasOne("AliasClientDb.Item", "Item")+ .WithMany("TotpCodes")+ .HasForeignKey("ItemId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Item");+ });++ modelBuilder.Entity("AliasClientDb.FieldDefinition", b =>+ {+ b.Navigation("FieldHistories");++ b.Navigation("FieldValues");+ });++ modelBuilder.Entity("AliasClientDb.Folder", b =>+ {+ b.Navigation("ChildFolders");++ b.Navigation("Items");+ });++ modelBuilder.Entity("AliasClientDb.Item", b =>+ {+ b.Navigation("Attachments");++ b.Navigation("FieldValues");++ b.Navigation("ItemTags");++ b.Navigation("Passkeys");++ b.Navigation("TotpCodes");+ });++ modelBuilder.Entity("AliasClientDb.Logo", b =>+ {+ b.Navigation("Items");+ });++ modelBuilder.Entity("AliasClientDb.Tag", b =>+ {+ b.Navigation("ItemTags");+ });+#pragma warning restore 612, 618+ }+ }+}diff --git a/apps/server/Databases/AliasClientDb/Migrations/20260721081936_2.1.0-AddCodecOverflows.cs b/apps/server/Databases/AliasClientDb/Migrations/20260721081936_2.1.0-AddCodecOverflows.csnew file mode 100644index 000000000..1fc7f7cc2--- /dev/null+++ b/apps/server/Databases/AliasClientDb/Migrations/20260721081936_2.1.0-AddCodecOverflows.cs@@ -0,0 +1,30 @@+// <auto-generated>+using System;+using Microsoft.EntityFrameworkCore.Migrations;++#nullable disable++namespace AliasClientDb.Migrations+{+ /// <inheritdoc />+ public partial class _210AddCodecOverflows : Migration+ {+ /// <inheritdoc />+ protected override void Up(MigrationBuilder migrationBuilder)+ {+ migrationBuilder.Sql("""+ CREATE TABLE IF NOT EXISTS "CodecOverflows" (+ "Id" TEXT NOT NULL CONSTRAINT "PK_CodecOverflows" PRIMARY KEY,+ "Data" TEXT NOT NULL+ );+ """);+ }++ /// <inheritdoc />+ protected override void Down(MigrationBuilder migrationBuilder)+ {+ migrationBuilder.DropTable(+ name: "CodecOverflows");+ }+ }+}diff --git a/apps/server/Databases/AliasClientDb/Migrations/AliasClientDbContextModelSnapshot.cs b/apps/server/Databases/AliasClientDb/Migrations/AliasClientDbContextModelSnapshot.csindex 6398776ee..f89b43393 100644--- a/apps/server/Databases/AliasClientDb/Migrations/AliasClientDbContextModelSnapshot.cs+++ b/apps/server/Databases/AliasClientDb/Migrations/AliasClientDbContextModelSnapshot.cs@@ -16,7 +16,7 @@ namespace AliasClientDb.Migrations{#pragma warning disable 612, 618modelBuilder- .HasAnnotation("ProductVersion", "9.0.4")+ .HasAnnotation("ProductVersion", "10.0.10").HasAnnotation("Proxies:ChangeTracking", false).HasAnnotation("Proxies:CheckEquality", false).HasAnnotation("Proxies:LazyLoading", true);@@ -55,6 +55,21 @@ namespace AliasClientDb.Migrationsb.ToTable("Attachments");});+ modelBuilder.Entity("AliasClientDb.CodecOverflow", b =>+ {+ b.Property<Guid>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("TEXT");++ b.Property<string>("Data")+ .IsRequired()+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.ToTable("CodecOverflows");+ });+modelBuilder.Entity("AliasClientDb.EncryptionKey", b =>{b.Property<Guid>("Id")diff --git a/apps/server/Databases/AliasClientDb/Scripts/MigrationSql/000_FullSchema.sql b/apps/server/Databases/AliasClientDb/Scripts/MigrationSql/000_FullSchema.sqlindex e03a279f7..212859243 100644--- a/apps/server/Databases/AliasClientDb/Scripts/MigrationSql/000_FullSchema.sql+++ b/apps/server/Databases/AliasClientDb/Scripts/MigrationSql/000_FullSchema.sql@@ -73,16 +73,25 @@ CREATE INDEX "IX_Credentials_ServiceId" ON "Credentials" ("ServiceId");CREATE INDEX "IX_Passwords_CredentialId" ON "Passwords" ("CredentialId");INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")-VALUES ('20240708094944_1.0.0-InitialMigration', '9.0.4');+VALUES ('20240708094944_1.0.0-InitialMigration', '10.0.10');+COMMIT;++BEGIN TRANSACTION;INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")-VALUES ('20240708224522_1.0.1-EmptyTestMigration', '9.0.4');+VALUES ('20240708224522_1.0.1-EmptyTestMigration', '10.0.10');+COMMIT;++BEGIN TRANSACTION;ALTER TABLE "Aliases" RENAME COLUMN "EmailPrefix" TO "Email";INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")-VALUES ('20240711204207_1.0.2-ChangeEmailColumn', '9.0.4');+VALUES ('20240711204207_1.0.2-ChangeEmailColumn', '10.0.10');++COMMIT;+BEGIN TRANSACTION;CREATE TABLE "EncryptionKeys" ("Id" TEXT NOT NULL CONSTRAINT "PK_EncryptionKeys" PRIMARY KEY,"PublicKey" TEXT NOT NULL,@@ -93,8 +102,11 @@ CREATE TABLE "EncryptionKeys" ();INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")-VALUES ('20240729105618_1.1.0-AddPkiTables', '9.0.4');+VALUES ('20240729105618_1.1.0-AddPkiTables', '10.0.10');++COMMIT;+BEGIN TRANSACTION;CREATE TABLE "Settings" ("Key" TEXT NOT NULL CONSTRAINT "PK_Settings" PRIMARY KEY,"Value" TEXT NULL,@@ -103,8 +115,11 @@ CREATE TABLE "Settings" ();INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")-VALUES ('20240805073413_1.2.0-AddSettingsTable', '9.0.4');+VALUES ('20240805073413_1.2.0-AddSettingsTable', '10.0.10');++COMMIT;+BEGIN TRANSACTION;CREATE TABLE "ef_temp_Aliases" ("Id" TEXT NOT NULL CONSTRAINT "PK_Aliases" PRIMARY KEY,"BirthDate" TEXT NOT NULL,@@ -135,7 +150,7 @@ COMMIT;PRAGMA foreign_keys = 1;INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")-VALUES ('20240805122422_1.3.0-UpdateIdentityStructure', '9.0.4');+VALUES ('20240805122422_1.3.0-UpdateIdentityStructure', '10.0.10');BEGIN TRANSACTION;CREATE TABLE "ef_temp_Credentials" (@@ -175,7 +190,7 @@ CREATE INDEX "IX_Credentials_ServiceId" ON "Credentials" ("ServiceId");COMMIT;INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")-VALUES ('20240812141727_1.3.1-MakeUsernameOptional', '9.0.4');+VALUES ('20240812141727_1.3.1-MakeUsernameOptional', '10.0.10');BEGIN TRANSACTION;ALTER TABLE "Settings" ADD "IsDeleted" INTEGER NOT NULL DEFAULT 0;@@ -193,8 +208,11 @@ ALTER TABLE "Attachment" ADD "IsDeleted" INTEGER NOT NULL DEFAULT 0;ALTER TABLE "Aliases" ADD "IsDeleted" INTEGER NOT NULL DEFAULT 0;INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")-VALUES ('20240916105320_1.4.0-AddSyncSupport', '9.0.4');+VALUES ('20240916105320_1.4.0-AddSyncSupport', '10.0.10');++COMMIT;+BEGIN TRANSACTION;ALTER TABLE "Attachment" RENAME TO "Attachments";CREATE TABLE "ef_temp_Attachments" (@@ -231,7 +249,7 @@ CREATE INDEX "IX_Attachments_CredentialId" ON "Attachments" ("CredentialId");COMMIT;INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")-VALUES ('20240917191243_1.4.1-RenameAttachmentsPlural', '9.0.4');+VALUES ('20240917191243_1.4.1-RenameAttachmentsPlural', '10.0.10');BEGIN TRANSACTION;CREATE TABLE "TotpCodes" (@@ -248,8 +266,11 @@ CREATE TABLE "TotpCodes" (CREATE INDEX "IX_TotpCodes_CredentialId" ON "TotpCodes" ("CredentialId");INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")-VALUES ('20250310131554_1.5.0-AddTotpCodes', '9.0.4');+VALUES ('20250310131554_1.5.0-AddTotpCodes', '10.0.10');+COMMIT;++BEGIN TRANSACTION;PRAGMA foreign_keys = OFF;@@ -668,7 +689,7 @@ CREATE INDEX "IX_Passkeys_CredentialId" ON "Passkeys" ("CredentialId");CREATE INDEX "IX_Passkeys_RpId" ON "Passkeys" ("RpId");INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")-VALUES ('20251014122838_1.6.0-AddPasskeys', '9.0.4');+VALUES ('20251014122838_1.6.0-AddPasskeys', '10.0.10');COMMIT;@@ -1267,11 +1288,22 @@ CREATE INDEX "IX_TotpCodes_ItemId" ON "TotpCodes" ("ItemId");COMMIT;INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")-VALUES ('20251213111207_1.7.0-FieldBasedDataModelUpdate', '9.0.4');+VALUES ('20251213111207_1.7.0-FieldBasedDataModelUpdate', '10.0.10');BEGIN TRANSACTION;INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")-VALUES ('20260130221620_2.0.0-MajorVersionBump', '9.0.4');+VALUES ('20260130221620_2.0.0-MajorVersionBump', '10.0.10');++COMMIT;++BEGIN TRANSACTION;+CREATE TABLE "CodecOverflows" (+ "Id" TEXT NOT NULL CONSTRAINT "PK_CodecOverflows" PRIMARY KEY,+ "Data" TEXT NOT NULL+);++INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")+VALUES ('20260721081936_2.1.0-AddCodecOverflows', '10.0.10');COMMIT;diff --git a/apps/server/Databases/AliasClientDb/Scripts/README.md b/apps/server/Databases/AliasClientDb/Scripts/README.mdindex b88f4de63..f0c43368e 100644--- a/apps/server/Databases/AliasClientDb/Scripts/README.md+++ b/apps/server/Databases/AliasClientDb/Scripts/README.md@@ -4,4 +4,10 @@ This directory contains scripts to generate SQL files from Entity Framework CoreThis library is consumed by the web app, browser extensions and mobile apps for vault creation and upgrades.-Refer to the docs `upgrade-ef-client-model.md` for how this scripts are used.\ No newline at end of file+Refer to the docs `upgrade-ef-client-model.md` for how this scripts are used.++## The migration chain is frozen at vault version 2.0.0++Since the manifest-v1 storage model (vault version 2.0.0, revision 13) every vault pull re-materializes the local SQLite from the full schema (`000_FullSchema.sql` / `COMPLETE_SCHEMA_SQL`), so individual client migrations are no longer added after 2.0.0.++The individual migrations can be fully removed once all active users have migrated to 2.0.0+, as that version is compatible with the manifest-v1 structure.diff --git a/apps/server/Databases/AliasClientDb/Scripts/generate-sql-files.sh b/apps/server/Databases/AliasClientDb/Scripts/generate-sql-files.shindex a7356f614..c6346646b 100755--- a/apps/server/Databases/AliasClientDb/Scripts/generate-sql-files.sh+++ b/apps/server/Databases/AliasClientDb/Scripts/generate-sql-files.sh@@ -13,50 +13,12 @@ FULL_FILE="$OUTPUT_DIR/000_FullSchema.sql"# Create output directorymkdir -p "$OUTPUT_DIR"-# Use 'set --' to build a list of pending migrations into $1 $2 ...-set -- $(dotnet ef migrations list \+# Regenerate the full schema script.+echo "Generating full schema script..."+dotnet ef migrations script \--project "$PROJECT" \--startup-project "$STARTUP_PROJECT" \- --context "$CONTEXT" 2>/dev/null \- | grep '(Pending)' \- | sed 's/ (Pending)//')+ --context "$CONTEXT" \+ --output "$FULL_FILE"-TOTAL=$#--# Generate full script from scratch if any pending migrations exist-if [ "$TOTAL" -gt 0 ]; then- echo "Generating full schema script..."- dotnet ef migrations script \- --project "$PROJECT" \- --startup-project "$STARTUP_PROJECT" \- --context "$CONTEXT" \- --output "$FULL_FILE"-else- echo "No pending migrations found. Skipping full script."-fi--# Also generate per-migration scripts if enough exist-if [ "$TOTAL" -lt 2 ]; then- echo "Not enough pending migrations to generate step-by-step scripts."- exit 0-fi--# Loop over migration pairs-i=1-while [ "$i" -le "$TOTAL" ]; do- j=$((i + 1))- FROM=$(eval echo \${$i})- TO=$(eval echo \${$j})- FILE="$OUTPUT_DIR/$(printf "%03d" "$i")_${FROM}_to_${TO}.sql"-- echo "Generating script: $FROM -> $TO"- dotnet ef migrations script "$FROM" "$TO" \- --project "$PROJECT" \- --startup-project "$STARTUP_PROJECT" \- --context "$CONTEXT" \- --output "$FILE"-- i=$((i + 1))-done--echo "Done. Scripts written to $OUTPUT_DIR"\ No newline at end of file+echo "Done. Full schema written to $FULL_FILE"\ No newline at end of file