Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Recreate server migrations (#2159)

Leendert de Borsta10d555de06d
diff --git a/apps/server/Databases/AliasServerDb/Migrations/20260726192459_AddManifestStorage.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/20260726192459_AddManifestStorage.Designer.cs
deleted file mode 100644
index b2aa73870..000000000
--- a/apps/server/Databases/AliasServerDb/Migrations/20260726192459_AddManifestStorage.Designer.cs
+++ /dev/null
@@ -1,1488 +0,0 @@
-// <auto-generated />
-using System;
-using AliasServerDb;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
-
-#nullable disable
-
-namespace AliasServerDb.Migrations
-{
- [DbContext(typeof(AliasServerDbContext))]
- [Migration("20260726192459_AddManifestStorage")]
- partial class AddManifestStorage
- {
- /// <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)
- .HasAnnotation("Relational:MaxIdentifierLength", 63);
-
- NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
-
- modelBuilder.Entity("AliasServerDb.AdminRole", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("AdminRoles");
- });
-
- modelBuilder.Entity("AliasServerDb.AdminUser", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<int>("AccessFailedCount")
- .HasColumnType("integer");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<string>("Email")
- .HasColumnType("text");
-
- b.Property<bool>("EmailConfirmed")
- .HasColumnType("boolean");
-
- b.Property<DateTime?>("LastPasswordChanged")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("LockoutEnabled")
- .HasColumnType("boolean");
-
- b.Property<DateTimeOffset?>("LockoutEnd")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("NormalizedEmail")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedUserName")
- .HasColumnType("text");
-
- b.Property<string>("PasswordHash")
- .HasColumnType("text");
-
- b.Property<string>("PhoneNumber")
- .HasColumnType("text");
-
- b.Property<bool>("PhoneNumberConfirmed")
- .HasColumnType("boolean");
-
- b.Property<string>("SecurityStamp")
- .HasColumnType("text");
-
- b.Property<bool>("TwoFactorEnabled")
- .HasColumnType("boolean");
-
- b.Property<string>("UserName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("AdminUsers");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultRole", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("AliasVaultRoles");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<int>("AccessFailedCount")
- .HasColumnType("integer");
-
- b.Property<bool>("Blocked")
- .HasColumnType("boolean");
-
- b.Property<DateTime?>("BlockedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Email")
- .HasColumnType("text");
-
- b.Property<bool>("EmailConfirmed")
- .HasColumnType("boolean");
-
- b.Property<int>("EmailsReceived")
- .HasColumnType("integer");
-
- b.Property<DateTime?>("LastActivityDate")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("LockoutEnabled")
- .HasColumnType("boolean");
-
- b.Property<DateTimeOffset?>("LockoutEnd")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("MaxEmailAgeDays")
- .HasColumnType("integer");
-
- b.Property<int>("MaxEmails")
- .HasColumnType("integer");
-
- b.Property<string>("NormalizedEmail")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedUserName")
- .HasColumnType("text");
-
- b.Property<DateTime>("PasswordChangedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("PasswordHash")
- .HasColumnType("text");
-
- b.Property<string>("PhoneNumber")
- .HasColumnType("text");
-
- b.Property<bool>("PhoneNumberConfirmed")
- .HasColumnType("boolean");
-
- b.Property<string>("SecurityStamp")
- .HasColumnType("text");
-
- b.Property<bool>("ShadowBlocked")
- .HasColumnType("boolean");
-
- b.Property<DateTime?>("ShadowBlockedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("SrpIdentity")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<bool>("TwoFactorEnabled")
- .HasColumnType("boolean");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("AliasVaultUsers");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("DeviceIdentifier")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime>("ExpireDate")
- .HasMaxLength(255)
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("IpAddress")
- .HasMaxLength(45)
- .HasColumnType("character varying(45)");
-
- b.Property<string>("PreviousTokenValue")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Value")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId");
-
- b.ToTable("AliasVaultUserRefreshTokens");
- });
-
- modelBuilder.Entity("AliasServerDb.AuthLog", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("AdditionalInfo")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Browser")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("Client")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("Country")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("DeviceType")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<int>("EventType")
- .HasColumnType("integer");
-
- b.Property<int?>("FailureReason")
- .HasColumnType("integer");
-
- b.Property<string>("IpAddress")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<bool>("IsSuccess")
- .HasColumnType("boolean");
-
- b.Property<bool>("IsSuspiciousActivity")
- .HasColumnType("boolean");
-
- b.Property<string>("OperatingSystem")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("RequestPath")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<DateTime>("Timestamp")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Username")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex(new[] { "EventType" }, "IX_EventType");
-
- b.HasIndex(new[] { "IpAddress" }, "IX_IpAddress");
-
- b.HasIndex(new[] { "Timestamp" }, "IX_Timestamp");
-
- b.HasIndex(new[] { "Username", "IsSuccess", "Timestamp" }, "IX_Username_IsSuccess_Timestamp")
- .IsDescending(false, false, true);
-
- b.HasIndex(new[] { "Username", "Timestamp" }, "IX_Username_Timestamp")
- .IsDescending(false, true);
-
- b.ToTable("AuthLogs");
- });
-
- modelBuilder.Entity("AliasServerDb.BlockedIpRange", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<bool>("BlockLogin")
- .HasColumnType("boolean");
-
- b.Property<bool>("BlockRegistration")
- .HasColumnType("boolean");
-
- b.Property<bool>("BlockShadow")
- .HasColumnType("boolean");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("CreatedBy")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<bool>("Enabled")
- .HasColumnType("boolean");
-
- b.Property<string>("IpRange")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("Reason")
- .HasMaxLength(500)
- .HasColumnType("character varying(500)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("Id");
-
- b.HasIndex(new[] { "Enabled" }, "IX_BlockedIpRange_Enabled");
-
- b.HasIndex(new[] { "IpRange" }, "IX_BlockedIpRange_IpRange")
- .IsUnique();
-
- b.ToTable("BlockedIpRanges");
- });
-
- modelBuilder.Entity("AliasServerDb.Email", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<DateTime>("Date")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime>("DateSystem")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedSymmetricKey")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("From")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("FromDomain")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("FromLocal")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("MessageHtml")
- .HasColumnType("text");
-
- b.Property<string>("MessagePlain")
- .HasColumnType("text");
-
- b.Property<string>("MessagePreview")
- .HasColumnType("text");
-
- b.Property<string>("MessageSource")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<bool>("PushNotificationSent")
- .HasColumnType("boolean");
-
- b.Property<string>("Subject")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("To")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("ToDomain")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("ToLocal")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<Guid>("UserEncryptionKeyId")
- .HasMaxLength(255)
- .HasColumnType("uuid");
-
- b.Property<bool>("Visible")
- .HasColumnType("boolean");
-
- b.HasKey("Id");
-
- b.HasIndex("Date");
-
- b.HasIndex("DateSystem");
-
- b.HasIndex("PushNotificationSent");
-
- b.HasIndex("UserEncryptionKeyId");
-
- b.HasIndex("Visible");
-
- b.HasIndex("To", "DateSystem");
-
- b.ToTable("Emails");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailAttachment", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<byte[]>("Bytes")
- .IsRequired()
- .HasColumnType("bytea");
-
- b.Property<DateTime>("Date")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("EmailId")
- .HasColumnType("integer");
-
- b.Property<string>("Filename")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<int>("Filesize")
- .HasColumnType("integer");
-
- b.Property<string>("MimeType")
- .IsRequired()
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.HasIndex("EmailId");
-
- b.ToTable("EmailAttachments");
- });
-
- modelBuilder.Entity("AliasServerDb.Log", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("Application")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("Exception")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Level")
- .IsRequired()
- .HasMaxLength(128)
- .HasColumnType("character varying(128)");
-
- b.Property<string>("LogEvent")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("LogEvent");
-
- b.Property<string>("Message")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("MessageTemplate")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Properties")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("SourceContext")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("TimeStamp")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("Id");
-
- b.HasIndex("Application");
-
- b.HasIndex("TimeStamp");
-
- b.ToTable("Logs", (string)null);
- });
-
- modelBuilder.Entity("AliasServerDb.MobileLoginRequest", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<DateTime?>("ClearedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("ClientIpAddress")
- .HasColumnType("text");
-
- b.Property<string>("ClientPublicKey")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedDecryptionKey")
- .HasColumnType("text");
-
- b.Property<DateTime?>("FulfilledAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("MobileIpAddress")
- .HasColumnType("text");
-
- b.Property<DateTime?>("RetrievedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.HasIndex(new[] { "ClientIpAddress" }, "IX_ClientIpAddress");
-
- b.HasIndex(new[] { "CreatedAt" }, "IX_CreatedAt");
-
- b.HasIndex(new[] { "MobileIpAddress" }, "IX_MobileIpAddress");
-
- b.HasIndex(new[] { "RetrievedAt", "ClearedAt", "FulfilledAt" }, "IX_RetrievedAt_ClearedAt_FulfilledAt");
-
- b.HasIndex(new[] { "UserId" }, "IX_UserId");
-
- b.ToTable("MobileLoginRequests");
- });
-
- modelBuilder.Entity("AliasServerDb.RateLimit", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<int?>("AppliesToAccountAgeMaxDays")
- .HasColumnType("integer");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("CreatedBy")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime?>("EffectiveFrom")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime?>("EffectiveUntil")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("Enabled")
- .HasColumnType("boolean");
-
- b.Property<int>("LimitType")
- .HasColumnType("integer");
-
- b.Property<int>("MaxCount")
- .HasColumnType("integer");
-
- b.Property<string>("Notes")
- .HasMaxLength(1000)
- .HasColumnType("character varying(1000)");
-
- b.Property<int?>("Tier")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<int>("WindowSeconds")
- .HasColumnType("integer");
-
- b.HasKey("Id");
-
- b.HasIndex("Tier");
-
- b.HasIndex("UserId");
-
- b.HasIndex("LimitType", "Enabled");
-
- b.ToTable("RateLimits");
- });
-
- modelBuilder.Entity("AliasServerDb.ServerSetting", b =>
- {
- b.Property<string>("Key")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Value")
- .HasColumnType("text");
-
- b.HasKey("Key");
-
- b.ToTable("ServerSettings");
- });
-
- modelBuilder.Entity("AliasServerDb.TaskRunnerJob", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<TimeOnly?>("EndTime")
- .HasColumnType("time without time zone");
-
- b.Property<string>("ErrorMessage")
- .HasColumnType("text");
-
- b.Property<bool>("IsOnDemand")
- .HasColumnType("boolean");
-
- b.Property<string>("Name")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<DateTime>("RunDate")
- .HasColumnType("timestamp with time zone");
-
- b.Property<TimeOnly>("StartTime")
- .HasColumnType("time without time zone");
-
- b.Property<int>("Status")
- .HasColumnType("integer");
-
- b.HasKey("Id");
-
- b.ToTable("TaskRunnerJobs");
- });
-
- modelBuilder.Entity("AliasServerDb.UserEmailClaim", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Address")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("AddressDomain")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("AddressLocal")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("Disabled")
- .HasColumnType("boolean");
-
- b.Property<Guid?>("EncryptionKeyId")
- .HasColumnType("uuid");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("Address")
- .IsUnique();
-
- b.HasIndex("EncryptionKeyId");
-
- b.HasIndex("UserId", "CreatedAt");
-
- b.HasIndex("UserId", "Disabled");
-
- b.ToTable("UserEmailClaims");
- });
-
- modelBuilder.Entity("AliasServerDb.UserEncryptionKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("IsPrimary")
- .HasColumnType("boolean");
-
- b.Property<string>("PublicKey")
- .IsRequired()
- .HasMaxLength(2000)
- .HasColumnType("character varying(2000)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<Guid?>("VaultManifestId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("VaultManifestId");
-
- b.HasIndex("UserId", "VaultManifestId", "IsPrimary");
-
- b.ToTable("UserEncryptionKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobObject", b =>
- {
- b.Property<string>("Hash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<string>("OwnerUserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Category")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<byte[]>("EncryptedData")
- .IsRequired()
- .HasColumnType("bytea");
-
- b.Property<DateTime>("LastReferencedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("SizeBytes")
- .HasColumnType("integer");
-
- b.HasKey("Hash", "OwnerUserId");
-
- b.HasIndex("OwnerUserId", "Category");
-
- b.ToTable("VaultBlobObjects");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobReference", b =>
- {
- b.Property<Guid>("ManifestId")
- .HasColumnType("uuid");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("BlobHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.HasKey("ManifestId", "RevisionNumber", "BlobHash");
-
- b.ToTable("VaultBlobReferences");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucket", b =>
- {
- b.Property<string>("OwnerUserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Category")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("CiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedData")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("OwnerUserId", "Category");
-
- b.ToTable("VaultDataBuckets");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucketsHistory", b =>
- {
- b.Property<string>("OwnerUserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Category")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("CiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedData")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("OwnerUserId", "Category", "RevisionNumber");
-
- b.ToTable("VaultDataBucketsHistory");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid?>("EncryptionKeyId")
- .HasColumnType("uuid");
-
- b.Property<int>("Type")
- .HasColumnType("integer");
-
- b.Property<DateTime?>("LastUsedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Metadata")
- .HasColumnType("jsonb");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<Guid>("VaultManifestId")
- .HasColumnType("uuid");
-
- b.Property<string>("Algorithm")
- .IsRequired()
- .HasMaxLength(30)
- .HasColumnType("character varying(30)");
-
- b.Property<string>("EncryptedVek")
- .IsRequired()
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.HasIndex("EncryptionKeyId");
-
- b.HasIndex("VaultManifestId")
- .HasDatabaseName("IX_VaultKeys_VaultManifestId");
-
- b.HasIndex("UserId", "Type", "VaultManifestId")
- .IsUnique()
- .HasDatabaseName("UX_VaultKeys_UserId_Type_Manifest");
-
- b.ToTable("VaultKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifest", b =>
- {
- b.Property<Guid>("ManifestId")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Client")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("CredentialsCount")
- .HasColumnType("integer");
-
- b.Property<int>("EmailClaimsCount")
- .HasColumnType("integer");
-
- b.Property<string>("EncryptionSettings")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("EncryptionType")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<int>("FileSize")
- .HasColumnType("integer");
-
- b.Property<bool>("IsRoot")
- .HasColumnType("boolean");
-
- b.Property<string>("ManifestBlob")
- .HasColumnType("text");
-
- b.Property<string>("ManifestCiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<string>("Name")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("OwnerUserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("Salt")
- .IsRequired()
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("StorageFormat")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("VaultBlob")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Verifier")
- .IsRequired()
- .HasMaxLength(1000)
- .HasColumnType("character varying(1000)");
-
- b.Property<string>("Version")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("ManifestId");
-
- b.HasIndex("OwnerUserId")
- .IsUnique()
- .HasDatabaseName("UX_VaultManifests_OwnerUserId_Root")
- .HasFilter("\"IsRoot\"");
-
- b.ToTable("VaultManifests");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestsHistory", b =>
- {
- b.Property<Guid>("ManifestId")
- .HasColumnType("uuid");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("Client")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("CredentialsCount")
- .HasColumnType("integer");
-
- b.Property<int>("EmailClaimsCount")
- .HasColumnType("integer");
-
- b.Property<string>("EncryptionSettings")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("EncryptionType")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<int>("FileSize")
- .HasColumnType("integer");
-
- b.Property<string>("ManifestBlob")
- .HasColumnType("text");
-
- b.Property<string>("ManifestCiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<string>("OwnerUserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Salt")
- .IsRequired()
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("StorageFormat")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("VaultBlob")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Verifier")
- .IsRequired()
- .HasMaxLength(1000)
- .HasColumnType("character varying(1000)");
-
- b.Property<string>("Version")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("ManifestId", "RevisionNumber");
-
- b.HasIndex("OwnerUserId");
-
- b.ToTable("VaultManifestsHistory", (string)null);
- });
-
- modelBuilder.Entity("AliasVault.WorkerStatus.Database.WorkerServiceStatus", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("CurrentStatus")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("DesiredStatus")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<DateTime>("Heartbeat")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("ServiceName")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.ToTable("WorkerServiceStatuses");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("FriendlyName")
- .HasColumnType("text");
-
- b.Property<string>("Xml")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("DataProtectionKeys");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("ClaimType")
- .HasColumnType("text");
-
- b.Property<string>("ClaimValue")
- .HasColumnType("text");
-
- b.Property<string>("RoleId")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("RoleClaims", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("ClaimType")
- .HasColumnType("text");
-
- b.Property<string>("ClaimValue")
- .HasColumnType("text");
-
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("UserClaims", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
- {
- b.Property<string>("LoginProvider")
- .HasColumnType("text");
-
- b.Property<string>("ProviderKey")
- .HasColumnType("text");
-
- b.Property<string>("ProviderDisplayName")
- .HasColumnType("text");
-
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.HasKey("LoginProvider", "ProviderKey");
-
- b.ToTable("UserLogins", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
- {
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.Property<string>("RoleId")
- .HasColumnType("text");
-
- b.HasKey("UserId", "RoleId");
-
- b.ToTable("UserRoles", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
- {
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.Property<string>("LoginProvider")
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.Property<string>("Value")
- .HasColumnType("text");
-
- b.HasKey("UserId", "LoginProvider", "Name");
-
- b.ToTable("UserTokens", (string)null);
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.Email", b =>
- {
- b.HasOne("AliasServerDb.UserEncryptionKey", "EncryptionKey")
- .WithMany("Emails")
- .HasForeignKey("UserEncryptionKeyId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("EncryptionKey");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailAttachment", b =>
- {
- b.HasOne("AliasServerDb.Email", "Email")
- .WithMany("Attachments")
- .HasForeignKey("EmailId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Email");
- });
-
- modelBuilder.Entity("AliasServerDb.MobileLoginRequest", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.RateLimit", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.UserEmailClaim", b =>
- {
- b.HasOne("AliasServerDb.UserEncryptionKey", "EncryptionKey")
- .WithMany()
- .HasForeignKey("EncryptionKeyId")
- .OnDelete(DeleteBehavior.Restrict);
-
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany("EmailClaims")
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.SetNull);
-
- b.Navigation("EncryptionKey");
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.UserEncryptionKey", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany("EncryptionKeys")
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("AliasServerDb.VaultManifest", "VaultManifest")
- .WithMany()
- .HasForeignKey("VaultManifestId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.Navigation("User");
-
- b.Navigation("VaultManifest");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobObject", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("OwnerUserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobReference", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "Manifest")
- .WithMany()
- .HasForeignKey("ManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Manifest");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucket", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("OwnerUserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucketsHistory", b =>
- {
- b.HasOne("AliasServerDb.VaultDataBucket", "Bucket")
- .WithMany()
- .HasForeignKey("OwnerUserId", "Category")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Bucket");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultKey", b =>
- {
- b.HasOne("AliasServerDb.EncryptionKey", "EncryptionKey")
- .WithMany()
- .HasForeignKey("EncryptionKeyId")
- .OnDelete(DeleteBehavior.SetNull);
-
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany("VaultKeys")
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("EncryptionKey");
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifest", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany("VaultManifests")
- .HasForeignKey("OwnerUserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestsHistory", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "Manifest")
- .WithMany()
- .HasForeignKey("ManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Manifest");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>
- {
- b.Navigation("EmailClaims");
-
- b.Navigation("EncryptionKeys");
-
- b.Navigation("VaultKeys");
-
- b.Navigation("VaultManifests");
- });
-
- modelBuilder.Entity("AliasServerDb.Email", b =>
- {
- b.Navigation("Attachments");
- });
-
- modelBuilder.Entity("AliasServerDb.UserEncryptionKey", b =>
- {
- b.Navigation("Emails");
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/apps/server/Databases/AliasServerDb/Migrations/20260726192459_AddManifestStorage.cs b/apps/server/Databases/AliasServerDb/Migrations/20260726192459_AddManifestStorage.cs
deleted file mode 100644
index d20c30aef..000000000
--- a/apps/server/Databases/AliasServerDb/Migrations/20260726192459_AddManifestStorage.cs
+++ /dev/null
@@ -1,377 +0,0 @@
-using System;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-#nullable disable
-
-namespace AliasServerDb.Migrations
-{
- /// <summary>
- /// Adds the manifest storage model to the database.
- /// </summary>
- public partial class AddManifestStorage : Migration
- {
- /// <inheritdoc />
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- // --- 1. Rename "Vaults" -> "VaultManifests", including its constraints. ---
- migrationBuilder.DropIndex(name: "IX_Vaults_UserId", table: "Vaults");
- migrationBuilder.RenameTable(name: "Vaults", newName: "VaultManifests");
- migrationBuilder.RenameColumn(name: "UserId", table: "VaultManifests", newName: "OwnerUserId");
- migrationBuilder.Sql(@"ALTER TABLE ""VaultManifests"" RENAME CONSTRAINT ""PK_Vaults"" TO ""PK_VaultManifests"";");
- migrationBuilder.Sql(@"ALTER TABLE ""VaultManifests"" RENAME CONSTRAINT ""FK_Vaults_AliasVaultUsers_UserId"" TO ""FK_VaultManifests_AliasVaultUsers_OwnerUserId"";");
-
- // --- 2. New manifest table columns. ---
- migrationBuilder.AddColumn<Guid>(name: "ManifestId", table: "VaultManifests", type: "uuid", nullable: true);
- migrationBuilder.AddColumn<string>(name: "Name", table: "VaultManifests", type: "character varying(255)", maxLength: 255, nullable: true);
- migrationBuilder.AddColumn<string>(name: "ManifestBlob", table: "VaultManifests", type: "text", nullable: true);
- migrationBuilder.AddColumn<string>(name: "ManifestCiphertextHash", table: "VaultManifests", type: "character varying(64)", maxLength: 64, nullable: true);
- migrationBuilder.AddColumn<string>(name: "StorageFormat", table: "VaultManifests", type: "character varying(20)", maxLength: 20, nullable: true);
- migrationBuilder.AddColumn<bool>(name: "IsRoot", table: "VaultManifests", type: "boolean", nullable: false, defaultValue: false);
-
- migrationBuilder.Sql(@"UPDATE ""VaultManifests"" SET ""StorageFormat"" = 'sqlite-blob', ""IsRoot"" = TRUE;");
- migrationBuilder.Sql(@"ALTER TABLE ""VaultManifests"" ALTER COLUMN ""IsRoot"" DROP DEFAULT;");
-
- migrationBuilder.Sql(@"
- UPDATE ""VaultManifests"" v SET ""ManifestId"" = sub.gid
- FROM (SELECT ""OwnerUserId"", gen_random_uuid() AS gid FROM ""VaultManifests"" GROUP BY ""OwnerUserId"") sub
- WHERE v.""OwnerUserId"" = sub.""OwnerUserId"";");
-
- migrationBuilder.AlterColumn<string>(
- name: "StorageFormat",
- table: "VaultManifests",
- type: "character varying(20)",
- maxLength: 20,
- nullable: false,
- oldClrType: typeof(string),
- oldType: "character varying(20)",
- oldMaxLength: 20,
- oldNullable: true);
-
- migrationBuilder.AlterColumn<Guid>(
- name: "ManifestId",
- table: "VaultManifests",
- type: "uuid",
- nullable: false,
- oldClrType: typeof(Guid),
- oldType: "uuid",
- oldNullable: true);
-
- // --- 3. Manifest history table. ---
- migrationBuilder.CreateTable(
- name: "VaultManifestsHistory",
- columns: table => new
- {
- RevisionNumber = table.Column<long>(type: "bigint", nullable: false),
- ManifestId = table.Column<Guid>(type: "uuid", nullable: false),
- OwnerUserId = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
- VaultBlob = table.Column<string>(type: "text", nullable: false),
- StorageFormat = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),
- ManifestBlob = table.Column<string>(type: "text", nullable: true),
- ManifestCiphertextHash = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true),
- Version = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
- FileSize = table.Column<int>(type: "integer", nullable: false),
- Salt = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
- Verifier = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: false),
- CredentialsCount = table.Column<int>(type: "integer", nullable: false),
- EmailClaimsCount = table.Column<int>(type: "integer", nullable: false),
- EncryptionType = table.Column<string>(type: "text", nullable: false),
- EncryptionSettings = table.Column<string>(type: "text", nullable: false),
- Client = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true),
- CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
- UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_VaultManifestsHistory", x => new { x.ManifestId, x.RevisionNumber });
- });
-
- // --- 4. Fill manifest history table based on non-current revisions of the old Vaults table. ---
- migrationBuilder.Sql(@"
- INSERT INTO ""VaultManifestsHistory"" (""ManifestId"", ""RevisionNumber"", ""OwnerUserId"", ""VaultBlob"", ""StorageFormat"", ""ManifestBlob"", ""ManifestCiphertextHash"", ""Version"", ""FileSize"", ""Salt"", ""Verifier"", ""CredentialsCount"", ""EmailClaimsCount"", ""EncryptionType"", ""EncryptionSettings"", ""Client"", ""CreatedAt"", ""UpdatedAt"")
- SELECT ""ManifestId"", ""RevisionNumber"", ""OwnerUserId"", ""VaultBlob"", ""StorageFormat"", ""ManifestBlob"", ""ManifestCiphertextHash"", ""Version"", ""FileSize"", ""Salt"", ""Verifier"", ""CredentialsCount"", ""EmailClaimsCount"", ""EncryptionType"", ""EncryptionSettings"", ""Client"", ""CreatedAt"", ""UpdatedAt""
- FROM (
- SELECT v.*, ROW_NUMBER() OVER (PARTITION BY ""ManifestId"" ORDER BY ""RevisionNumber"" DESC, ""CreatedAt"" DESC, ""Id"" DESC) AS rn
- FROM ""VaultManifests"" v
- ) ranked
- WHERE ranked.rn > 1
- ON CONFLICT (""ManifestId"", ""RevisionNumber"") DO NOTHING;");
-
- migrationBuilder.Sql(@"
- DELETE FROM ""VaultManifests"" v
- USING (
- SELECT ""Id"", ROW_NUMBER() OVER (PARTITION BY ""ManifestId"" ORDER BY ""RevisionNumber"" DESC, ""CreatedAt"" DESC, ""Id"" DESC) AS rn
- FROM ""VaultManifests""
- ) ranked
- WHERE v.""Id"" = ranked.""Id"" AND ranked.rn > 1;");
-
- // --- 5. Swap the per-revision key for the manifest key. ---
- migrationBuilder.DropPrimaryKey(name: "PK_VaultManifests", table: "VaultManifests");
- migrationBuilder.DropColumn(name: "Id", table: "VaultManifests");
- migrationBuilder.AddPrimaryKey(name: "PK_VaultManifests", table: "VaultManifests", column: "ManifestId");
-
- // Every user has exactly one root manifest.
- migrationBuilder.CreateIndex(
- name: "UX_VaultManifests_OwnerUserId_Root",
- table: "VaultManifests",
- column: "OwnerUserId",
- unique: true,
- filter: "\"IsRoot\"");
-
- migrationBuilder.CreateIndex(
- name: "IX_VaultManifestsHistory_OwnerUserId",
- table: "VaultManifestsHistory",
- column: "OwnerUserId");
-
- // Now that the referenced key exists, tie history rows to their manifest.
- migrationBuilder.AddForeignKey(
- name: "FK_VaultManifestsHistory_VaultManifests_ManifestId",
- table: "VaultManifestsHistory",
- column: "ManifestId",
- principalTable: "VaultManifests",
- principalColumn: "ManifestId",
- onDelete: ReferentialAction.Cascade);
-
- // --- 6. New tables. ---
- migrationBuilder.CreateTable(
- name: "VaultBlobObjects",
- columns: table => new
- {
- Hash = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
- OwnerUserId = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
- Category = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),
- EncryptedData = table.Column<byte[]>(type: "bytea", nullable: false),
- SizeBytes = table.Column<int>(type: "integer", nullable: false),
- CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
- LastReferencedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_VaultBlobObjects", x => new { x.Hash, x.OwnerUserId });
- table.ForeignKey(
- name: "FK_VaultBlobObjects_AliasVaultUsers_OwnerUserId",
- column: x => x.OwnerUserId,
- principalTable: "AliasVaultUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateTable(
- name: "VaultDataBuckets",
- columns: table => new
- {
- OwnerUserId = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
- Category = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
- EncryptedData = table.Column<string>(type: "text", nullable: false),
- RevisionNumber = table.Column<long>(type: "bigint", nullable: false),
- CiphertextHash = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true),
- CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
- UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_VaultDataBuckets", x => new { x.OwnerUserId, x.Category });
- table.ForeignKey(
- name: "FK_VaultDataBuckets_AliasVaultUsers_OwnerUserId",
- column: x => x.OwnerUserId,
- principalTable: "AliasVaultUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateTable(
- name: "VaultDataBucketsHistory",
- columns: table => new
- {
- RevisionNumber = table.Column<long>(type: "bigint", nullable: false),
- OwnerUserId = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
- Category = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
- EncryptedData = table.Column<string>(type: "text", nullable: false),
- CiphertextHash = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true),
- CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
- UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_VaultDataBucketsHistory", x => new { x.OwnerUserId, x.Category, x.RevisionNumber });
- table.ForeignKey(
- name: "FK_VaultDataBucketsHistory_VaultDataBuckets_OwnerUserId_Catego~",
- columns: x => new { x.OwnerUserId, x.Category },
- principalTable: "VaultDataBuckets",
- principalColumns: new[] { "OwnerUserId", "Category" },
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateTable(
- name: "VaultKeys",
- columns: table => new
- {
- Id = table.Column<Guid>(type: "uuid", nullable: false),
- UserId = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
- VaultManifestId = table.Column<Guid>(type: "uuid", nullable: false),
- Type = table.Column<int>(type: "integer", nullable: false),
- Algorithm = table.Column<string>(type: "character varying(30)", maxLength: 30, nullable: false),
- EncryptedVek = table.Column<string>(type: "text", nullable: false),
- EncryptionKeyId = table.Column<Guid>(type: "uuid", nullable: true),
- Metadata = table.Column<string>(type: "jsonb", nullable: true),
- CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
- UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
- LastUsedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_VaultKeys", x => x.Id);
- table.ForeignKey(
- name: "FK_VaultKeys_AliasVaultUsers_UserId",
- column: x => x.UserId,
- principalTable: "AliasVaultUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- table.ForeignKey(
- name: "FK_VaultKeys_UserEncryptionKeys_EncryptionKeyId",
- column: x => x.EncryptionKeyId,
- principalTable: "UserEncryptionKeys",
- principalColumn: "Id",
- onDelete: ReferentialAction.SetNull);
- });
-
- migrationBuilder.CreateTable(
- name: "VaultBlobReferences",
- columns: table => new
- {
- ManifestId = table.Column<Guid>(type: "uuid", nullable: false),
- RevisionNumber = table.Column<long>(type: "bigint", nullable: false),
- BlobHash = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_VaultBlobReferences", x => new { x.ManifestId, x.RevisionNumber, x.BlobHash });
- table.ForeignKey(
- name: "FK_VaultBlobReferences_VaultManifests_ManifestId",
- column: x => x.ManifestId,
- principalTable: "VaultManifests",
- principalColumn: "ManifestId",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateIndex(
- name: "IX_VaultBlobObjects_OwnerUserId_Category",
- table: "VaultBlobObjects",
- columns: new[] { "OwnerUserId", "Category" });
-
- migrationBuilder.CreateIndex(
- name: "IX_VaultKeys_VaultManifestId",
- table: "VaultKeys",
- column: "VaultManifestId");
-
- migrationBuilder.CreateIndex(
- name: "IX_VaultKeys_EncryptionKeyId",
- table: "VaultKeys",
- column: "EncryptionKeyId");
-
- migrationBuilder.CreateIndex(
- name: "UX_VaultKeys_UserId_Type_Manifest",
- table: "VaultKeys",
- columns: new[] { "UserId", "Type", "VaultManifestId" },
- unique: true);
-
- // --- 7. Email encryption keys become per-manifest, and claims record which key they were issued under. ---
- migrationBuilder.DropIndex(
- name: "IX_UserEncryptionKeys_UserId",
- table: "UserEncryptionKeys");
-
- migrationBuilder.AddColumn<Guid>(
- name: "VaultManifestId",
- table: "UserEncryptionKeys",
- type: "uuid",
- nullable: true);
-
- migrationBuilder.AddColumn<Guid>(
- name: "EncryptionKeyId",
- table: "UserEmailClaims",
- type: "uuid",
- nullable: true);
-
- migrationBuilder.CreateIndex(
- name: "IX_UserEncryptionKeys_UserId_VaultManifestId_IsPrimary",
- table: "UserEncryptionKeys",
- columns: new[] { "UserId", "VaultManifestId", "IsPrimary" });
-
- migrationBuilder.CreateIndex(
- name: "IX_UserEncryptionKeys_VaultManifestId",
- table: "UserEncryptionKeys",
- column: "VaultManifestId");
-
- migrationBuilder.CreateIndex(
- name: "IX_UserEmailClaims_EncryptionKeyId",
- table: "UserEmailClaims",
- column: "EncryptionKeyId");
-
- migrationBuilder.AddForeignKey(
- name: "FK_UserEmailClaims_UserEncryptionKeys_EncryptionKeyId",
- table: "UserEmailClaims",
- column: "EncryptionKeyId",
- principalTable: "UserEncryptionKeys",
- principalColumn: "Id",
- onDelete: ReferentialAction.Restrict);
-
- migrationBuilder.AddForeignKey(
- name: "FK_UserEncryptionKeys_VaultManifests_VaultManifestId",
- table: "UserEncryptionKeys",
- column: "VaultManifestId",
- principalTable: "VaultManifests",
- principalColumn: "ManifestId",
- onDelete: ReferentialAction.Cascade);
- }
-
- /// <inheritdoc />
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- // Undo the email encryption key changes.
- migrationBuilder.DropForeignKey(name: "FK_UserEmailClaims_UserEncryptionKeys_EncryptionKeyId", table: "UserEmailClaims");
- migrationBuilder.DropForeignKey(name: "FK_UserEncryptionKeys_VaultManifests_VaultManifestId", table: "UserEncryptionKeys");
- migrationBuilder.DropIndex(name: "IX_UserEncryptionKeys_UserId_VaultManifestId_IsPrimary", table: "UserEncryptionKeys");
- migrationBuilder.DropIndex(name: "IX_UserEncryptionKeys_VaultManifestId", table: "UserEncryptionKeys");
- migrationBuilder.DropIndex(name: "IX_UserEmailClaims_EncryptionKeyId", table: "UserEmailClaims");
- migrationBuilder.DropColumn(name: "VaultManifestId", table: "UserEncryptionKeys");
- migrationBuilder.DropColumn(name: "EncryptionKeyId", table: "UserEmailClaims");
- migrationBuilder.CreateIndex(name: "IX_UserEncryptionKeys_UserId", table: "UserEncryptionKeys", column: "UserId");
-
- // Drop the tables that had no pre-V2 equivalent (dependents first).
- migrationBuilder.DropTable(name: "VaultBlobReferences");
- migrationBuilder.DropTable(name: "VaultBlobObjects");
- migrationBuilder.DropTable(name: "VaultDataBucketsHistory");
- migrationBuilder.DropTable(name: "VaultDataBuckets");
- migrationBuilder.DropTable(name: "VaultKeys");
-
- // Re-materialize the revision log: restore the per-revision key, then fold history rows back in.
- migrationBuilder.DropForeignKey(name: "FK_VaultManifestsHistory_VaultManifests_ManifestId", table: "VaultManifestsHistory");
- migrationBuilder.DropIndex(name: "UX_VaultManifests_OwnerUserId_Root", table: "VaultManifests");
- migrationBuilder.Sql(@"ALTER TABLE ""VaultManifests"" ADD COLUMN ""Id"" uuid NOT NULL DEFAULT gen_random_uuid();");
- migrationBuilder.DropPrimaryKey(name: "PK_VaultManifests", table: "VaultManifests");
- migrationBuilder.AddPrimaryKey(name: "PK_VaultManifests", table: "VaultManifests", column: "Id");
-
- migrationBuilder.Sql(@"
- INSERT INTO ""VaultManifests"" (""Id"", ""ManifestId"", ""IsRoot"", ""Name"", ""OwnerUserId"", ""VaultBlob"", ""StorageFormat"", ""ManifestBlob"", ""ManifestCiphertextHash"", ""Version"", ""RevisionNumber"", ""FileSize"", ""Salt"", ""Verifier"", ""CredentialsCount"", ""EmailClaimsCount"", ""EncryptionType"", ""EncryptionSettings"", ""Client"", ""CreatedAt"", ""UpdatedAt"")
- SELECT gen_random_uuid(), h.""ManifestId"", m.""IsRoot"", m.""Name"", h.""OwnerUserId"", h.""VaultBlob"", h.""StorageFormat"", h.""ManifestBlob"", h.""ManifestCiphertextHash"", h.""Version"", h.""RevisionNumber"", h.""FileSize"", h.""Salt"", h.""Verifier"", h.""CredentialsCount"", h.""EmailClaimsCount"", h.""EncryptionType"", h.""EncryptionSettings"", h.""Client"", h.""CreatedAt"", h.""UpdatedAt""
- FROM ""VaultManifestsHistory"" h
- INNER JOIN ""VaultManifests"" m ON m.""ManifestId"" = h.""ManifestId"";");
-
- migrationBuilder.DropTable(name: "VaultManifestsHistory");
- migrationBuilder.Sql(@"ALTER TABLE ""VaultManifests"" ALTER COLUMN ""Id"" DROP DEFAULT;");
-
- migrationBuilder.DropColumn(name: "ManifestId", table: "VaultManifests");
- migrationBuilder.DropColumn(name: "IsRoot", table: "VaultManifests");
- migrationBuilder.DropColumn(name: "Name", table: "VaultManifests");
- migrationBuilder.DropColumn(name: "StorageFormat", table: "VaultManifests");
- migrationBuilder.DropColumn(name: "ManifestBlob", table: "VaultManifests");
- migrationBuilder.DropColumn(name: "ManifestCiphertextHash", table: "VaultManifests");
-
- // Rename "VaultManifests" back to "Vaults" in place.
- migrationBuilder.Sql(@"ALTER TABLE ""VaultManifests"" RENAME CONSTRAINT ""FK_VaultManifests_AliasVaultUsers_OwnerUserId"" TO ""FK_Vaults_AliasVaultUsers_UserId"";");
- migrationBuilder.Sql(@"ALTER TABLE ""VaultManifests"" RENAME CONSTRAINT ""PK_VaultManifests"" TO ""PK_Vaults"";");
- migrationBuilder.RenameColumn(name: "OwnerUserId", table: "VaultManifests", newName: "UserId");
- migrationBuilder.RenameTable(name: "VaultManifests", newName: "Vaults");
- migrationBuilder.CreateIndex(name: "IX_Vaults_UserId", table: "Vaults", column: "UserId");
- }
- }
-}
diff --git a/apps/server/Databases/AliasServerDb/Migrations/20260728102956_AddGroupsAndSharedOwnership.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/20260728102956_AddGroupsAndSharedOwnership.Designer.cs
deleted file mode 100644
index 3408ded5e..000000000
--- a/apps/server/Databases/AliasServerDb/Migrations/20260728102956_AddGroupsAndSharedOwnership.Designer.cs
+++ /dev/null
@@ -1,1584 +0,0 @@
-// <auto-generated />
-using System;
-using AliasServerDb;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
-
-#nullable disable
-
-namespace AliasServerDb.Migrations
-{
- [DbContext(typeof(AliasServerDbContext))]
- [Migration("20260728102956_AddGroupsAndSharedOwnership")]
- partial class AddGroupsAndSharedOwnership
- {
- /// <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)
- .HasAnnotation("Relational:MaxIdentifierLength", 63);
-
- NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
-
- modelBuilder.Entity("AliasServerDb.AdminRole", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("AdminRoles");
- });
-
- modelBuilder.Entity("AliasServerDb.AdminUser", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<int>("AccessFailedCount")
- .HasColumnType("integer");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<string>("Email")
- .HasColumnType("text");
-
- b.Property<bool>("EmailConfirmed")
- .HasColumnType("boolean");
-
- b.Property<DateTime?>("LastPasswordChanged")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("LockoutEnabled")
- .HasColumnType("boolean");
-
- b.Property<DateTimeOffset?>("LockoutEnd")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("NormalizedEmail")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedUserName")
- .HasColumnType("text");
-
- b.Property<string>("PasswordHash")
- .HasColumnType("text");
-
- b.Property<string>("PhoneNumber")
- .HasColumnType("text");
-
- b.Property<bool>("PhoneNumberConfirmed")
- .HasColumnType("boolean");
-
- b.Property<string>("SecurityStamp")
- .HasColumnType("text");
-
- b.Property<bool>("TwoFactorEnabled")
- .HasColumnType("boolean");
-
- b.Property<string>("UserName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("AdminUsers");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultRole", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("AliasVaultRoles");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<int>("AccessFailedCount")
- .HasColumnType("integer");
-
- b.Property<bool>("Blocked")
- .HasColumnType("boolean");
-
- b.Property<DateTime?>("BlockedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Email")
- .HasColumnType("text");
-
- b.Property<bool>("EmailConfirmed")
- .HasColumnType("boolean");
-
- b.Property<int>("EmailsReceived")
- .HasColumnType("integer");
-
- b.Property<DateTime?>("LastActivityDate")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("LockoutEnabled")
- .HasColumnType("boolean");
-
- b.Property<DateTimeOffset?>("LockoutEnd")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("MaxEmailAgeDays")
- .HasColumnType("integer");
-
- b.Property<int>("MaxEmails")
- .HasColumnType("integer");
-
- b.Property<string>("NormalizedEmail")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedUserName")
- .HasColumnType("text");
-
- b.Property<DateTime>("PasswordChangedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("PasswordHash")
- .HasColumnType("text");
-
- b.Property<Guid>("PersonalGroupId")
- .HasColumnType("uuid");
-
- b.Property<string>("PhoneNumber")
- .HasColumnType("text");
-
- b.Property<bool>("PhoneNumberConfirmed")
- .HasColumnType("boolean");
-
- b.Property<string>("SecurityStamp")
- .HasColumnType("text");
-
- b.Property<bool>("ShadowBlocked")
- .HasColumnType("boolean");
-
- b.Property<DateTime?>("ShadowBlockedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("SrpIdentity")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<bool>("TwoFactorEnabled")
- .HasColumnType("boolean");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.HasIndex("PersonalGroupId")
- .IsUnique()
- .HasDatabaseName("UX_AliasVaultUsers_PersonalGroupId");
-
- b.ToTable("AliasVaultUsers");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("DeviceIdentifier")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime>("ExpireDate")
- .HasMaxLength(255)
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("IpAddress")
- .HasMaxLength(45)
- .HasColumnType("character varying(45)");
-
- b.Property<string>("PreviousTokenValue")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Value")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId");
-
- b.ToTable("AliasVaultUserRefreshTokens");
- });
-
- modelBuilder.Entity("AliasServerDb.AuthLog", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("AdditionalInfo")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Browser")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("Client")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("Country")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("DeviceType")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<int>("EventType")
- .HasColumnType("integer");
-
- b.Property<int?>("FailureReason")
- .HasColumnType("integer");
-
- b.Property<string>("IpAddress")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<bool>("IsSuccess")
- .HasColumnType("boolean");
-
- b.Property<bool>("IsSuspiciousActivity")
- .HasColumnType("boolean");
-
- b.Property<string>("OperatingSystem")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("RequestPath")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<DateTime>("Timestamp")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Username")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex(new[] { "EventType" }, "IX_EventType");
-
- b.HasIndex(new[] { "IpAddress" }, "IX_IpAddress");
-
- b.HasIndex(new[] { "Timestamp" }, "IX_Timestamp");
-
- b.HasIndex(new[] { "Username", "IsSuccess", "Timestamp" }, "IX_Username_IsSuccess_Timestamp")
- .IsDescending(false, false, true);
-
- b.HasIndex(new[] { "Username", "Timestamp" }, "IX_Username_Timestamp")
- .IsDescending(false, true);
-
- b.ToTable("AuthLogs");
- });
-
- modelBuilder.Entity("AliasServerDb.BlockedIpRange", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<bool>("BlockLogin")
- .HasColumnType("boolean");
-
- b.Property<bool>("BlockRegistration")
- .HasColumnType("boolean");
-
- b.Property<bool>("BlockShadow")
- .HasColumnType("boolean");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("CreatedBy")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<bool>("Enabled")
- .HasColumnType("boolean");
-
- b.Property<string>("IpRange")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("Reason")
- .HasMaxLength(500)
- .HasColumnType("character varying(500)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("Id");
-
- b.HasIndex(new[] { "Enabled" }, "IX_BlockedIpRange_Enabled");
-
- b.HasIndex(new[] { "IpRange" }, "IX_BlockedIpRange_IpRange")
- .IsUnique();
-
- b.ToTable("BlockedIpRanges");
- });
-
- modelBuilder.Entity("AliasServerDb.Email", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<DateTime>("Date")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime>("DateSystem")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedSymmetricKey")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<Guid>("EncryptionKeyId")
- .HasMaxLength(255)
- .HasColumnType("uuid");
-
- b.Property<string>("From")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("FromDomain")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("FromLocal")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("MessageHtml")
- .HasColumnType("text");
-
- b.Property<string>("MessagePlain")
- .HasColumnType("text");
-
- b.Property<string>("MessagePreview")
- .HasColumnType("text");
-
- b.Property<string>("MessageSource")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<bool>("PushNotificationSent")
- .HasColumnType("boolean");
-
- b.Property<string>("Subject")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("To")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("ToDomain")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("ToLocal")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<bool>("Visible")
- .HasColumnType("boolean");
-
- b.HasKey("Id");
-
- b.HasIndex("Date");
-
- b.HasIndex("DateSystem");
-
- b.HasIndex("EncryptionKeyId");
-
- b.HasIndex("PushNotificationSent");
-
- b.HasIndex("Visible");
-
- b.HasIndex("To", "DateSystem");
-
- b.ToTable("Emails");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailAttachment", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<byte[]>("Bytes")
- .IsRequired()
- .HasColumnType("bytea");
-
- b.Property<DateTime>("Date")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("EmailId")
- .HasColumnType("integer");
-
- b.Property<string>("Filename")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<int>("Filesize")
- .HasColumnType("integer");
-
- b.Property<string>("MimeType")
- .IsRequired()
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.HasIndex("EmailId");
-
- b.ToTable("EmailAttachments");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailClaim", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Address")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("AddressDomain")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("AddressLocal")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("Disabled")
- .HasColumnType("boolean");
-
- b.Property<Guid?>("EncryptionKeyId")
- .HasColumnType("uuid");
-
- b.Property<Guid?>("OwnerGroupId")
- .HasColumnType("uuid");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid?>("VaultManifestId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("Address")
- .IsUnique();
-
- b.HasIndex("EncryptionKeyId");
-
- b.HasIndex("VaultManifestId");
-
- b.HasIndex("OwnerGroupId", "CreatedAt");
-
- b.HasIndex("OwnerGroupId", "Disabled");
-
- b.ToTable("EmailClaims");
- });
-
- modelBuilder.Entity("AliasServerDb.EncryptionKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("IsPrimary")
- .HasColumnType("boolean");
-
- b.Property<string>("PublicKey")
- .IsRequired()
- .HasMaxLength(2000)
- .HasColumnType("character varying(2000)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<Guid?>("VaultManifestId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("VaultManifestId");
-
- b.HasIndex("UserId", "VaultManifestId", "IsPrimary");
-
- b.ToTable("EncryptionKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.Group", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Name")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<int>("Type")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("Id");
-
- b.ToTable("Groups");
- });
-
- modelBuilder.Entity("AliasServerDb.GroupMember", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid>("GroupId")
- .HasColumnType("uuid");
-
- b.Property<int>("Role")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId");
-
- b.HasIndex("GroupId", "UserId")
- .IsUnique();
-
- b.ToTable("GroupMembers");
- });
-
- modelBuilder.Entity("AliasServerDb.Log", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("Application")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("Exception")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Level")
- .IsRequired()
- .HasMaxLength(128)
- .HasColumnType("character varying(128)");
-
- b.Property<string>("LogEvent")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("LogEvent");
-
- b.Property<string>("Message")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("MessageTemplate")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Properties")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("SourceContext")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("TimeStamp")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("Id");
-
- b.HasIndex("Application");
-
- b.HasIndex("TimeStamp");
-
- b.ToTable("Logs", (string)null);
- });
-
- modelBuilder.Entity("AliasServerDb.MobileLoginRequest", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<DateTime?>("ClearedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("ClientIpAddress")
- .HasColumnType("text");
-
- b.Property<string>("ClientPublicKey")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedDecryptionKey")
- .HasColumnType("text");
-
- b.Property<DateTime?>("FulfilledAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("MobileIpAddress")
- .HasColumnType("text");
-
- b.Property<DateTime?>("RetrievedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.HasIndex(new[] { "ClientIpAddress" }, "IX_ClientIpAddress");
-
- b.HasIndex(new[] { "CreatedAt" }, "IX_CreatedAt");
-
- b.HasIndex(new[] { "MobileIpAddress" }, "IX_MobileIpAddress");
-
- b.HasIndex(new[] { "RetrievedAt", "ClearedAt", "FulfilledAt" }, "IX_RetrievedAt_ClearedAt_FulfilledAt");
-
- b.HasIndex(new[] { "UserId" }, "IX_UserId");
-
- b.ToTable("MobileLoginRequests");
- });
-
- modelBuilder.Entity("AliasServerDb.RateLimit", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<int?>("AppliesToAccountAgeMaxDays")
- .HasColumnType("integer");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("CreatedBy")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime?>("EffectiveFrom")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime?>("EffectiveUntil")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("Enabled")
- .HasColumnType("boolean");
-
- b.Property<int>("LimitType")
- .HasColumnType("integer");
-
- b.Property<int>("MaxCount")
- .HasColumnType("integer");
-
- b.Property<string>("Notes")
- .HasMaxLength(1000)
- .HasColumnType("character varying(1000)");
-
- b.Property<int?>("Tier")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<int>("WindowSeconds")
- .HasColumnType("integer");
-
- b.HasKey("Id");
-
- b.HasIndex("Tier");
-
- b.HasIndex("UserId");
-
- b.HasIndex("LimitType", "Enabled");
-
- b.ToTable("RateLimits");
- });
-
- modelBuilder.Entity("AliasServerDb.ServerSetting", b =>
- {
- b.Property<string>("Key")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Value")
- .HasColumnType("text");
-
- b.HasKey("Key");
-
- b.ToTable("ServerSettings");
- });
-
- modelBuilder.Entity("AliasServerDb.TaskRunnerJob", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<TimeOnly?>("EndTime")
- .HasColumnType("time without time zone");
-
- b.Property<string>("ErrorMessage")
- .HasColumnType("text");
-
- b.Property<bool>("IsOnDemand")
- .HasColumnType("boolean");
-
- b.Property<string>("Name")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<DateTime>("RunDate")
- .HasColumnType("timestamp with time zone");
-
- b.Property<TimeOnly>("StartTime")
- .HasColumnType("time without time zone");
-
- b.Property<int>("Status")
- .HasColumnType("integer");
-
- b.HasKey("Id");
-
- b.ToTable("TaskRunnerJobs");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobObject", b =>
- {
- b.Property<string>("Hash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<string>("OwnerUserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Category")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<byte[]>("EncryptedData")
- .IsRequired()
- .HasColumnType("bytea");
-
- b.Property<DateTime>("LastReferencedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("SizeBytes")
- .HasColumnType("integer");
-
- b.HasKey("Hash", "OwnerUserId");
-
- b.HasIndex("OwnerUserId", "Category");
-
- b.ToTable("VaultBlobObjects");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobReference", b =>
- {
- b.Property<Guid>("ManifestId")
- .HasColumnType("uuid");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("BlobHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.HasKey("ManifestId", "RevisionNumber", "BlobHash");
-
- b.ToTable("VaultBlobReferences");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucket", b =>
- {
- b.Property<string>("OwnerUserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Category")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("CiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedData")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("OwnerUserId", "Category");
-
- b.ToTable("VaultDataBuckets");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucketsHistory", b =>
- {
- b.Property<string>("OwnerUserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Category")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("CiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedData")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("OwnerUserId", "Category", "RevisionNumber");
-
- b.ToTable("VaultDataBucketsHistory");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid?>("EncryptionKeyId")
- .HasColumnType("uuid");
-
- b.Property<int>("Type")
- .HasColumnType("integer");
-
- b.Property<DateTime?>("LastUsedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Metadata")
- .HasColumnType("jsonb");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<Guid>("VaultManifestId")
- .HasColumnType("uuid");
-
- b.Property<string>("Algorithm")
- .IsRequired()
- .HasMaxLength(30)
- .HasColumnType("character varying(30)");
-
- b.Property<string>("EncryptedVek")
- .IsRequired()
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.HasIndex("EncryptionKeyId");
-
- b.HasIndex("VaultManifestId")
- .HasDatabaseName("IX_VaultKeys_VaultManifestId");
-
- b.HasIndex("UserId", "Type", "VaultManifestId")
- .IsUnique()
- .HasDatabaseName("UX_VaultKeys_UserId_Type_Manifest");
-
- b.ToTable("VaultKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifest", b =>
- {
- b.Property<Guid>("ManifestId")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Client")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("CredentialsCount")
- .HasColumnType("integer");
-
- b.Property<int>("EmailClaimsCount")
- .HasColumnType("integer");
-
- b.Property<string>("EncryptionSettings")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("EncryptionType")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<int>("FileSize")
- .HasColumnType("integer");
-
- b.Property<bool>("IsRoot")
- .HasColumnType("boolean");
-
- b.Property<string>("ManifestBlob")
- .HasColumnType("text");
-
- b.Property<string>("ManifestCiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<string>("Name")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<Guid>("OwnerGroupId")
- .HasColumnType("uuid");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("Salt")
- .IsRequired()
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("StorageFormat")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("VaultBlob")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Verifier")
- .IsRequired()
- .HasMaxLength(1000)
- .HasColumnType("character varying(1000)");
-
- b.Property<string>("Version")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("ManifestId");
-
- b.HasIndex("OwnerGroupId")
- .IsUnique()
- .HasDatabaseName("UX_VaultManifests_OwnerGroupId_Root")
- .HasFilter("\"IsRoot\"");
-
- b.ToTable("VaultManifests");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestsHistory", b =>
- {
- b.Property<Guid>("ManifestId")
- .HasColumnType("uuid");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("Client")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("CredentialsCount")
- .HasColumnType("integer");
-
- b.Property<int>("EmailClaimsCount")
- .HasColumnType("integer");
-
- b.Property<string>("EncryptionSettings")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("EncryptionType")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<int>("FileSize")
- .HasColumnType("integer");
-
- b.Property<string>("ManifestBlob")
- .HasColumnType("text");
-
- b.Property<string>("ManifestCiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<string>("Salt")
- .IsRequired()
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("StorageFormat")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("VaultBlob")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Verifier")
- .IsRequired()
- .HasMaxLength(1000)
- .HasColumnType("character varying(1000)");
-
- b.Property<string>("Version")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("ManifestId", "RevisionNumber");
-
- b.ToTable("VaultManifestsHistory", (string)null);
- });
-
- modelBuilder.Entity("AliasVault.WorkerStatus.Database.WorkerServiceStatus", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("CurrentStatus")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("DesiredStatus")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<DateTime>("Heartbeat")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("ServiceName")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.ToTable("WorkerServiceStatuses");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("FriendlyName")
- .HasColumnType("text");
-
- b.Property<string>("Xml")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("DataProtectionKeys");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("ClaimType")
- .HasColumnType("text");
-
- b.Property<string>("ClaimValue")
- .HasColumnType("text");
-
- b.Property<string>("RoleId")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("RoleClaims", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("ClaimType")
- .HasColumnType("text");
-
- b.Property<string>("ClaimValue")
- .HasColumnType("text");
-
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("UserClaims", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
- {
- b.Property<string>("LoginProvider")
- .HasColumnType("text");
-
- b.Property<string>("ProviderKey")
- .HasColumnType("text");
-
- b.Property<string>("ProviderDisplayName")
- .HasColumnType("text");
-
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.HasKey("LoginProvider", "ProviderKey");
-
- b.ToTable("UserLogins", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
- {
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.Property<string>("RoleId")
- .HasColumnType("text");
-
- b.HasKey("UserId", "RoleId");
-
- b.ToTable("UserRoles", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
- {
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.Property<string>("LoginProvider")
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.Property<string>("Value")
- .HasColumnType("text");
-
- b.HasKey("UserId", "LoginProvider", "Name");
-
- b.ToTable("UserTokens", (string)null);
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>
- {
- b.HasOne("AliasServerDb.Group", "PersonalGroup")
- .WithOne()
- .HasForeignKey("AliasServerDb.AliasVaultUser", "PersonalGroupId")
- .OnDelete(DeleteBehavior.Restrict)
- .IsRequired();
-
- b.Navigation("PersonalGroup");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.Email", b =>
- {
- b.HasOne("AliasServerDb.EncryptionKey", "EncryptionKey")
- .WithMany("Emails")
- .HasForeignKey("EncryptionKeyId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("EncryptionKey");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailAttachment", b =>
- {
- b.HasOne("AliasServerDb.Email", "Email")
- .WithMany("Attachments")
- .HasForeignKey("EmailId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Email");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailClaim", b =>
- {
- b.HasOne("AliasServerDb.EncryptionKey", "EncryptionKey")
- .WithMany()
- .HasForeignKey("EncryptionKeyId")
- .OnDelete(DeleteBehavior.Restrict);
-
- b.HasOne("AliasServerDb.Group", "OwnerGroup")
- .WithMany()
- .HasForeignKey("OwnerGroupId")
- .OnDelete(DeleteBehavior.SetNull);
-
- b.HasOne("AliasServerDb.VaultManifest", "VaultManifest")
- .WithMany()
- .HasForeignKey("VaultManifestId")
- .OnDelete(DeleteBehavior.SetNull);
-
- b.Navigation("EncryptionKey");
-
- b.Navigation("OwnerGroup");
-
- b.Navigation("VaultManifest");
- });
-
- modelBuilder.Entity("AliasServerDb.EncryptionKey", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany("EncryptionKeys")
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.HasOne("AliasServerDb.VaultManifest", "VaultManifest")
- .WithMany()
- .HasForeignKey("VaultManifestId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.Navigation("User");
-
- b.Navigation("VaultManifest");
- });
-
- modelBuilder.Entity("AliasServerDb.GroupMember", b =>
- {
- b.HasOne("AliasServerDb.Group", "Group")
- .WithMany("Members")
- .HasForeignKey("GroupId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Group");
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.MobileLoginRequest", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.RateLimit", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobObject", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("OwnerUserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobReference", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "Manifest")
- .WithMany()
- .HasForeignKey("ManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Manifest");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucket", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("OwnerUserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucketsHistory", b =>
- {
- b.HasOne("AliasServerDb.VaultDataBucket", "Bucket")
- .WithMany()
- .HasForeignKey("OwnerUserId", "Category")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Bucket");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultKey", b =>
- {
- b.HasOne("AliasServerDb.EncryptionKey", "EncryptionKey")
- .WithMany()
- .HasForeignKey("EncryptionKeyId")
- .OnDelete(DeleteBehavior.SetNull);
-
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany("VaultKeys")
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("EncryptionKey");
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifest", b =>
- {
- b.HasOne("AliasServerDb.Group", "OwnerGroup")
- .WithMany()
- .HasForeignKey("OwnerGroupId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("OwnerGroup");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestsHistory", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "Manifest")
- .WithMany()
- .HasForeignKey("ManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Manifest");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>
- {
- b.Navigation("EncryptionKeys");
-
- b.Navigation("VaultKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.Email", b =>
- {
- b.Navigation("Attachments");
- });
-
- modelBuilder.Entity("AliasServerDb.EncryptionKey", b =>
- {
- b.Navigation("Emails");
- });
-
- modelBuilder.Entity("AliasServerDb.Group", b =>
- {
- b.Navigation("Members");
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/apps/server/Databases/AliasServerDb/Migrations/20260728102956_AddGroupsAndSharedOwnership.cs b/apps/server/Databases/AliasServerDb/Migrations/20260728102956_AddGroupsAndSharedOwnership.cs
deleted file mode 100644
index 0058ee363..000000000
--- a/apps/server/Databases/AliasServerDb/Migrations/20260728102956_AddGroupsAndSharedOwnership.cs
+++ /dev/null
@@ -1,456 +0,0 @@
-using System;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-#nullable disable
-
-namespace AliasServerDb.Migrations
-{
- /// <summary>
- /// Add groups as the ownership path for vault content and email aliases.
- /// </summary>
- public partial class AddGroupsAndSharedOwnership : Migration
- {
- /// <inheritdoc />
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- // Drop old foreign keys
- migrationBuilder.DropForeignKey(name: "FK_Emails_UserEncryptionKeys_UserEncryptionKeyId", table: "Emails");
- migrationBuilder.DropForeignKey(name: "FK_VaultManifests_AliasVaultUsers_OwnerUserId", table: "VaultManifests");
- migrationBuilder.DropForeignKey(name: "FK_UserEmailClaims_AliasVaultUsers_UserId", table: "UserEmailClaims");
- migrationBuilder.DropForeignKey(name: "FK_UserEmailClaims_UserEncryptionKeys_EncryptionKeyId", table: "UserEmailClaims");
- migrationBuilder.DropForeignKey(name: "FK_UserEncryptionKeys_AliasVaultUsers_UserId", table: "UserEncryptionKeys");
- migrationBuilder.DropForeignKey(name: "FK_UserEncryptionKeys_VaultManifests_VaultManifestId", table: "UserEncryptionKeys");
-
- // Drop old indexes
- migrationBuilder.DropIndex(name: "IX_VaultManifestsHistory_OwnerUserId", table: "VaultManifestsHistory");
- migrationBuilder.DropIndex(name: "UX_VaultManifests_OwnerUserId_Root", table: "VaultManifests");
- migrationBuilder.DropIndex(name: "IX_UserEmailClaims_UserId_CreatedAt", table: "UserEmailClaims");
- migrationBuilder.DropIndex(name: "IX_UserEmailClaims_UserId_Disabled", table: "UserEmailClaims");
-
- // Rename tables
- migrationBuilder.RenameTable(name: "UserEmailClaims", newName: "EmailClaims");
- migrationBuilder.RenameTable(name: "UserEncryptionKeys", newName: "EncryptionKeys");
- migrationBuilder.Sql("""
- ALTER TABLE "EmailClaims" RENAME CONSTRAINT "PK_UserEmailClaims" TO "PK_EmailClaims";
- ALTER TABLE "EncryptionKeys" RENAME CONSTRAINT "PK_UserEncryptionKeys" TO "PK_EncryptionKeys";
- ALTER TABLE "VaultKeys" RENAME CONSTRAINT "FK_VaultKeys_UserEncryptionKeys_EncryptionKeyId" TO "FK_VaultKeys_EncryptionKeys_EncryptionKeyId";
- """);
- migrationBuilder.RenameIndex(name: "IX_UserEmailClaims_Address", table: "EmailClaims", newName: "IX_EmailClaims_Address");
- migrationBuilder.RenameIndex(name: "IX_UserEmailClaims_EncryptionKeyId", table: "EmailClaims", newName: "IX_EmailClaims_EncryptionKeyId");
- migrationBuilder.RenameIndex(name: "IX_UserEncryptionKeys_UserId_VaultManifestId_IsPrimary", table: "EncryptionKeys", newName: "IX_EncryptionKeys_UserId_VaultManifestId_IsPrimary");
- migrationBuilder.RenameIndex(name: "IX_UserEncryptionKeys_VaultManifestId", table: "EncryptionKeys", newName: "IX_EncryptionKeys_VaultManifestId");
- migrationBuilder.RenameColumn(name: "UserEncryptionKeyId", table: "Emails", newName: "EncryptionKeyId");
- migrationBuilder.RenameIndex(name: "IX_Emails_UserEncryptionKeyId", table: "Emails", newName: "IX_Emails_EncryptionKeyId");
-
- // Add new ownership columns
- migrationBuilder.AddColumn<Guid>(
- name: "OwnerGroupId",
- table: "VaultManifests",
- type: "uuid",
- nullable: true);
-
- migrationBuilder.AddColumn<Guid>(
- name: "OwnerGroupId",
- table: "EmailClaims",
- type: "uuid",
- nullable: true);
-
- migrationBuilder.AddColumn<Guid>(
- name: "VaultManifestId",
- table: "EmailClaims",
- type: "uuid",
- nullable: true);
-
- // Add new personal group column
- migrationBuilder.AddColumn<Guid>(
- name: "PersonalGroupId",
- table: "AliasVaultUsers",
- type: "uuid",
- nullable: true);
-
- // Alter encryption keys table to remove user id column
- migrationBuilder.AlterColumn<string>(
- name: "UserId",
- table: "EncryptionKeys",
- type: "character varying(255)",
- maxLength: 255,
- nullable: true,
- oldClrType: typeof(string),
- oldType: "character varying(255)",
- oldMaxLength: 255);
-
- // Create groups table
- migrationBuilder.CreateTable(
- name: "Groups",
- columns: table => new
- {
- Id = table.Column<Guid>(type: "uuid", nullable: false),
- Name = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
- Type = table.Column<int>(type: "integer", nullable: false),
- CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
- UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Groups", x => x.Id);
- });
-
- // Create group members table
- migrationBuilder.CreateTable(
- name: "GroupMembers",
- columns: table => new
- {
- Id = table.Column<Guid>(type: "uuid", nullable: false),
- GroupId = table.Column<Guid>(type: "uuid", nullable: false),
- UserId = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
- Role = table.Column<int>(type: "integer", nullable: false),
- CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
- UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_GroupMembers", x => x.Id);
- table.ForeignKey(
- name: "FK_GroupMembers_AliasVaultUsers_UserId",
- column: x => x.UserId,
- principalTable: "AliasVaultUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- table.ForeignKey(
- name: "FK_GroupMembers_Groups_GroupId",
- column: x => x.GroupId,
- principalTable: "Groups",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
-
- // Backfill: every existing user gets their Personal group, every manifest and every email claim becomes owned
- // by its user's personal group, folder-scoped delivery keys lose their per-user owner.
- migrationBuilder.Sql("""
- UPDATE "AliasVaultUsers"
- SET "PersonalGroupId" = gen_random_uuid()
- WHERE "PersonalGroupId" IS NULL;
-
- INSERT INTO "Groups" ("Id", "Name", "Type", "CreatedAt", "UpdatedAt")
- SELECT u."PersonalGroupId", u."UserName", 0, now(), now()
- FROM "AliasVaultUsers" u
- WHERE NOT EXISTS (SELECT 1 FROM "Groups" g WHERE g."Id" = u."PersonalGroupId");
-
- INSERT INTO "GroupMembers" ("Id", "GroupId", "UserId", "Role", "CreatedAt", "UpdatedAt")
- SELECT gen_random_uuid(), u."PersonalGroupId", u."Id", 0, now(), now()
- FROM "AliasVaultUsers" u
- WHERE NOT EXISTS (SELECT 1 FROM "GroupMembers" m WHERE m."GroupId" = u."PersonalGroupId" AND m."UserId" = u."Id");
-
- UPDATE "VaultManifests" m
- SET "OwnerGroupId" = u."PersonalGroupId"
- FROM "AliasVaultUsers" u
- WHERE u."Id" = m."OwnerUserId" AND m."OwnerGroupId" IS NULL;
-
- UPDATE "EmailClaims" c
- SET "OwnerGroupId" = u."PersonalGroupId"
- FROM "AliasVaultUsers" u
- WHERE u."Id" = c."UserId" AND c."OwnerGroupId" IS NULL;
-
- UPDATE "EncryptionKeys"
- SET "UserId" = NULL
- WHERE "VaultManifestId" IS NOT NULL;
- """);
-
- migrationBuilder.AlterColumn<Guid>(
- name: "OwnerGroupId",
- table: "VaultManifests",
- type: "uuid",
- nullable: false,
- oldClrType: typeof(Guid),
- oldType: "uuid",
- oldNullable: true);
-
- // Every user has a personal group by design from here on.
- migrationBuilder.AlterColumn<Guid>(
- name: "PersonalGroupId",
- table: "AliasVaultUsers",
- type: "uuid",
- nullable: false,
- oldClrType: typeof(Guid),
- oldType: "uuid",
- oldNullable: true);
-
- // Drop old per-user ownership columns
- migrationBuilder.DropColumn(name: "OwnerUserId", table: "VaultManifestsHistory");
- migrationBuilder.DropColumn(name: "OwnerUserId", table: "VaultManifests");
- migrationBuilder.DropColumn(name: "UserId", table: "EmailClaims");
-
- // Create new indexes and foreign keys
- migrationBuilder.CreateIndex(
- name: "UX_VaultManifests_OwnerGroupId_Root",
- table: "VaultManifests",
- column: "OwnerGroupId",
- unique: true,
- filter: "\"IsRoot\"");
-
- migrationBuilder.CreateIndex(
- name: "IX_EmailClaims_OwnerGroupId_CreatedAt",
- table: "EmailClaims",
- columns: new[] { "OwnerGroupId", "CreatedAt" });
-
- migrationBuilder.CreateIndex(
- name: "IX_EmailClaims_OwnerGroupId_Disabled",
- table: "EmailClaims",
- columns: new[] { "OwnerGroupId", "Disabled" });
-
- migrationBuilder.CreateIndex(
- name: "IX_EmailClaims_VaultManifestId",
- table: "EmailClaims",
- column: "VaultManifestId");
-
- migrationBuilder.CreateIndex(
- name: "IX_GroupMembers_GroupId_UserId",
- table: "GroupMembers",
- columns: new[] { "GroupId", "UserId" },
- unique: true);
-
- migrationBuilder.CreateIndex(
- name: "IX_GroupMembers_UserId",
- table: "GroupMembers",
- column: "UserId");
-
- migrationBuilder.CreateIndex(
- name: "UX_AliasVaultUsers_PersonalGroupId",
- table: "AliasVaultUsers",
- column: "PersonalGroupId",
- unique: true);
-
- migrationBuilder.AddForeignKey(
- name: "FK_AliasVaultUsers_Groups_PersonalGroupId",
- table: "AliasVaultUsers",
- column: "PersonalGroupId",
- principalTable: "Groups",
- principalColumn: "Id",
- onDelete: ReferentialAction.Restrict);
-
- migrationBuilder.AddForeignKey(
- name: "FK_Emails_EncryptionKeys_EncryptionKeyId",
- table: "Emails",
- column: "EncryptionKeyId",
- principalTable: "EncryptionKeys",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
-
- migrationBuilder.AddForeignKey(
- name: "FK_VaultManifests_Groups_OwnerGroupId",
- table: "VaultManifests",
- column: "OwnerGroupId",
- principalTable: "Groups",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
-
- migrationBuilder.AddForeignKey(
- name: "FK_EmailClaims_EncryptionKeys_EncryptionKeyId",
- table: "EmailClaims",
- column: "EncryptionKeyId",
- principalTable: "EncryptionKeys",
- principalColumn: "Id",
- onDelete: ReferentialAction.Restrict);
-
- migrationBuilder.AddForeignKey(
- name: "FK_EmailClaims_Groups_OwnerGroupId",
- table: "EmailClaims",
- column: "OwnerGroupId",
- principalTable: "Groups",
- principalColumn: "Id",
- onDelete: ReferentialAction.SetNull);
-
- migrationBuilder.AddForeignKey(
- name: "FK_EmailClaims_VaultManifests_VaultManifestId",
- table: "EmailClaims",
- column: "VaultManifestId",
- principalTable: "VaultManifests",
- principalColumn: "ManifestId",
- onDelete: ReferentialAction.SetNull);
-
- migrationBuilder.AddForeignKey(
- name: "FK_EncryptionKeys_AliasVaultUsers_UserId",
- table: "EncryptionKeys",
- column: "UserId",
- principalTable: "AliasVaultUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
-
- migrationBuilder.AddForeignKey(
- name: "FK_EncryptionKeys_VaultManifests_VaultManifestId",
- table: "EncryptionKeys",
- column: "VaultManifestId",
- principalTable: "VaultManifests",
- principalColumn: "ManifestId",
- onDelete: ReferentialAction.Cascade);
- }
-
- /// <inheritdoc />
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.AddColumn<string>(
- name: "OwnerUserId",
- table: "VaultManifests",
- type: "character varying(255)",
- maxLength: 255,
- nullable: false,
- defaultValue: "");
-
- migrationBuilder.AddColumn<string>(
- name: "OwnerUserId",
- table: "VaultManifestsHistory",
- type: "character varying(255)",
- maxLength: 255,
- nullable: false,
- defaultValue: "");
-
- migrationBuilder.AddColumn<string>(
- name: "UserId",
- table: "EmailClaims",
- type: "character varying(255)",
- maxLength: 255,
- nullable: true);
-
- migrationBuilder.Sql("""
- UPDATE "VaultManifests" m
- SET "OwnerUserId" = u."Id"
- FROM "AliasVaultUsers" u
- WHERE u."PersonalGroupId" = m."OwnerGroupId";
-
- UPDATE "VaultManifestsHistory" h
- SET "OwnerUserId" = m."OwnerUserId"
- FROM "VaultManifests" m
- WHERE m."ManifestId" = h."ManifestId";
-
- UPDATE "EmailClaims" c
- SET "UserId" = u."Id"
- FROM "AliasVaultUsers" u
- WHERE u."PersonalGroupId" = c."OwnerGroupId";
-
- UPDATE "EncryptionKeys" k
- SET "UserId" = u."Id"
- FROM "VaultManifests" m
- JOIN "AliasVaultUsers" u ON u."PersonalGroupId" = m."OwnerGroupId"
- WHERE m."ManifestId" = k."VaultManifestId" AND k."UserId" IS NULL;
- """);
-
- migrationBuilder.DropForeignKey(name: "FK_AliasVaultUsers_Groups_PersonalGroupId", table: "AliasVaultUsers");
- migrationBuilder.DropIndex(name: "UX_AliasVaultUsers_PersonalGroupId", table: "AliasVaultUsers");
- migrationBuilder.DropColumn(name: "PersonalGroupId", table: "AliasVaultUsers");
- migrationBuilder.DropForeignKey(name: "FK_Emails_EncryptionKeys_EncryptionKeyId", table: "Emails");
- migrationBuilder.DropForeignKey(name: "FK_VaultManifests_Groups_OwnerGroupId", table: "VaultManifests");
- migrationBuilder.DropForeignKey(name: "FK_EmailClaims_EncryptionKeys_EncryptionKeyId", table: "EmailClaims");
- migrationBuilder.DropForeignKey(name: "FK_EmailClaims_Groups_OwnerGroupId", table: "EmailClaims");
- migrationBuilder.DropForeignKey(name: "FK_EmailClaims_VaultManifests_VaultManifestId", table: "EmailClaims");
- migrationBuilder.DropForeignKey(name: "FK_EncryptionKeys_AliasVaultUsers_UserId", table: "EncryptionKeys");
- migrationBuilder.DropForeignKey(name: "FK_EncryptionKeys_VaultManifests_VaultManifestId", table: "EncryptionKeys");
-
- migrationBuilder.DropTable(name: "GroupMembers");
- migrationBuilder.DropTable(name: "Groups");
-
- migrationBuilder.DropIndex(name: "UX_VaultManifests_OwnerGroupId_Root", table: "VaultManifests");
- migrationBuilder.DropIndex(name: "IX_EmailClaims_OwnerGroupId_CreatedAt", table: "EmailClaims");
- migrationBuilder.DropIndex(name: "IX_EmailClaims_OwnerGroupId_Disabled", table: "EmailClaims");
- migrationBuilder.DropIndex(name: "IX_EmailClaims_VaultManifestId", table: "EmailClaims");
-
- migrationBuilder.DropColumn(name: "OwnerGroupId", table: "VaultManifests");
- migrationBuilder.DropColumn(name: "OwnerGroupId", table: "EmailClaims");
- migrationBuilder.DropColumn(name: "VaultManifestId", table: "EmailClaims");
-
- migrationBuilder.AlterColumn<string>(
- name: "UserId",
- table: "EncryptionKeys",
- type: "character varying(255)",
- maxLength: 255,
- nullable: false,
- defaultValue: "",
- oldClrType: typeof(string),
- oldType: "character varying(255)",
- oldMaxLength: 255,
- oldNullable: true);
-
- migrationBuilder.RenameColumn(name: "EncryptionKeyId", table: "Emails", newName: "UserEncryptionKeyId");
- migrationBuilder.RenameIndex(name: "IX_Emails_EncryptionKeyId", table: "Emails", newName: "IX_Emails_UserEncryptionKeyId");
- migrationBuilder.RenameIndex(name: "IX_EmailClaims_Address", table: "EmailClaims", newName: "IX_UserEmailClaims_Address");
- migrationBuilder.RenameIndex(name: "IX_EmailClaims_EncryptionKeyId", table: "EmailClaims", newName: "IX_UserEmailClaims_EncryptionKeyId");
- migrationBuilder.RenameIndex(name: "IX_EncryptionKeys_UserId_VaultManifestId_IsPrimary", table: "EncryptionKeys", newName: "IX_UserEncryptionKeys_UserId_VaultManifestId_IsPrimary");
- migrationBuilder.RenameIndex(name: "IX_EncryptionKeys_VaultManifestId", table: "EncryptionKeys", newName: "IX_UserEncryptionKeys_VaultManifestId");
- migrationBuilder.Sql("""
- ALTER TABLE "EmailClaims" RENAME CONSTRAINT "PK_EmailClaims" TO "PK_UserEmailClaims";
- ALTER TABLE "EncryptionKeys" RENAME CONSTRAINT "PK_EncryptionKeys" TO "PK_UserEncryptionKeys";
- """);
- migrationBuilder.RenameTable(name: "EmailClaims", newName: "UserEmailClaims");
- migrationBuilder.RenameTable(name: "EncryptionKeys", newName: "UserEncryptionKeys");
-
- migrationBuilder.CreateIndex(
- name: "IX_VaultManifestsHistory_OwnerUserId",
- table: "VaultManifestsHistory",
- column: "OwnerUserId");
-
- migrationBuilder.CreateIndex(
- name: "UX_VaultManifests_OwnerUserId_Root",
- table: "VaultManifests",
- column: "OwnerUserId",
- unique: true,
- filter: "\"IsRoot\"");
-
- migrationBuilder.CreateIndex(
- name: "IX_UserEmailClaims_UserId_CreatedAt",
- table: "UserEmailClaims",
- columns: new[] { "UserId", "CreatedAt" });
-
- migrationBuilder.CreateIndex(
- name: "IX_UserEmailClaims_UserId_Disabled",
- table: "UserEmailClaims",
- columns: new[] { "UserId", "Disabled" });
-
- migrationBuilder.AddForeignKey(
- name: "FK_Emails_UserEncryptionKeys_UserEncryptionKeyId",
- table: "Emails",
- column: "UserEncryptionKeyId",
- principalTable: "UserEncryptionKeys",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
-
- migrationBuilder.AddForeignKey(
- name: "FK_VaultManifests_AliasVaultUsers_OwnerUserId",
- table: "VaultManifests",
- column: "OwnerUserId",
- principalTable: "AliasVaultUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
-
- migrationBuilder.AddForeignKey(
- name: "FK_UserEmailClaims_AliasVaultUsers_UserId",
- table: "UserEmailClaims",
- column: "UserId",
- principalTable: "AliasVaultUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.SetNull);
-
- migrationBuilder.AddForeignKey(
- name: "FK_UserEmailClaims_UserEncryptionKeys_EncryptionKeyId",
- table: "UserEmailClaims",
- column: "EncryptionKeyId",
- principalTable: "UserEncryptionKeys",
- principalColumn: "Id",
- onDelete: ReferentialAction.Restrict);
-
- migrationBuilder.AddForeignKey(
- name: "FK_UserEncryptionKeys_AliasVaultUsers_UserId",
- table: "UserEncryptionKeys",
- column: "UserId",
- principalTable: "AliasVaultUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
-
- migrationBuilder.AddForeignKey(
- name: "FK_UserEncryptionKeys_VaultManifests_VaultManifestId",
- table: "UserEncryptionKeys",
- column: "VaultManifestId",
- principalTable: "VaultManifests",
- principalColumn: "ManifestId",
- onDelete: ReferentialAction.Cascade);
- }
- }
-}
diff --git a/apps/server/Databases/AliasServerDb/Migrations/20260730082935_EmailClaimOwnershipViaManifest.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/20260730082935_EmailClaimOwnershipViaManifest.Designer.cs
deleted file mode 100644
index c242aa649..000000000
--- a/apps/server/Databases/AliasServerDb/Migrations/20260730082935_EmailClaimOwnershipViaManifest.Designer.cs
+++ /dev/null
@@ -1,1572 +0,0 @@
-// <auto-generated />
-using System;
-using AliasServerDb;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
-
-#nullable disable
-
-namespace AliasServerDb.Migrations
-{
- [DbContext(typeof(AliasServerDbContext))]
- [Migration("20260730082935_EmailClaimOwnershipViaManifest")]
- partial class EmailClaimOwnershipViaManifest
- {
- /// <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)
- .HasAnnotation("Relational:MaxIdentifierLength", 63);
-
- NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
-
- modelBuilder.Entity("AliasServerDb.AdminRole", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("AdminRoles");
- });
-
- modelBuilder.Entity("AliasServerDb.AdminUser", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<int>("AccessFailedCount")
- .HasColumnType("integer");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<string>("Email")
- .HasColumnType("text");
-
- b.Property<bool>("EmailConfirmed")
- .HasColumnType("boolean");
-
- b.Property<DateTime?>("LastPasswordChanged")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("LockoutEnabled")
- .HasColumnType("boolean");
-
- b.Property<DateTimeOffset?>("LockoutEnd")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("NormalizedEmail")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedUserName")
- .HasColumnType("text");
-
- b.Property<string>("PasswordHash")
- .HasColumnType("text");
-
- b.Property<string>("PhoneNumber")
- .HasColumnType("text");
-
- b.Property<bool>("PhoneNumberConfirmed")
- .HasColumnType("boolean");
-
- b.Property<string>("SecurityStamp")
- .HasColumnType("text");
-
- b.Property<bool>("TwoFactorEnabled")
- .HasColumnType("boolean");
-
- b.Property<string>("UserName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("AdminUsers");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultRole", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("AliasVaultRoles");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<int>("AccessFailedCount")
- .HasColumnType("integer");
-
- b.Property<bool>("Blocked")
- .HasColumnType("boolean");
-
- b.Property<DateTime?>("BlockedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Email")
- .HasColumnType("text");
-
- b.Property<bool>("EmailConfirmed")
- .HasColumnType("boolean");
-
- b.Property<int>("EmailsReceived")
- .HasColumnType("integer");
-
- b.Property<DateTime?>("LastActivityDate")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("LockoutEnabled")
- .HasColumnType("boolean");
-
- b.Property<DateTimeOffset?>("LockoutEnd")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("MaxEmailAgeDays")
- .HasColumnType("integer");
-
- b.Property<int>("MaxEmails")
- .HasColumnType("integer");
-
- b.Property<string>("NormalizedEmail")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedUserName")
- .HasColumnType("text");
-
- b.Property<DateTime>("PasswordChangedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("PasswordHash")
- .HasColumnType("text");
-
- b.Property<Guid>("PersonalGroupId")
- .HasColumnType("uuid");
-
- b.Property<string>("PhoneNumber")
- .HasColumnType("text");
-
- b.Property<bool>("PhoneNumberConfirmed")
- .HasColumnType("boolean");
-
- b.Property<string>("SecurityStamp")
- .HasColumnType("text");
-
- b.Property<bool>("ShadowBlocked")
- .HasColumnType("boolean");
-
- b.Property<DateTime?>("ShadowBlockedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("SrpIdentity")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<bool>("TwoFactorEnabled")
- .HasColumnType("boolean");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.HasIndex("PersonalGroupId")
- .IsUnique()
- .HasDatabaseName("UX_AliasVaultUsers_PersonalGroupId");
-
- b.ToTable("AliasVaultUsers");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("DeviceIdentifier")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime>("ExpireDate")
- .HasMaxLength(255)
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("IpAddress")
- .HasMaxLength(45)
- .HasColumnType("character varying(45)");
-
- b.Property<string>("PreviousTokenValue")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Value")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId");
-
- b.ToTable("AliasVaultUserRefreshTokens");
- });
-
- modelBuilder.Entity("AliasServerDb.AuthLog", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("AdditionalInfo")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Browser")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("Client")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("Country")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("DeviceType")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<int>("EventType")
- .HasColumnType("integer");
-
- b.Property<int?>("FailureReason")
- .HasColumnType("integer");
-
- b.Property<string>("IpAddress")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<bool>("IsSuccess")
- .HasColumnType("boolean");
-
- b.Property<bool>("IsSuspiciousActivity")
- .HasColumnType("boolean");
-
- b.Property<string>("OperatingSystem")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("RequestPath")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<DateTime>("Timestamp")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Username")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex(new[] { "EventType" }, "IX_EventType");
-
- b.HasIndex(new[] { "IpAddress" }, "IX_IpAddress");
-
- b.HasIndex(new[] { "Timestamp" }, "IX_Timestamp");
-
- b.HasIndex(new[] { "Username", "IsSuccess", "Timestamp" }, "IX_Username_IsSuccess_Timestamp")
- .IsDescending(false, false, true);
-
- b.HasIndex(new[] { "Username", "Timestamp" }, "IX_Username_Timestamp")
- .IsDescending(false, true);
-
- b.ToTable("AuthLogs");
- });
-
- modelBuilder.Entity("AliasServerDb.BlockedIpRange", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<bool>("BlockLogin")
- .HasColumnType("boolean");
-
- b.Property<bool>("BlockRegistration")
- .HasColumnType("boolean");
-
- b.Property<bool>("BlockShadow")
- .HasColumnType("boolean");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("CreatedBy")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<bool>("Enabled")
- .HasColumnType("boolean");
-
- b.Property<string>("IpRange")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("Reason")
- .HasMaxLength(500)
- .HasColumnType("character varying(500)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("Id");
-
- b.HasIndex(new[] { "Enabled" }, "IX_BlockedIpRange_Enabled");
-
- b.HasIndex(new[] { "IpRange" }, "IX_BlockedIpRange_IpRange")
- .IsUnique();
-
- b.ToTable("BlockedIpRanges");
- });
-
- modelBuilder.Entity("AliasServerDb.Email", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<DateTime>("Date")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime>("DateSystem")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedSymmetricKey")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<Guid>("EncryptionKeyId")
- .HasMaxLength(255)
- .HasColumnType("uuid");
-
- b.Property<string>("From")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("FromDomain")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("FromLocal")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("MessageHtml")
- .HasColumnType("text");
-
- b.Property<string>("MessagePlain")
- .HasColumnType("text");
-
- b.Property<string>("MessagePreview")
- .HasColumnType("text");
-
- b.Property<string>("MessageSource")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<bool>("PushNotificationSent")
- .HasColumnType("boolean");
-
- b.Property<string>("Subject")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("To")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("ToDomain")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("ToLocal")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<bool>("Visible")
- .HasColumnType("boolean");
-
- b.HasKey("Id");
-
- b.HasIndex("Date");
-
- b.HasIndex("DateSystem");
-
- b.HasIndex("EncryptionKeyId");
-
- b.HasIndex("PushNotificationSent");
-
- b.HasIndex("Visible");
-
- b.HasIndex("To", "DateSystem");
-
- b.ToTable("Emails");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailAttachment", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<byte[]>("Bytes")
- .IsRequired()
- .HasColumnType("bytea");
-
- b.Property<DateTime>("Date")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("EmailId")
- .HasColumnType("integer");
-
- b.Property<string>("Filename")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<int>("Filesize")
- .HasColumnType("integer");
-
- b.Property<string>("MimeType")
- .IsRequired()
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.HasIndex("EmailId");
-
- b.ToTable("EmailAttachments");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailClaim", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Address")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("AddressDomain")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("AddressLocal")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("Disabled")
- .HasColumnType("boolean");
-
- b.Property<Guid?>("EncryptionKeyId")
- .HasColumnType("uuid");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid?>("VaultManifestId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("Address")
- .IsUnique();
-
- b.HasIndex("EncryptionKeyId");
-
- b.HasIndex("VaultManifestId", "CreatedAt");
-
- b.HasIndex("VaultManifestId", "Disabled");
-
- b.ToTable("EmailClaims");
- });
-
- modelBuilder.Entity("AliasServerDb.EncryptionKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("IsPrimary")
- .HasColumnType("boolean");
-
- b.Property<string>("PublicKey")
- .IsRequired()
- .HasMaxLength(2000)
- .HasColumnType("character varying(2000)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<Guid?>("VaultManifestId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("VaultManifestId");
-
- b.HasIndex("UserId", "VaultManifestId", "IsPrimary");
-
- b.ToTable("EncryptionKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.Group", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Name")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<int>("Type")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("Id");
-
- b.ToTable("Groups");
- });
-
- modelBuilder.Entity("AliasServerDb.GroupMember", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid>("GroupId")
- .HasColumnType("uuid");
-
- b.Property<int>("Role")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId");
-
- b.HasIndex("GroupId", "UserId")
- .IsUnique();
-
- b.ToTable("GroupMembers");
- });
-
- modelBuilder.Entity("AliasServerDb.Log", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("Application")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("Exception")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Level")
- .IsRequired()
- .HasMaxLength(128)
- .HasColumnType("character varying(128)");
-
- b.Property<string>("LogEvent")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("LogEvent");
-
- b.Property<string>("Message")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("MessageTemplate")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Properties")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("SourceContext")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("TimeStamp")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("Id");
-
- b.HasIndex("Application");
-
- b.HasIndex("TimeStamp");
-
- b.ToTable("Logs", (string)null);
- });
-
- modelBuilder.Entity("AliasServerDb.MobileLoginRequest", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<DateTime?>("ClearedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("ClientIpAddress")
- .HasColumnType("text");
-
- b.Property<string>("ClientPublicKey")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedDecryptionKey")
- .HasColumnType("text");
-
- b.Property<DateTime?>("FulfilledAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("MobileIpAddress")
- .HasColumnType("text");
-
- b.Property<DateTime?>("RetrievedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.HasIndex(new[] { "ClientIpAddress" }, "IX_ClientIpAddress");
-
- b.HasIndex(new[] { "CreatedAt" }, "IX_CreatedAt");
-
- b.HasIndex(new[] { "MobileIpAddress" }, "IX_MobileIpAddress");
-
- b.HasIndex(new[] { "RetrievedAt", "ClearedAt", "FulfilledAt" }, "IX_RetrievedAt_ClearedAt_FulfilledAt");
-
- b.HasIndex(new[] { "UserId" }, "IX_UserId");
-
- b.ToTable("MobileLoginRequests");
- });
-
- modelBuilder.Entity("AliasServerDb.RateLimit", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<int?>("AppliesToAccountAgeMaxDays")
- .HasColumnType("integer");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("CreatedBy")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime?>("EffectiveFrom")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime?>("EffectiveUntil")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("Enabled")
- .HasColumnType("boolean");
-
- b.Property<int>("LimitType")
- .HasColumnType("integer");
-
- b.Property<int>("MaxCount")
- .HasColumnType("integer");
-
- b.Property<string>("Notes")
- .HasMaxLength(1000)
- .HasColumnType("character varying(1000)");
-
- b.Property<int?>("Tier")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<int>("WindowSeconds")
- .HasColumnType("integer");
-
- b.HasKey("Id");
-
- b.HasIndex("Tier");
-
- b.HasIndex("UserId");
-
- b.HasIndex("LimitType", "Enabled");
-
- b.ToTable("RateLimits");
- });
-
- modelBuilder.Entity("AliasServerDb.ServerSetting", b =>
- {
- b.Property<string>("Key")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Value")
- .HasColumnType("text");
-
- b.HasKey("Key");
-
- b.ToTable("ServerSettings");
- });
-
- modelBuilder.Entity("AliasServerDb.TaskRunnerJob", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<TimeOnly?>("EndTime")
- .HasColumnType("time without time zone");
-
- b.Property<string>("ErrorMessage")
- .HasColumnType("text");
-
- b.Property<bool>("IsOnDemand")
- .HasColumnType("boolean");
-
- b.Property<string>("Name")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<DateTime>("RunDate")
- .HasColumnType("timestamp with time zone");
-
- b.Property<TimeOnly>("StartTime")
- .HasColumnType("time without time zone");
-
- b.Property<int>("Status")
- .HasColumnType("integer");
-
- b.HasKey("Id");
-
- b.ToTable("TaskRunnerJobs");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobObject", b =>
- {
- b.Property<string>("Hash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<string>("OwnerUserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Category")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<byte[]>("EncryptedData")
- .IsRequired()
- .HasColumnType("bytea");
-
- b.Property<DateTime>("LastReferencedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("SizeBytes")
- .HasColumnType("integer");
-
- b.HasKey("Hash", "OwnerUserId");
-
- b.HasIndex("OwnerUserId", "Category");
-
- b.ToTable("VaultBlobObjects");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobReference", b =>
- {
- b.Property<Guid>("ManifestId")
- .HasColumnType("uuid");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("BlobHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.HasKey("ManifestId", "RevisionNumber", "BlobHash");
-
- b.ToTable("VaultBlobReferences");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucket", b =>
- {
- b.Property<string>("OwnerUserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Category")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("CiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedData")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("OwnerUserId", "Category");
-
- b.ToTable("VaultDataBuckets");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucketsHistory", b =>
- {
- b.Property<string>("OwnerUserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Category")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("CiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedData")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("OwnerUserId", "Category", "RevisionNumber");
-
- b.ToTable("VaultDataBucketsHistory");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid?>("EncryptionKeyId")
- .HasColumnType("uuid");
-
- b.Property<int>("Type")
- .HasColumnType("integer");
-
- b.Property<DateTime?>("LastUsedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Metadata")
- .HasColumnType("jsonb");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<Guid>("VaultManifestId")
- .HasColumnType("uuid");
-
- b.Property<string>("Algorithm")
- .IsRequired()
- .HasMaxLength(30)
- .HasColumnType("character varying(30)");
-
- b.Property<string>("EncryptedVek")
- .IsRequired()
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.HasIndex("EncryptionKeyId");
-
- b.HasIndex("VaultManifestId")
- .HasDatabaseName("IX_VaultKeys_VaultManifestId");
-
- b.HasIndex("UserId", "Type", "VaultManifestId")
- .IsUnique()
- .HasDatabaseName("UX_VaultKeys_UserId_Type_Manifest");
-
- b.ToTable("VaultKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifest", b =>
- {
- b.Property<Guid>("ManifestId")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Client")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("CredentialsCount")
- .HasColumnType("integer");
-
- b.Property<int>("EmailClaimsCount")
- .HasColumnType("integer");
-
- b.Property<string>("EncryptionSettings")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("EncryptionType")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<int>("FileSize")
- .HasColumnType("integer");
-
- b.Property<bool>("IsRoot")
- .HasColumnType("boolean");
-
- b.Property<string>("ManifestBlob")
- .HasColumnType("text");
-
- b.Property<string>("ManifestCiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<string>("Name")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<Guid>("OwnerGroupId")
- .HasColumnType("uuid");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("Salt")
- .IsRequired()
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("StorageFormat")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("VaultBlob")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Verifier")
- .IsRequired()
- .HasMaxLength(1000)
- .HasColumnType("character varying(1000)");
-
- b.Property<string>("Version")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("ManifestId");
-
- b.HasIndex("OwnerGroupId")
- .IsUnique()
- .HasDatabaseName("UX_VaultManifests_OwnerGroupId_Root")
- .HasFilter("\"IsRoot\"");
-
- b.ToTable("VaultManifests");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestsHistory", b =>
- {
- b.Property<Guid>("ManifestId")
- .HasColumnType("uuid");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("Client")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("CredentialsCount")
- .HasColumnType("integer");
-
- b.Property<int>("EmailClaimsCount")
- .HasColumnType("integer");
-
- b.Property<string>("EncryptionSettings")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("EncryptionType")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<int>("FileSize")
- .HasColumnType("integer");
-
- b.Property<string>("ManifestBlob")
- .HasColumnType("text");
-
- b.Property<string>("ManifestCiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<string>("Salt")
- .IsRequired()
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("StorageFormat")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("VaultBlob")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Verifier")
- .IsRequired()
- .HasMaxLength(1000)
- .HasColumnType("character varying(1000)");
-
- b.Property<string>("Version")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("ManifestId", "RevisionNumber");
-
- b.ToTable("VaultManifestsHistory", (string)null);
- });
-
- modelBuilder.Entity("AliasVault.WorkerStatus.Database.WorkerServiceStatus", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("CurrentStatus")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("DesiredStatus")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<DateTime>("Heartbeat")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("ServiceName")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.ToTable("WorkerServiceStatuses");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("FriendlyName")
- .HasColumnType("text");
-
- b.Property<string>("Xml")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("DataProtectionKeys");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("ClaimType")
- .HasColumnType("text");
-
- b.Property<string>("ClaimValue")
- .HasColumnType("text");
-
- b.Property<string>("RoleId")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("RoleClaims", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("ClaimType")
- .HasColumnType("text");
-
- b.Property<string>("ClaimValue")
- .HasColumnType("text");
-
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("UserClaims", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
- {
- b.Property<string>("LoginProvider")
- .HasColumnType("text");
-
- b.Property<string>("ProviderKey")
- .HasColumnType("text");
-
- b.Property<string>("ProviderDisplayName")
- .HasColumnType("text");
-
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.HasKey("LoginProvider", "ProviderKey");
-
- b.ToTable("UserLogins", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
- {
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.Property<string>("RoleId")
- .HasColumnType("text");
-
- b.HasKey("UserId", "RoleId");
-
- b.ToTable("UserRoles", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
- {
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.Property<string>("LoginProvider")
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.Property<string>("Value")
- .HasColumnType("text");
-
- b.HasKey("UserId", "LoginProvider", "Name");
-
- b.ToTable("UserTokens", (string)null);
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>
- {
- b.HasOne("AliasServerDb.Group", "PersonalGroup")
- .WithOne()
- .HasForeignKey("AliasServerDb.AliasVaultUser", "PersonalGroupId")
- .OnDelete(DeleteBehavior.Restrict)
- .IsRequired();
-
- b.Navigation("PersonalGroup");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.Email", b =>
- {
- b.HasOne("AliasServerDb.EncryptionKey", "EncryptionKey")
- .WithMany("Emails")
- .HasForeignKey("EncryptionKeyId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("EncryptionKey");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailAttachment", b =>
- {
- b.HasOne("AliasServerDb.Email", "Email")
- .WithMany("Attachments")
- .HasForeignKey("EmailId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Email");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailClaim", b =>
- {
- b.HasOne("AliasServerDb.EncryptionKey", "EncryptionKey")
- .WithMany()
- .HasForeignKey("EncryptionKeyId")
- .OnDelete(DeleteBehavior.Restrict);
-
- b.HasOne("AliasServerDb.VaultManifest", "VaultManifest")
- .WithMany()
- .HasForeignKey("VaultManifestId")
- .OnDelete(DeleteBehavior.SetNull);
-
- b.Navigation("EncryptionKey");
-
- b.Navigation("VaultManifest");
- });
-
- modelBuilder.Entity("AliasServerDb.EncryptionKey", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany("EncryptionKeys")
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.HasOne("AliasServerDb.VaultManifest", "VaultManifest")
- .WithMany()
- .HasForeignKey("VaultManifestId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.Navigation("User");
-
- b.Navigation("VaultManifest");
- });
-
- modelBuilder.Entity("AliasServerDb.GroupMember", b =>
- {
- b.HasOne("AliasServerDb.Group", "Group")
- .WithMany("Members")
- .HasForeignKey("GroupId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Group");
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.MobileLoginRequest", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.RateLimit", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobObject", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("OwnerUserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobReference", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "Manifest")
- .WithMany()
- .HasForeignKey("ManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Manifest");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucket", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("OwnerUserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucketsHistory", b =>
- {
- b.HasOne("AliasServerDb.VaultDataBucket", "Bucket")
- .WithMany()
- .HasForeignKey("OwnerUserId", "Category")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Bucket");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultKey", b =>
- {
- b.HasOne("AliasServerDb.EncryptionKey", "EncryptionKey")
- .WithMany()
- .HasForeignKey("EncryptionKeyId")
- .OnDelete(DeleteBehavior.SetNull);
-
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany("VaultKeys")
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("EncryptionKey");
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifest", b =>
- {
- b.HasOne("AliasServerDb.Group", "OwnerGroup")
- .WithMany()
- .HasForeignKey("OwnerGroupId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("OwnerGroup");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestsHistory", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "Manifest")
- .WithMany()
- .HasForeignKey("ManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Manifest");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>
- {
- b.Navigation("EncryptionKeys");
-
- b.Navigation("VaultKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.Email", b =>
- {
- b.Navigation("Attachments");
- });
-
- modelBuilder.Entity("AliasServerDb.EncryptionKey", b =>
- {
- b.Navigation("Emails");
- });
-
- modelBuilder.Entity("AliasServerDb.Group", b =>
- {
- b.Navigation("Members");
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/apps/server/Databases/AliasServerDb/Migrations/20260730082935_EmailClaimOwnershipViaManifest.cs b/apps/server/Databases/AliasServerDb/Migrations/20260730082935_EmailClaimOwnershipViaManifest.cs
deleted file mode 100644
index 72a21f7a0..000000000
--- a/apps/server/Databases/AliasServerDb/Migrations/20260730082935_EmailClaimOwnershipViaManifest.cs
+++ /dev/null
@@ -1,107 +0,0 @@
-using System;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-#nullable disable
-
-namespace AliasServerDb.Migrations
-{
- /// <inheritdoc />
- public partial class EmailClaimOwnershipViaManifest : Migration
- {
- /// <inheritdoc />
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.Sql(@"
- UPDATE ""EmailClaims"" c
- SET ""VaultManifestId"" = m.""ManifestId""
- FROM ""VaultManifests"" m
- WHERE m.""OwnerGroupId"" = c.""OwnerGroupId""
- AND m.""IsRoot""
- AND c.""VaultManifestId"" IS NULL;");
-
- migrationBuilder.DropForeignKey(
- name: "FK_EmailClaims_Groups_OwnerGroupId",
- table: "EmailClaims");
-
- migrationBuilder.DropIndex(
- name: "IX_EmailClaims_OwnerGroupId_CreatedAt",
- table: "EmailClaims");
-
- migrationBuilder.DropIndex(
- name: "IX_EmailClaims_OwnerGroupId_Disabled",
- table: "EmailClaims");
-
- migrationBuilder.DropIndex(
- name: "IX_EmailClaims_VaultManifestId",
- table: "EmailClaims");
-
- migrationBuilder.DropColumn(
- name: "OwnerGroupId",
- table: "EmailClaims");
-
- migrationBuilder.CreateIndex(
- name: "IX_EmailClaims_VaultManifestId_CreatedAt",
- table: "EmailClaims",
- columns: new[] { "VaultManifestId", "CreatedAt" });
-
- migrationBuilder.CreateIndex(
- name: "IX_EmailClaims_VaultManifestId_Disabled",
- table: "EmailClaims",
- columns: new[] { "VaultManifestId", "Disabled" });
- }
-
- /// <inheritdoc />
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropIndex(
- name: "IX_EmailClaims_VaultManifestId_CreatedAt",
- table: "EmailClaims");
-
- migrationBuilder.DropIndex(
- name: "IX_EmailClaims_VaultManifestId_Disabled",
- table: "EmailClaims");
-
- migrationBuilder.AddColumn<Guid>(
- name: "OwnerGroupId",
- table: "EmailClaims",
- type: "uuid",
- nullable: true);
-
- migrationBuilder.Sql(@"
- UPDATE ""EmailClaims"" c
- SET ""OwnerGroupId"" = m.""OwnerGroupId""
- FROM ""VaultManifests"" m
- WHERE m.""ManifestId"" = c.""VaultManifestId"";");
-
- migrationBuilder.Sql(@"
- UPDATE ""EmailClaims"" c
- SET ""VaultManifestId"" = NULL
- FROM ""VaultManifests"" m
- WHERE m.""ManifestId"" = c.""VaultManifestId""
- AND m.""IsRoot"";");
-
- migrationBuilder.CreateIndex(
- name: "IX_EmailClaims_OwnerGroupId_CreatedAt",
- table: "EmailClaims",
- columns: new[] { "OwnerGroupId", "CreatedAt" });
-
- migrationBuilder.CreateIndex(
- name: "IX_EmailClaims_OwnerGroupId_Disabled",
- table: "EmailClaims",
- columns: new[] { "OwnerGroupId", "Disabled" });
-
- migrationBuilder.CreateIndex(
- name: "IX_EmailClaims_VaultManifestId",
- table: "EmailClaims",
- column: "VaultManifestId");
-
- migrationBuilder.AddForeignKey(
- name: "FK_EmailClaims_Groups_OwnerGroupId",
- table: "EmailClaims",
- column: "OwnerGroupId",
- principalTable: "Groups",
- principalColumn: "Id",
- onDelete: ReferentialAction.SetNull);
- }
- }
-}
diff --git a/apps/server/Databases/AliasServerDb/Migrations/20260731142702_ScopeEncryptionKeysToManifests.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/20260731142702_ScopeEncryptionKeysToManifests.Designer.cs
deleted file mode 100644
index e883e5977..000000000
--- a/apps/server/Databases/AliasServerDb/Migrations/20260731142702_ScopeEncryptionKeysToManifests.Designer.cs
+++ /dev/null
@@ -1,1551 +0,0 @@
-// <auto-generated />
-using System;
-using AliasServerDb;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
-
-#nullable disable
-
-namespace AliasServerDb.Migrations
-{
- [DbContext(typeof(AliasServerDbContext))]
- [Migration("20260731142702_ScopeEncryptionKeysToManifests")]
- partial class ScopeEncryptionKeysToManifests
- {
- /// <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)
- .HasAnnotation("Relational:MaxIdentifierLength", 63);
-
- NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
-
- modelBuilder.Entity("AliasServerDb.AdminRole", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("AdminRoles");
- });
-
- modelBuilder.Entity("AliasServerDb.AdminUser", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<int>("AccessFailedCount")
- .HasColumnType("integer");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<string>("Email")
- .HasColumnType("text");
-
- b.Property<bool>("EmailConfirmed")
- .HasColumnType("boolean");
-
- b.Property<DateTime?>("LastPasswordChanged")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("LockoutEnabled")
- .HasColumnType("boolean");
-
- b.Property<DateTimeOffset?>("LockoutEnd")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("NormalizedEmail")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedUserName")
- .HasColumnType("text");
-
- b.Property<string>("PasswordHash")
- .HasColumnType("text");
-
- b.Property<string>("PhoneNumber")
- .HasColumnType("text");
-
- b.Property<bool>("PhoneNumberConfirmed")
- .HasColumnType("boolean");
-
- b.Property<string>("SecurityStamp")
- .HasColumnType("text");
-
- b.Property<bool>("TwoFactorEnabled")
- .HasColumnType("boolean");
-
- b.Property<string>("UserName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("AdminUsers");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultRole", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("AliasVaultRoles");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<int>("AccessFailedCount")
- .HasColumnType("integer");
-
- b.Property<bool>("Blocked")
- .HasColumnType("boolean");
-
- b.Property<DateTime?>("BlockedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Email")
- .HasColumnType("text");
-
- b.Property<bool>("EmailConfirmed")
- .HasColumnType("boolean");
-
- b.Property<int>("EmailsReceived")
- .HasColumnType("integer");
-
- b.Property<DateTime?>("LastActivityDate")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("LockoutEnabled")
- .HasColumnType("boolean");
-
- b.Property<DateTimeOffset?>("LockoutEnd")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("MaxEmailAgeDays")
- .HasColumnType("integer");
-
- b.Property<int>("MaxEmails")
- .HasColumnType("integer");
-
- b.Property<string>("NormalizedEmail")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedUserName")
- .HasColumnType("text");
-
- b.Property<DateTime>("PasswordChangedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("PasswordHash")
- .HasColumnType("text");
-
- b.Property<Guid>("PersonalGroupId")
- .HasColumnType("uuid");
-
- b.Property<string>("PhoneNumber")
- .HasColumnType("text");
-
- b.Property<bool>("PhoneNumberConfirmed")
- .HasColumnType("boolean");
-
- b.Property<string>("SecurityStamp")
- .HasColumnType("text");
-
- b.Property<bool>("ShadowBlocked")
- .HasColumnType("boolean");
-
- b.Property<DateTime?>("ShadowBlockedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("SrpIdentity")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<bool>("TwoFactorEnabled")
- .HasColumnType("boolean");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.HasIndex("PersonalGroupId")
- .IsUnique()
- .HasDatabaseName("UX_AliasVaultUsers_PersonalGroupId");
-
- b.ToTable("AliasVaultUsers");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("DeviceIdentifier")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime>("ExpireDate")
- .HasMaxLength(255)
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("IpAddress")
- .HasMaxLength(45)
- .HasColumnType("character varying(45)");
-
- b.Property<string>("PreviousTokenValue")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Value")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId");
-
- b.ToTable("AliasVaultUserRefreshTokens");
- });
-
- modelBuilder.Entity("AliasServerDb.AuthLog", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("AdditionalInfo")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Browser")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("Client")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("Country")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("DeviceType")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<int>("EventType")
- .HasColumnType("integer");
-
- b.Property<int?>("FailureReason")
- .HasColumnType("integer");
-
- b.Property<string>("IpAddress")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<bool>("IsSuccess")
- .HasColumnType("boolean");
-
- b.Property<bool>("IsSuspiciousActivity")
- .HasColumnType("boolean");
-
- b.Property<string>("OperatingSystem")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("RequestPath")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<DateTime>("Timestamp")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Username")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex(new[] { "EventType" }, "IX_EventType");
-
- b.HasIndex(new[] { "IpAddress" }, "IX_IpAddress");
-
- b.HasIndex(new[] { "Timestamp" }, "IX_Timestamp");
-
- b.HasIndex(new[] { "Username", "IsSuccess", "Timestamp" }, "IX_Username_IsSuccess_Timestamp")
- .IsDescending(false, false, true);
-
- b.HasIndex(new[] { "Username", "Timestamp" }, "IX_Username_Timestamp")
- .IsDescending(false, true);
-
- b.ToTable("AuthLogs");
- });
-
- modelBuilder.Entity("AliasServerDb.BlockedIpRange", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<bool>("BlockLogin")
- .HasColumnType("boolean");
-
- b.Property<bool>("BlockRegistration")
- .HasColumnType("boolean");
-
- b.Property<bool>("BlockShadow")
- .HasColumnType("boolean");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("CreatedBy")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<bool>("Enabled")
- .HasColumnType("boolean");
-
- b.Property<string>("IpRange")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("Reason")
- .HasMaxLength(500)
- .HasColumnType("character varying(500)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("Id");
-
- b.HasIndex(new[] { "Enabled" }, "IX_BlockedIpRange_Enabled");
-
- b.HasIndex(new[] { "IpRange" }, "IX_BlockedIpRange_IpRange")
- .IsUnique();
-
- b.ToTable("BlockedIpRanges");
- });
-
- modelBuilder.Entity("AliasServerDb.Email", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<DateTime>("Date")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime>("DateSystem")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedSymmetricKey")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<Guid>("EncryptionKeyId")
- .HasMaxLength(255)
- .HasColumnType("uuid");
-
- b.Property<string>("From")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("FromDomain")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("FromLocal")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("MessageHtml")
- .HasColumnType("text");
-
- b.Property<string>("MessagePlain")
- .HasColumnType("text");
-
- b.Property<string>("MessagePreview")
- .HasColumnType("text");
-
- b.Property<string>("MessageSource")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<bool>("PushNotificationSent")
- .HasColumnType("boolean");
-
- b.Property<string>("Subject")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("To")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("ToDomain")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("ToLocal")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<bool>("Visible")
- .HasColumnType("boolean");
-
- b.HasKey("Id");
-
- b.HasIndex("Date");
-
- b.HasIndex("DateSystem");
-
- b.HasIndex("EncryptionKeyId");
-
- b.HasIndex("PushNotificationSent");
-
- b.HasIndex("Visible");
-
- b.HasIndex("To", "DateSystem");
-
- b.ToTable("Emails");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailAttachment", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<byte[]>("Bytes")
- .IsRequired()
- .HasColumnType("bytea");
-
- b.Property<DateTime>("Date")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("EmailId")
- .HasColumnType("integer");
-
- b.Property<string>("Filename")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<int>("Filesize")
- .HasColumnType("integer");
-
- b.Property<string>("MimeType")
- .IsRequired()
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.HasIndex("EmailId");
-
- b.ToTable("EmailAttachments");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailClaim", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Address")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("AddressDomain")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("AddressLocal")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("Disabled")
- .HasColumnType("boolean");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid?>("VaultManifestId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("Address")
- .IsUnique();
-
- b.HasIndex("VaultManifestId", "CreatedAt");
-
- b.HasIndex("VaultManifestId", "Disabled");
-
- b.ToTable("EmailClaims");
- });
-
- modelBuilder.Entity("AliasServerDb.EncryptionKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("IsPrimary")
- .HasColumnType("boolean");
-
- b.Property<string>("PublicKey")
- .IsRequired()
- .HasMaxLength(2000)
- .HasColumnType("character varying(2000)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid>("VaultManifestId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("VaultManifestId")
- .IsUnique()
- .HasDatabaseName("UX_EncryptionKeys_Manifest_Primary")
- .HasFilter("\"IsPrimary\"");
-
- b.HasIndex("VaultManifestId", "IsPrimary");
-
- b.ToTable("EncryptionKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.Group", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Name")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<int>("Type")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("Id");
-
- b.ToTable("Groups");
- });
-
- modelBuilder.Entity("AliasServerDb.GroupMember", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid>("GroupId")
- .HasColumnType("uuid");
-
- b.Property<int>("Role")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId");
-
- b.HasIndex("GroupId", "UserId")
- .IsUnique();
-
- b.ToTable("GroupMembers");
- });
-
- modelBuilder.Entity("AliasServerDb.Log", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("Application")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("Exception")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Level")
- .IsRequired()
- .HasMaxLength(128)
- .HasColumnType("character varying(128)");
-
- b.Property<string>("LogEvent")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("LogEvent");
-
- b.Property<string>("Message")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("MessageTemplate")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Properties")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("SourceContext")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("TimeStamp")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("Id");
-
- b.HasIndex("Application");
-
- b.HasIndex("TimeStamp");
-
- b.ToTable("Logs", (string)null);
- });
-
- modelBuilder.Entity("AliasServerDb.MobileLoginRequest", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<DateTime?>("ClearedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("ClientIpAddress")
- .HasColumnType("text");
-
- b.Property<string>("ClientPublicKey")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedDecryptionKey")
- .HasColumnType("text");
-
- b.Property<DateTime?>("FulfilledAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("MobileIpAddress")
- .HasColumnType("text");
-
- b.Property<DateTime?>("RetrievedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.HasIndex(new[] { "ClientIpAddress" }, "IX_ClientIpAddress");
-
- b.HasIndex(new[] { "CreatedAt" }, "IX_CreatedAt");
-
- b.HasIndex(new[] { "MobileIpAddress" }, "IX_MobileIpAddress");
-
- b.HasIndex(new[] { "RetrievedAt", "ClearedAt", "FulfilledAt" }, "IX_RetrievedAt_ClearedAt_FulfilledAt");
-
- b.HasIndex(new[] { "UserId" }, "IX_UserId");
-
- b.ToTable("MobileLoginRequests");
- });
-
- modelBuilder.Entity("AliasServerDb.RateLimit", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<int?>("AppliesToAccountAgeMaxDays")
- .HasColumnType("integer");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("CreatedBy")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime?>("EffectiveFrom")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime?>("EffectiveUntil")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("Enabled")
- .HasColumnType("boolean");
-
- b.Property<int>("LimitType")
- .HasColumnType("integer");
-
- b.Property<int>("MaxCount")
- .HasColumnType("integer");
-
- b.Property<string>("Notes")
- .HasMaxLength(1000)
- .HasColumnType("character varying(1000)");
-
- b.Property<int?>("Tier")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<int>("WindowSeconds")
- .HasColumnType("integer");
-
- b.HasKey("Id");
-
- b.HasIndex("Tier");
-
- b.HasIndex("UserId");
-
- b.HasIndex("LimitType", "Enabled");
-
- b.ToTable("RateLimits");
- });
-
- modelBuilder.Entity("AliasServerDb.ServerSetting", b =>
- {
- b.Property<string>("Key")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Value")
- .HasColumnType("text");
-
- b.HasKey("Key");
-
- b.ToTable("ServerSettings");
- });
-
- modelBuilder.Entity("AliasServerDb.TaskRunnerJob", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<TimeOnly?>("EndTime")
- .HasColumnType("time without time zone");
-
- b.Property<string>("ErrorMessage")
- .HasColumnType("text");
-
- b.Property<bool>("IsOnDemand")
- .HasColumnType("boolean");
-
- b.Property<string>("Name")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<DateTime>("RunDate")
- .HasColumnType("timestamp with time zone");
-
- b.Property<TimeOnly>("StartTime")
- .HasColumnType("time without time zone");
-
- b.Property<int>("Status")
- .HasColumnType("integer");
-
- b.HasKey("Id");
-
- b.ToTable("TaskRunnerJobs");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobObject", b =>
- {
- b.Property<string>("Hash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<string>("OwnerUserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Category")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<byte[]>("EncryptedData")
- .IsRequired()
- .HasColumnType("bytea");
-
- b.Property<DateTime>("LastReferencedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("SizeBytes")
- .HasColumnType("integer");
-
- b.HasKey("Hash", "OwnerUserId");
-
- b.HasIndex("OwnerUserId", "Category");
-
- b.ToTable("VaultBlobObjects");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobReference", b =>
- {
- b.Property<Guid>("ManifestId")
- .HasColumnType("uuid");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("BlobHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.HasKey("ManifestId", "RevisionNumber", "BlobHash");
-
- b.ToTable("VaultBlobReferences");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucket", b =>
- {
- b.Property<string>("OwnerUserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Category")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("CiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedData")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("OwnerUserId", "Category");
-
- b.ToTable("VaultDataBuckets");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucketsHistory", b =>
- {
- b.Property<string>("OwnerUserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Category")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("CiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedData")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("OwnerUserId", "Category", "RevisionNumber");
-
- b.ToTable("VaultDataBucketsHistory");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Algorithm")
- .IsRequired()
- .HasMaxLength(30)
- .HasColumnType("character varying(30)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedVek")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<Guid?>("EncryptionKeyId")
- .HasColumnType("uuid");
-
- b.Property<DateTime?>("LastUsedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Metadata")
- .HasColumnType("jsonb");
-
- b.Property<int>("Type")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<Guid>("VaultManifestId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("EncryptionKeyId");
-
- b.HasIndex("VaultManifestId")
- .HasDatabaseName("IX_VaultKeys_VaultManifestId");
-
- b.HasIndex("UserId", "Type", "VaultManifestId")
- .IsUnique()
- .HasDatabaseName("UX_VaultKeys_UserId_Type_Manifest");
-
- b.ToTable("VaultKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifest", b =>
- {
- b.Property<Guid>("ManifestId")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Client")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("CredentialsCount")
- .HasColumnType("integer");
-
- b.Property<int>("EmailClaimsCount")
- .HasColumnType("integer");
-
- b.Property<string>("EncryptionSettings")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("EncryptionType")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<int>("FileSize")
- .HasColumnType("integer");
-
- b.Property<bool>("IsRoot")
- .HasColumnType("boolean");
-
- b.Property<string>("ManifestBlob")
- .HasColumnType("text");
-
- b.Property<string>("ManifestCiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<string>("Name")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<Guid>("OwnerGroupId")
- .HasColumnType("uuid");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("Salt")
- .IsRequired()
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("StorageFormat")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("VaultBlob")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Verifier")
- .IsRequired()
- .HasMaxLength(1000)
- .HasColumnType("character varying(1000)");
-
- b.Property<string>("Version")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("ManifestId");
-
- b.HasIndex("OwnerGroupId")
- .IsUnique()
- .HasDatabaseName("UX_VaultManifests_OwnerGroupId_Root")
- .HasFilter("\"IsRoot\"");
-
- b.ToTable("VaultManifests");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestsHistory", b =>
- {
- b.Property<Guid>("ManifestId")
- .HasColumnType("uuid");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("Client")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("CredentialsCount")
- .HasColumnType("integer");
-
- b.Property<int>("EmailClaimsCount")
- .HasColumnType("integer");
-
- b.Property<string>("EncryptionSettings")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("EncryptionType")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<int>("FileSize")
- .HasColumnType("integer");
-
- b.Property<string>("ManifestBlob")
- .HasColumnType("text");
-
- b.Property<string>("ManifestCiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<string>("Salt")
- .IsRequired()
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("StorageFormat")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("VaultBlob")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Verifier")
- .IsRequired()
- .HasMaxLength(1000)
- .HasColumnType("character varying(1000)");
-
- b.Property<string>("Version")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("ManifestId", "RevisionNumber");
-
- b.ToTable("VaultManifestsHistory", (string)null);
- });
-
- modelBuilder.Entity("AliasVault.WorkerStatus.Database.WorkerServiceStatus", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("CurrentStatus")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("DesiredStatus")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<DateTime>("Heartbeat")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("ServiceName")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.ToTable("WorkerServiceStatuses");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("FriendlyName")
- .HasColumnType("text");
-
- b.Property<string>("Xml")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("DataProtectionKeys");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("ClaimType")
- .HasColumnType("text");
-
- b.Property<string>("ClaimValue")
- .HasColumnType("text");
-
- b.Property<string>("RoleId")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("RoleClaims", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("ClaimType")
- .HasColumnType("text");
-
- b.Property<string>("ClaimValue")
- .HasColumnType("text");
-
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("UserClaims", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
- {
- b.Property<string>("LoginProvider")
- .HasColumnType("text");
-
- b.Property<string>("ProviderKey")
- .HasColumnType("text");
-
- b.Property<string>("ProviderDisplayName")
- .HasColumnType("text");
-
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.HasKey("LoginProvider", "ProviderKey");
-
- b.ToTable("UserLogins", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
- {
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.Property<string>("RoleId")
- .HasColumnType("text");
-
- b.HasKey("UserId", "RoleId");
-
- b.ToTable("UserRoles", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
- {
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.Property<string>("LoginProvider")
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.Property<string>("Value")
- .HasColumnType("text");
-
- b.HasKey("UserId", "LoginProvider", "Name");
-
- b.ToTable("UserTokens", (string)null);
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>
- {
- b.HasOne("AliasServerDb.Group", "PersonalGroup")
- .WithOne()
- .HasForeignKey("AliasServerDb.AliasVaultUser", "PersonalGroupId")
- .OnDelete(DeleteBehavior.Restrict)
- .IsRequired();
-
- b.Navigation("PersonalGroup");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.Email", b =>
- {
- b.HasOne("AliasServerDb.EncryptionKey", "EncryptionKey")
- .WithMany("Emails")
- .HasForeignKey("EncryptionKeyId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("EncryptionKey");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailAttachment", b =>
- {
- b.HasOne("AliasServerDb.Email", "Email")
- .WithMany("Attachments")
- .HasForeignKey("EmailId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Email");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailClaim", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "VaultManifest")
- .WithMany()
- .HasForeignKey("VaultManifestId")
- .OnDelete(DeleteBehavior.SetNull);
-
- b.Navigation("VaultManifest");
- });
-
- modelBuilder.Entity("AliasServerDb.EncryptionKey", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "VaultManifest")
- .WithMany()
- .HasForeignKey("VaultManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("VaultManifest");
- });
-
- modelBuilder.Entity("AliasServerDb.GroupMember", b =>
- {
- b.HasOne("AliasServerDb.Group", "Group")
- .WithMany("Members")
- .HasForeignKey("GroupId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Group");
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.MobileLoginRequest", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.RateLimit", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobObject", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("OwnerUserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobReference", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "Manifest")
- .WithMany()
- .HasForeignKey("ManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Manifest");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucket", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("OwnerUserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucketsHistory", b =>
- {
- b.HasOne("AliasServerDb.VaultDataBucket", "Bucket")
- .WithMany()
- .HasForeignKey("OwnerUserId", "Category")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Bucket");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultKey", b =>
- {
- b.HasOne("AliasServerDb.EncryptionKey", "EncryptionKey")
- .WithMany()
- .HasForeignKey("EncryptionKeyId")
- .OnDelete(DeleteBehavior.SetNull);
-
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany("VaultKeys")
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("EncryptionKey");
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifest", b =>
- {
- b.HasOne("AliasServerDb.Group", "OwnerGroup")
- .WithMany()
- .HasForeignKey("OwnerGroupId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("OwnerGroup");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestsHistory", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "Manifest")
- .WithMany()
- .HasForeignKey("ManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Manifest");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>
- {
- b.Navigation("VaultKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.Email", b =>
- {
- b.Navigation("Attachments");
- });
-
- modelBuilder.Entity("AliasServerDb.EncryptionKey", b =>
- {
- b.Navigation("Emails");
- });
-
- modelBuilder.Entity("AliasServerDb.Group", b =>
- {
- b.Navigation("Members");
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/apps/server/Databases/AliasServerDb/Migrations/20260731142702_ScopeEncryptionKeysToManifests.cs b/apps/server/Databases/AliasServerDb/Migrations/20260731142702_ScopeEncryptionKeysToManifests.cs
deleted file mode 100644
index dac0ae7c9..000000000
--- a/apps/server/Databases/AliasServerDb/Migrations/20260731142702_ScopeEncryptionKeysToManifests.cs
+++ /dev/null
@@ -1,153 +0,0 @@
-using System;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-#nullable disable
-
-namespace AliasServerDb.Migrations
-{
- /// <inheritdoc />
- public partial class ScopeEncryptionKeysToManifests : Migration
- {
- /// <inheritdoc />
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- // Scope every personal key to its user's root manifest.
- migrationBuilder.Sql(@"
- UPDATE ""EncryptionKeys"" k
- SET ""VaultManifestId"" = m.""ManifestId""
- FROM ""AliasVaultUsers"" u
- JOIN ""VaultManifests"" m ON m.""OwnerGroupId"" = u.""PersonalGroupId"" AND m.""IsRoot""
- WHERE k.""UserId"" = u.""Id""
- AND k.""VaultManifestId"" IS NULL;");
-
- // A key that still has no manifest is an orphan (its user or their root manifest is gone) and can
- // no longer be resolved by anything; remove it so the column can become non-nullable.
- migrationBuilder.Sql(@"DELETE FROM ""EncryptionKeys"" WHERE ""VaultManifestId"" IS NULL;");
-
- // Enforce one primary per manifest below.
- migrationBuilder.Sql(@"
- UPDATE ""EncryptionKeys"" k
- SET ""IsPrimary"" = FALSE
- WHERE k.""IsPrimary""
- AND k.""Id"" NOT IN (
- SELECT DISTINCT ON (""VaultManifestId"") ""Id""
- FROM ""EncryptionKeys""
- WHERE ""IsPrimary""
- ORDER BY ""VaultManifestId"", ""UpdatedAt"" DESC, ""Id"");");
-
- migrationBuilder.DropForeignKey(
- name: "FK_EmailClaims_EncryptionKeys_EncryptionKeyId",
- table: "EmailClaims");
-
- migrationBuilder.DropForeignKey(
- name: "FK_EncryptionKeys_AliasVaultUsers_UserId",
- table: "EncryptionKeys");
-
- migrationBuilder.DropIndex(
- name: "IX_EncryptionKeys_UserId_VaultManifestId_IsPrimary",
- table: "EncryptionKeys");
-
- migrationBuilder.DropIndex(
- name: "IX_EncryptionKeys_VaultManifestId",
- table: "EncryptionKeys");
-
- migrationBuilder.DropIndex(
- name: "IX_EmailClaims_EncryptionKeyId",
- table: "EmailClaims");
-
- migrationBuilder.DropColumn(
- name: "UserId",
- table: "EncryptionKeys");
-
- migrationBuilder.DropColumn(
- name: "EncryptionKeyId",
- table: "EmailClaims");
-
- migrationBuilder.AlterColumn<Guid>(
- name: "VaultManifestId",
- table: "EncryptionKeys",
- type: "uuid",
- nullable: false,
- defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
- oldClrType: typeof(Guid),
- oldType: "uuid",
- oldNullable: true);
-
- migrationBuilder.CreateIndex(
- name: "IX_EncryptionKeys_VaultManifestId_IsPrimary",
- table: "EncryptionKeys",
- columns: new[] { "VaultManifestId", "IsPrimary" });
-
- migrationBuilder.CreateIndex(
- name: "UX_EncryptionKeys_Manifest_Primary",
- table: "EncryptionKeys",
- column: "VaultManifestId",
- unique: true,
- filter: "\"IsPrimary\"");
- }
-
- /// <inheritdoc />
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropIndex(
- name: "IX_EncryptionKeys_VaultManifestId_IsPrimary",
- table: "EncryptionKeys");
-
- migrationBuilder.DropIndex(
- name: "UX_EncryptionKeys_Manifest_Primary",
- table: "EncryptionKeys");
-
- migrationBuilder.AlterColumn<Guid>(
- name: "VaultManifestId",
- table: "EncryptionKeys",
- type: "uuid",
- nullable: true,
- oldClrType: typeof(Guid),
- oldType: "uuid");
-
- migrationBuilder.AddColumn<string>(
- name: "UserId",
- table: "EncryptionKeys",
- type: "character varying(255)",
- maxLength: 255,
- nullable: true);
-
- migrationBuilder.AddColumn<Guid>(
- name: "EncryptionKeyId",
- table: "EmailClaims",
- type: "uuid",
- nullable: true);
-
- migrationBuilder.CreateIndex(
- name: "IX_EncryptionKeys_UserId_VaultManifestId_IsPrimary",
- table: "EncryptionKeys",
- columns: new[] { "UserId", "VaultManifestId", "IsPrimary" });
-
- migrationBuilder.CreateIndex(
- name: "IX_EncryptionKeys_VaultManifestId",
- table: "EncryptionKeys",
- column: "VaultManifestId");
-
- migrationBuilder.CreateIndex(
- name: "IX_EmailClaims_EncryptionKeyId",
- table: "EmailClaims",
- column: "EncryptionKeyId");
-
- migrationBuilder.AddForeignKey(
- name: "FK_EmailClaims_EncryptionKeys_EncryptionKeyId",
- table: "EmailClaims",
- column: "EncryptionKeyId",
- principalTable: "EncryptionKeys",
- principalColumn: "Id",
- onDelete: ReferentialAction.Restrict);
-
- migrationBuilder.AddForeignKey(
- name: "FK_EncryptionKeys_AliasVaultUsers_UserId",
- table: "EncryptionKeys",
- column: "UserId",
- principalTable: "AliasVaultUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- }
- }
-}
diff --git a/apps/server/Databases/AliasServerDb/Migrations/20260801100531_AccountKeyHierarchy.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/20260801100531_AccountKeyHierarchy.Designer.cs
deleted file mode 100644
index 2e28d802a..000000000
--- a/apps/server/Databases/AliasServerDb/Migrations/20260801100531_AccountKeyHierarchy.Designer.cs
+++ /dev/null
@@ -1,1657 +0,0 @@
-// <auto-generated />
-using System;
-using AliasServerDb;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
-
-#nullable disable
-
-namespace AliasServerDb.Migrations
-{
- [DbContext(typeof(AliasServerDbContext))]
- [Migration("20260801100531_AccountKeyHierarchy")]
- partial class AccountKeyHierarchy
- {
- /// <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)
- .HasAnnotation("Relational:MaxIdentifierLength", 63);
-
- NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
-
- modelBuilder.Entity("AliasServerDb.AdminRole", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("AdminRoles");
- });
-
- modelBuilder.Entity("AliasServerDb.AdminUser", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<int>("AccessFailedCount")
- .HasColumnType("integer");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<string>("Email")
- .HasColumnType("text");
-
- b.Property<bool>("EmailConfirmed")
- .HasColumnType("boolean");
-
- b.Property<DateTime?>("LastPasswordChanged")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("LockoutEnabled")
- .HasColumnType("boolean");
-
- b.Property<DateTimeOffset?>("LockoutEnd")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("NormalizedEmail")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedUserName")
- .HasColumnType("text");
-
- b.Property<string>("PasswordHash")
- .HasColumnType("text");
-
- b.Property<string>("PhoneNumber")
- .HasColumnType("text");
-
- b.Property<bool>("PhoneNumberConfirmed")
- .HasColumnType("boolean");
-
- b.Property<string>("SecurityStamp")
- .HasColumnType("text");
-
- b.Property<bool>("TwoFactorEnabled")
- .HasColumnType("boolean");
-
- b.Property<string>("UserName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("AdminUsers");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultRole", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("AliasVaultRoles");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<int>("AccessFailedCount")
- .HasColumnType("integer");
-
- b.Property<bool>("Blocked")
- .HasColumnType("boolean");
-
- b.Property<DateTime?>("BlockedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Email")
- .HasColumnType("text");
-
- b.Property<bool>("EmailConfirmed")
- .HasColumnType("boolean");
-
- b.Property<int>("EmailsReceived")
- .HasColumnType("integer");
-
- b.Property<DateTime?>("LastActivityDate")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("LockoutEnabled")
- .HasColumnType("boolean");
-
- b.Property<DateTimeOffset?>("LockoutEnd")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("MaxEmailAgeDays")
- .HasColumnType("integer");
-
- b.Property<int>("MaxEmails")
- .HasColumnType("integer");
-
- b.Property<string>("NormalizedEmail")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedUserName")
- .HasColumnType("text");
-
- b.Property<DateTime>("PasswordChangedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("PasswordHash")
- .HasColumnType("text");
-
- b.Property<Guid>("PersonalGroupId")
- .HasColumnType("uuid");
-
- b.Property<string>("PhoneNumber")
- .HasColumnType("text");
-
- b.Property<bool>("PhoneNumberConfirmed")
- .HasColumnType("boolean");
-
- b.Property<string>("SecurityStamp")
- .HasColumnType("text");
-
- b.Property<bool>("ShadowBlocked")
- .HasColumnType("boolean");
-
- b.Property<DateTime?>("ShadowBlockedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("SrpIdentity")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<bool>("TwoFactorEnabled")
- .HasColumnType("boolean");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.HasIndex("PersonalGroupId")
- .IsUnique()
- .HasDatabaseName("UX_AliasVaultUsers_PersonalGroupId");
-
- b.ToTable("AliasVaultUsers");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("DeviceIdentifier")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime>("ExpireDate")
- .HasMaxLength(255)
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("IpAddress")
- .HasMaxLength(45)
- .HasColumnType("character varying(45)");
-
- b.Property<string>("PreviousTokenValue")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Value")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId");
-
- b.ToTable("AliasVaultUserRefreshTokens");
- });
-
- modelBuilder.Entity("AliasServerDb.AuthLog", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("AdditionalInfo")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Browser")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("Client")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("Country")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("DeviceType")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<int>("EventType")
- .HasColumnType("integer");
-
- b.Property<int?>("FailureReason")
- .HasColumnType("integer");
-
- b.Property<string>("IpAddress")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<bool>("IsSuccess")
- .HasColumnType("boolean");
-
- b.Property<bool>("IsSuspiciousActivity")
- .HasColumnType("boolean");
-
- b.Property<string>("OperatingSystem")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("RequestPath")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<DateTime>("Timestamp")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Username")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex(new[] { "EventType" }, "IX_EventType");
-
- b.HasIndex(new[] { "IpAddress" }, "IX_IpAddress");
-
- b.HasIndex(new[] { "Timestamp" }, "IX_Timestamp");
-
- b.HasIndex(new[] { "Username", "IsSuccess", "Timestamp" }, "IX_Username_IsSuccess_Timestamp")
- .IsDescending(false, false, true);
-
- b.HasIndex(new[] { "Username", "Timestamp" }, "IX_Username_Timestamp")
- .IsDescending(false, true);
-
- b.ToTable("AuthLogs");
- });
-
- modelBuilder.Entity("AliasServerDb.BlockedIpRange", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<bool>("BlockLogin")
- .HasColumnType("boolean");
-
- b.Property<bool>("BlockRegistration")
- .HasColumnType("boolean");
-
- b.Property<bool>("BlockShadow")
- .HasColumnType("boolean");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("CreatedBy")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<bool>("Enabled")
- .HasColumnType("boolean");
-
- b.Property<string>("IpRange")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("Reason")
- .HasMaxLength(500)
- .HasColumnType("character varying(500)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("Id");
-
- b.HasIndex(new[] { "Enabled" }, "IX_BlockedIpRange_Enabled");
-
- b.HasIndex(new[] { "IpRange" }, "IX_BlockedIpRange_IpRange")
- .IsUnique();
-
- b.ToTable("BlockedIpRanges");
- });
-
- modelBuilder.Entity("AliasServerDb.Email", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<DateTime>("Date")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime>("DateSystem")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedSymmetricKey")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<Guid>("EncryptionKeyId")
- .HasMaxLength(255)
- .HasColumnType("uuid");
-
- b.Property<string>("From")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("FromDomain")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("FromLocal")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("MessageHtml")
- .HasColumnType("text");
-
- b.Property<string>("MessagePlain")
- .HasColumnType("text");
-
- b.Property<string>("MessagePreview")
- .HasColumnType("text");
-
- b.Property<string>("MessageSource")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<bool>("PushNotificationSent")
- .HasColumnType("boolean");
-
- b.Property<string>("Subject")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("To")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("ToDomain")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("ToLocal")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<bool>("Visible")
- .HasColumnType("boolean");
-
- b.HasKey("Id");
-
- b.HasIndex("Date");
-
- b.HasIndex("DateSystem");
-
- b.HasIndex("EncryptionKeyId");
-
- b.HasIndex("PushNotificationSent");
-
- b.HasIndex("Visible");
-
- b.HasIndex("To", "DateSystem");
-
- b.ToTable("Emails");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailAttachment", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<byte[]>("Bytes")
- .IsRequired()
- .HasColumnType("bytea");
-
- b.Property<DateTime>("Date")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("EmailId")
- .HasColumnType("integer");
-
- b.Property<string>("Filename")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<int>("Filesize")
- .HasColumnType("integer");
-
- b.Property<string>("MimeType")
- .IsRequired()
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.HasIndex("EmailId");
-
- b.ToTable("EmailAttachments");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailClaim", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Address")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("AddressDomain")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("AddressLocal")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("Disabled")
- .HasColumnType("boolean");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid?>("VaultManifestId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("Address")
- .IsUnique();
-
- b.HasIndex("VaultManifestId", "CreatedAt");
-
- b.HasIndex("VaultManifestId", "Disabled");
-
- b.ToTable("EmailClaims");
- });
-
- modelBuilder.Entity("AliasServerDb.EncryptionKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("IsPrimary")
- .HasColumnType("boolean");
-
- b.Property<string>("PublicKey")
- .IsRequired()
- .HasMaxLength(2000)
- .HasColumnType("character varying(2000)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid>("VaultManifestId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("VaultManifestId")
- .IsUnique()
- .HasDatabaseName("UX_EncryptionKeys_Manifest_Primary")
- .HasFilter("\"IsPrimary\"");
-
- b.HasIndex("VaultManifestId", "IsPrimary");
-
- b.ToTable("EncryptionKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.Group", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Name")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<int>("Type")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("Id");
-
- b.ToTable("Groups");
- });
-
- modelBuilder.Entity("AliasServerDb.GroupMember", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid>("GroupId")
- .HasColumnType("uuid");
-
- b.Property<int>("Role")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId");
-
- b.HasIndex("GroupId", "UserId")
- .IsUnique();
-
- b.ToTable("GroupMembers");
- });
-
- modelBuilder.Entity("AliasServerDb.Log", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("Application")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("Exception")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Level")
- .IsRequired()
- .HasMaxLength(128)
- .HasColumnType("character varying(128)");
-
- b.Property<string>("LogEvent")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("LogEvent");
-
- b.Property<string>("Message")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("MessageTemplate")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Properties")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("SourceContext")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("TimeStamp")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("Id");
-
- b.HasIndex("Application");
-
- b.HasIndex("TimeStamp");
-
- b.ToTable("Logs", (string)null);
- });
-
- modelBuilder.Entity("AliasServerDb.MobileLoginRequest", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<DateTime?>("ClearedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("ClientIpAddress")
- .HasColumnType("text");
-
- b.Property<string>("ClientPublicKey")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedDecryptionKey")
- .HasColumnType("text");
-
- b.Property<DateTime?>("FulfilledAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("MobileIpAddress")
- .HasColumnType("text");
-
- b.Property<DateTime?>("RetrievedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.HasIndex(new[] { "ClientIpAddress" }, "IX_ClientIpAddress");
-
- b.HasIndex(new[] { "CreatedAt" }, "IX_CreatedAt");
-
- b.HasIndex(new[] { "MobileIpAddress" }, "IX_MobileIpAddress");
-
- b.HasIndex(new[] { "RetrievedAt", "ClearedAt", "FulfilledAt" }, "IX_RetrievedAt_ClearedAt_FulfilledAt");
-
- b.HasIndex(new[] { "UserId" }, "IX_UserId");
-
- b.ToTable("MobileLoginRequests");
- });
-
- modelBuilder.Entity("AliasServerDb.RateLimit", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<int?>("AppliesToAccountAgeMaxDays")
- .HasColumnType("integer");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("CreatedBy")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime?>("EffectiveFrom")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime?>("EffectiveUntil")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("Enabled")
- .HasColumnType("boolean");
-
- b.Property<int>("LimitType")
- .HasColumnType("integer");
-
- b.Property<int>("MaxCount")
- .HasColumnType("integer");
-
- b.Property<string>("Notes")
- .HasMaxLength(1000)
- .HasColumnType("character varying(1000)");
-
- b.Property<int?>("Tier")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<int>("WindowSeconds")
- .HasColumnType("integer");
-
- b.HasKey("Id");
-
- b.HasIndex("Tier");
-
- b.HasIndex("UserId");
-
- b.HasIndex("LimitType", "Enabled");
-
- b.ToTable("RateLimits");
- });
-
- modelBuilder.Entity("AliasServerDb.ServerSetting", b =>
- {
- b.Property<string>("Key")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Value")
- .HasColumnType("text");
-
- b.HasKey("Key");
-
- b.ToTable("ServerSettings");
- });
-
- modelBuilder.Entity("AliasServerDb.TaskRunnerJob", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<TimeOnly?>("EndTime")
- .HasColumnType("time without time zone");
-
- b.Property<string>("ErrorMessage")
- .HasColumnType("text");
-
- b.Property<bool>("IsOnDemand")
- .HasColumnType("boolean");
-
- b.Property<string>("Name")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<DateTime>("RunDate")
- .HasColumnType("timestamp with time zone");
-
- b.Property<TimeOnly>("StartTime")
- .HasColumnType("time without time zone");
-
- b.Property<int>("Status")
- .HasColumnType("integer");
-
- b.HasKey("Id");
-
- b.ToTable("TaskRunnerJobs");
- });
-
- modelBuilder.Entity("AliasServerDb.UserKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedPrivateKey")
- .IsRequired()
- .HasMaxLength(4000)
- .HasColumnType("character varying(4000)");
-
- b.Property<bool>("IsPrimary")
- .HasColumnType("boolean");
-
- b.Property<string>("PublicKey")
- .IsRequired()
- .HasMaxLength(2000)
- .HasColumnType("character varying(2000)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId")
- .IsUnique()
- .HasDatabaseName("UX_UserKeys_User_Primary")
- .HasFilter("\"IsPrimary\"");
-
- b.ToTable("UserKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.UserUnlockKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Algorithm")
- .IsRequired()
- .HasMaxLength(30)
- .HasColumnType("character varying(30)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedAccountKey")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime?>("LastUsedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Metadata")
- .HasColumnType("jsonb");
-
- b.Property<int>("Type")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId", "Type")
- .IsUnique()
- .HasDatabaseName("UX_UserUnlockKeys_UserId_Type");
-
- b.ToTable("UserUnlockKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobObject", b =>
- {
- b.Property<string>("Hash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<string>("OwnerUserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Category")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<byte[]>("EncryptedData")
- .IsRequired()
- .HasColumnType("bytea");
-
- b.Property<DateTime>("LastReferencedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("SizeBytes")
- .HasColumnType("integer");
-
- b.HasKey("Hash", "OwnerUserId");
-
- b.HasIndex("OwnerUserId", "Category");
-
- b.ToTable("VaultBlobObjects");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobReference", b =>
- {
- b.Property<Guid>("ManifestId")
- .HasColumnType("uuid");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("BlobHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.HasKey("ManifestId", "RevisionNumber", "BlobHash");
-
- b.ToTable("VaultBlobReferences");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucket", b =>
- {
- b.Property<string>("OwnerUserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Category")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("CiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedData")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("OwnerUserId", "Category");
-
- b.ToTable("VaultDataBuckets");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucketsHistory", b =>
- {
- b.Property<string>("OwnerUserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Category")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("CiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedData")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("OwnerUserId", "Category", "RevisionNumber");
-
- b.ToTable("VaultDataBucketsHistory");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Algorithm")
- .IsRequired()
- .HasMaxLength(30)
- .HasColumnType("character varying(30)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedVek")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime?>("LastUsedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Metadata")
- .HasColumnType("jsonb");
-
- b.Property<int>("Type")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<Guid?>("UserKeyId")
- .HasColumnType("uuid");
-
- b.Property<Guid>("VaultManifestId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("UserKeyId");
-
- b.HasIndex("VaultManifestId")
- .HasDatabaseName("IX_VaultKeys_VaultManifestId");
-
- b.HasIndex("UserId", "Type", "VaultManifestId")
- .IsUnique()
- .HasDatabaseName("UX_VaultKeys_UserId_Type_Manifest");
-
- b.ToTable("VaultKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifest", b =>
- {
- b.Property<Guid>("ManifestId")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Client")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("CredentialsCount")
- .HasColumnType("integer");
-
- b.Property<int>("EmailClaimsCount")
- .HasColumnType("integer");
-
- b.Property<string>("EncryptionSettings")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("EncryptionType")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<int>("FileSize")
- .HasColumnType("integer");
-
- b.Property<bool>("IsRoot")
- .HasColumnType("boolean");
-
- b.Property<string>("ManifestBlob")
- .HasColumnType("text");
-
- b.Property<string>("ManifestCiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<string>("Name")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<Guid>("OwnerGroupId")
- .HasColumnType("uuid");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("Salt")
- .IsRequired()
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("StorageFormat")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("VaultBlob")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Verifier")
- .IsRequired()
- .HasMaxLength(1000)
- .HasColumnType("character varying(1000)");
-
- b.Property<string>("Version")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("ManifestId");
-
- b.HasIndex("OwnerGroupId")
- .IsUnique()
- .HasDatabaseName("UX_VaultManifests_OwnerGroupId_Root")
- .HasFilter("\"IsRoot\"");
-
- b.ToTable("VaultManifests");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestsHistory", b =>
- {
- b.Property<Guid>("ManifestId")
- .HasColumnType("uuid");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("Client")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("CredentialsCount")
- .HasColumnType("integer");
-
- b.Property<int>("EmailClaimsCount")
- .HasColumnType("integer");
-
- b.Property<string>("EncryptionSettings")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("EncryptionType")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<int>("FileSize")
- .HasColumnType("integer");
-
- b.Property<string>("ManifestBlob")
- .HasColumnType("text");
-
- b.Property<string>("ManifestCiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<string>("Salt")
- .IsRequired()
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("StorageFormat")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("VaultBlob")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Verifier")
- .IsRequired()
- .HasMaxLength(1000)
- .HasColumnType("character varying(1000)");
-
- b.Property<string>("Version")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("ManifestId", "RevisionNumber");
-
- b.ToTable("VaultManifestsHistory", (string)null);
- });
-
- modelBuilder.Entity("AliasVault.WorkerStatus.Database.WorkerServiceStatus", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("CurrentStatus")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("DesiredStatus")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<DateTime>("Heartbeat")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("ServiceName")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.ToTable("WorkerServiceStatuses");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("FriendlyName")
- .HasColumnType("text");
-
- b.Property<string>("Xml")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("DataProtectionKeys");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("ClaimType")
- .HasColumnType("text");
-
- b.Property<string>("ClaimValue")
- .HasColumnType("text");
-
- b.Property<string>("RoleId")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("RoleClaims", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("ClaimType")
- .HasColumnType("text");
-
- b.Property<string>("ClaimValue")
- .HasColumnType("text");
-
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("UserClaims", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
- {
- b.Property<string>("LoginProvider")
- .HasColumnType("text");
-
- b.Property<string>("ProviderKey")
- .HasColumnType("text");
-
- b.Property<string>("ProviderDisplayName")
- .HasColumnType("text");
-
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.HasKey("LoginProvider", "ProviderKey");
-
- b.ToTable("UserLogins", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
- {
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.Property<string>("RoleId")
- .HasColumnType("text");
-
- b.HasKey("UserId", "RoleId");
-
- b.ToTable("UserRoles", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
- {
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.Property<string>("LoginProvider")
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.Property<string>("Value")
- .HasColumnType("text");
-
- b.HasKey("UserId", "LoginProvider", "Name");
-
- b.ToTable("UserTokens", (string)null);
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>
- {
- b.HasOne("AliasServerDb.Group", "PersonalGroup")
- .WithOne()
- .HasForeignKey("AliasServerDb.AliasVaultUser", "PersonalGroupId")
- .OnDelete(DeleteBehavior.Restrict)
- .IsRequired();
-
- b.Navigation("PersonalGroup");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.Email", b =>
- {
- b.HasOne("AliasServerDb.EncryptionKey", "EncryptionKey")
- .WithMany("Emails")
- .HasForeignKey("EncryptionKeyId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("EncryptionKey");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailAttachment", b =>
- {
- b.HasOne("AliasServerDb.Email", "Email")
- .WithMany("Attachments")
- .HasForeignKey("EmailId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Email");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailClaim", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "VaultManifest")
- .WithMany()
- .HasForeignKey("VaultManifestId")
- .OnDelete(DeleteBehavior.SetNull);
-
- b.Navigation("VaultManifest");
- });
-
- modelBuilder.Entity("AliasServerDb.EncryptionKey", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "VaultManifest")
- .WithMany()
- .HasForeignKey("VaultManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("VaultManifest");
- });
-
- modelBuilder.Entity("AliasServerDb.GroupMember", b =>
- {
- b.HasOne("AliasServerDb.Group", "Group")
- .WithMany("Members")
- .HasForeignKey("GroupId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Group");
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.MobileLoginRequest", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.RateLimit", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.UserKey", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.UserUnlockKey", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobObject", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("OwnerUserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobReference", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "Manifest")
- .WithMany()
- .HasForeignKey("ManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Manifest");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucket", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("OwnerUserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucketsHistory", b =>
- {
- b.HasOne("AliasServerDb.VaultDataBucket", "Bucket")
- .WithMany()
- .HasForeignKey("OwnerUserId", "Category")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Bucket");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultKey", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany("VaultKeys")
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("AliasServerDb.UserKey", "UserKey")
- .WithMany()
- .HasForeignKey("UserKeyId")
- .OnDelete(DeleteBehavior.SetNull);
-
- b.Navigation("User");
-
- b.Navigation("UserKey");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifest", b =>
- {
- b.HasOne("AliasServerDb.Group", "OwnerGroup")
- .WithMany()
- .HasForeignKey("OwnerGroupId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("OwnerGroup");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestsHistory", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "Manifest")
- .WithMany()
- .HasForeignKey("ManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Manifest");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>
- {
- b.Navigation("VaultKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.Email", b =>
- {
- b.Navigation("Attachments");
- });
-
- modelBuilder.Entity("AliasServerDb.EncryptionKey", b =>
- {
- b.Navigation("Emails");
- });
-
- modelBuilder.Entity("AliasServerDb.Group", b =>
- {
- b.Navigation("Members");
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/apps/server/Databases/AliasServerDb/Migrations/20260801100531_AccountKeyHierarchy.cs b/apps/server/Databases/AliasServerDb/Migrations/20260801100531_AccountKeyHierarchy.cs
deleted file mode 100644
index ae16c8b40..000000000
--- a/apps/server/Databases/AliasServerDb/Migrations/20260801100531_AccountKeyHierarchy.cs
+++ /dev/null
@@ -1,143 +0,0 @@
-// <auto-generated>
-using System;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-#nullable disable
-
-namespace AliasServerDb.Migrations
-{
- /// <inheritdoc />
- public partial class AccountKeyHierarchy : Migration
- {
- /// <inheritdoc />
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropForeignKey(
- name: "FK_VaultKeys_EncryptionKeys_EncryptionKeyId",
- table: "VaultKeys");
-
- migrationBuilder.RenameColumn(
- name: "EncryptionKeyId",
- table: "VaultKeys",
- newName: "UserKeyId");
-
- migrationBuilder.RenameIndex(
- name: "IX_VaultKeys_EncryptionKeyId",
- table: "VaultKeys",
- newName: "IX_VaultKeys_UserKeyId");
-
- migrationBuilder.CreateTable(
- name: "UserKeys",
- columns: table => new
- {
- Id = table.Column<Guid>(type: "uuid", nullable: false),
- UserId = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
- PublicKey = table.Column<string>(type: "character varying(2000)", maxLength: 2000, nullable: false),
- EncryptedPrivateKey = table.Column<string>(type: "character varying(4000)", maxLength: 4000, nullable: false),
- IsPrimary = table.Column<bool>(type: "boolean", nullable: false),
- CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
- UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_UserKeys", x => x.Id);
- table.ForeignKey(
- name: "FK_UserKeys_AliasVaultUsers_UserId",
- column: x => x.UserId,
- principalTable: "AliasVaultUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateTable(
- name: "UserUnlockKeys",
- columns: table => new
- {
- Id = table.Column<Guid>(type: "uuid", nullable: false),
- UserId = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
- Type = table.Column<int>(type: "integer", nullable: false),
- Algorithm = table.Column<string>(type: "character varying(30)", maxLength: 30, nullable: false),
- EncryptedAccountKey = table.Column<string>(type: "text", nullable: false),
- Metadata = table.Column<string>(type: "jsonb", nullable: true),
- CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
- UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
- LastUsedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_UserUnlockKeys", x => x.Id);
- table.ForeignKey(
- name: "FK_UserUnlockKeys_AliasVaultUsers_UserId",
- column: x => x.UserId,
- principalTable: "AliasVaultUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateIndex(
- name: "UX_UserKeys_User_Primary",
- table: "UserKeys",
- column: "UserId",
- unique: true,
- filter: "\"IsPrimary\"");
-
- migrationBuilder.CreateIndex(
- name: "UX_UserUnlockKeys_UserId_Type",
- table: "UserUnlockKeys",
- columns: new[] { "UserId", "Type" },
- unique: true);
-
- // Convert pre-account-key password rows into unlock-method rows. Type 0 = Password.
- migrationBuilder.Sql("""
- INSERT INTO "UserUnlockKeys" ("Id", "UserId", "Type", "Algorithm", "EncryptedAccountKey", "Metadata", "CreatedAt", "UpdatedAt", "LastUsedAt")
- SELECT "Id", "UserId", "Type", "Algorithm", "EncryptedVek", "Metadata", "CreatedAt", "UpdatedAt", "LastUsedAt"
- FROM "VaultKeys" WHERE "Type" = 0;
- """);
- migrationBuilder.Sql("""DELETE FROM "VaultKeys" WHERE "Type" = 0;""");
-
- // Surviving grant rows still reference pre-rename EncryptionKey ids.
- // Clear them so the new foreign key can be created against UserKeys.
- migrationBuilder.Sql("""UPDATE "VaultKeys" SET "UserKeyId" = NULL WHERE "UserKeyId" IS NOT NULL;""");
-
- migrationBuilder.AddForeignKey(
- name: "FK_VaultKeys_UserKeys_UserKeyId",
- table: "VaultKeys",
- column: "UserKeyId",
- principalTable: "UserKeys",
- principalColumn: "Id",
- onDelete: ReferentialAction.SetNull);
- }
-
- /// <inheritdoc />
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropForeignKey(
- name: "FK_VaultKeys_UserKeys_UserKeyId",
- table: "VaultKeys");
-
- migrationBuilder.DropTable(
- name: "UserKeys");
-
- migrationBuilder.DropTable(
- name: "UserUnlockKeys");
-
- migrationBuilder.RenameColumn(
- name: "UserKeyId",
- table: "VaultKeys",
- newName: "EncryptionKeyId");
-
- migrationBuilder.RenameIndex(
- name: "IX_VaultKeys_UserKeyId",
- table: "VaultKeys",
- newName: "IX_VaultKeys_EncryptionKeyId");
-
- migrationBuilder.AddForeignKey(
- name: "FK_VaultKeys_EncryptionKeys_EncryptionKeyId",
- table: "VaultKeys",
- column: "EncryptionKeyId",
- principalTable: "EncryptionKeys",
- principalColumn: "Id",
- onDelete: ReferentialAction.SetNull);
- }
- }
-}
diff --git a/apps/server/Databases/AliasServerDb/Migrations/20260801120718_DescriptiveKeyTableNames.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/20260801120718_DescriptiveKeyTableNames.Designer.cs
deleted file mode 100644
index 797de9370..000000000
--- a/apps/server/Databases/AliasServerDb/Migrations/20260801120718_DescriptiveKeyTableNames.Designer.cs
+++ /dev/null
@@ -1,1657 +0,0 @@
-// <auto-generated />
-using System;
-using AliasServerDb;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
-
-#nullable disable
-
-namespace AliasServerDb.Migrations
-{
- [DbContext(typeof(AliasServerDbContext))]
- [Migration("20260801120718_DescriptiveKeyTableNames")]
- partial class DescriptiveKeyTableNames
- {
- /// <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)
- .HasAnnotation("Relational:MaxIdentifierLength", 63);
-
- NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
-
- modelBuilder.Entity("AliasServerDb.AdminRole", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("AdminRoles");
- });
-
- modelBuilder.Entity("AliasServerDb.AdminUser", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<int>("AccessFailedCount")
- .HasColumnType("integer");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<string>("Email")
- .HasColumnType("text");
-
- b.Property<bool>("EmailConfirmed")
- .HasColumnType("boolean");
-
- b.Property<DateTime?>("LastPasswordChanged")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("LockoutEnabled")
- .HasColumnType("boolean");
-
- b.Property<DateTimeOffset?>("LockoutEnd")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("NormalizedEmail")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedUserName")
- .HasColumnType("text");
-
- b.Property<string>("PasswordHash")
- .HasColumnType("text");
-
- b.Property<string>("PhoneNumber")
- .HasColumnType("text");
-
- b.Property<bool>("PhoneNumberConfirmed")
- .HasColumnType("boolean");
-
- b.Property<string>("SecurityStamp")
- .HasColumnType("text");
-
- b.Property<bool>("TwoFactorEnabled")
- .HasColumnType("boolean");
-
- b.Property<string>("UserName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("AdminUsers");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultRole", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("AliasVaultRoles");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<int>("AccessFailedCount")
- .HasColumnType("integer");
-
- b.Property<bool>("Blocked")
- .HasColumnType("boolean");
-
- b.Property<DateTime?>("BlockedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Email")
- .HasColumnType("text");
-
- b.Property<bool>("EmailConfirmed")
- .HasColumnType("boolean");
-
- b.Property<int>("EmailsReceived")
- .HasColumnType("integer");
-
- b.Property<DateTime?>("LastActivityDate")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("LockoutEnabled")
- .HasColumnType("boolean");
-
- b.Property<DateTimeOffset?>("LockoutEnd")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("MaxEmailAgeDays")
- .HasColumnType("integer");
-
- b.Property<int>("MaxEmails")
- .HasColumnType("integer");
-
- b.Property<string>("NormalizedEmail")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedUserName")
- .HasColumnType("text");
-
- b.Property<DateTime>("PasswordChangedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("PasswordHash")
- .HasColumnType("text");
-
- b.Property<Guid>("PersonalGroupId")
- .HasColumnType("uuid");
-
- b.Property<string>("PhoneNumber")
- .HasColumnType("text");
-
- b.Property<bool>("PhoneNumberConfirmed")
- .HasColumnType("boolean");
-
- b.Property<string>("SecurityStamp")
- .HasColumnType("text");
-
- b.Property<bool>("ShadowBlocked")
- .HasColumnType("boolean");
-
- b.Property<DateTime?>("ShadowBlockedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("SrpIdentity")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<bool>("TwoFactorEnabled")
- .HasColumnType("boolean");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.HasIndex("PersonalGroupId")
- .IsUnique()
- .HasDatabaseName("UX_AliasVaultUsers_PersonalGroupId");
-
- b.ToTable("AliasVaultUsers");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("DeviceIdentifier")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime>("ExpireDate")
- .HasMaxLength(255)
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("IpAddress")
- .HasMaxLength(45)
- .HasColumnType("character varying(45)");
-
- b.Property<string>("PreviousTokenValue")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Value")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId");
-
- b.ToTable("AliasVaultUserRefreshTokens");
- });
-
- modelBuilder.Entity("AliasServerDb.AuthLog", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("AdditionalInfo")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Browser")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("Client")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("Country")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("DeviceType")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<int>("EventType")
- .HasColumnType("integer");
-
- b.Property<int?>("FailureReason")
- .HasColumnType("integer");
-
- b.Property<string>("IpAddress")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<bool>("IsSuccess")
- .HasColumnType("boolean");
-
- b.Property<bool>("IsSuspiciousActivity")
- .HasColumnType("boolean");
-
- b.Property<string>("OperatingSystem")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("RequestPath")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<DateTime>("Timestamp")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Username")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex(new[] { "EventType" }, "IX_EventType");
-
- b.HasIndex(new[] { "IpAddress" }, "IX_IpAddress");
-
- b.HasIndex(new[] { "Timestamp" }, "IX_Timestamp");
-
- b.HasIndex(new[] { "Username", "IsSuccess", "Timestamp" }, "IX_Username_IsSuccess_Timestamp")
- .IsDescending(false, false, true);
-
- b.HasIndex(new[] { "Username", "Timestamp" }, "IX_Username_Timestamp")
- .IsDescending(false, true);
-
- b.ToTable("AuthLogs");
- });
-
- modelBuilder.Entity("AliasServerDb.BlockedIpRange", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<bool>("BlockLogin")
- .HasColumnType("boolean");
-
- b.Property<bool>("BlockRegistration")
- .HasColumnType("boolean");
-
- b.Property<bool>("BlockShadow")
- .HasColumnType("boolean");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("CreatedBy")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<bool>("Enabled")
- .HasColumnType("boolean");
-
- b.Property<string>("IpRange")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("Reason")
- .HasMaxLength(500)
- .HasColumnType("character varying(500)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("Id");
-
- b.HasIndex(new[] { "Enabled" }, "IX_BlockedIpRange_Enabled");
-
- b.HasIndex(new[] { "IpRange" }, "IX_BlockedIpRange_IpRange")
- .IsUnique();
-
- b.ToTable("BlockedIpRanges");
- });
-
- modelBuilder.Entity("AliasServerDb.Email", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<DateTime>("Date")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime>("DateSystem")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedSymmetricKey")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<Guid>("EncryptionKeyId")
- .HasMaxLength(255)
- .HasColumnType("uuid");
-
- b.Property<string>("From")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("FromDomain")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("FromLocal")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("MessageHtml")
- .HasColumnType("text");
-
- b.Property<string>("MessagePlain")
- .HasColumnType("text");
-
- b.Property<string>("MessagePreview")
- .HasColumnType("text");
-
- b.Property<string>("MessageSource")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<bool>("PushNotificationSent")
- .HasColumnType("boolean");
-
- b.Property<string>("Subject")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("To")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("ToDomain")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("ToLocal")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<bool>("Visible")
- .HasColumnType("boolean");
-
- b.HasKey("Id");
-
- b.HasIndex("Date");
-
- b.HasIndex("DateSystem");
-
- b.HasIndex("EncryptionKeyId");
-
- b.HasIndex("PushNotificationSent");
-
- b.HasIndex("Visible");
-
- b.HasIndex("To", "DateSystem");
-
- b.ToTable("Emails");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailAttachment", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<byte[]>("Bytes")
- .IsRequired()
- .HasColumnType("bytea");
-
- b.Property<DateTime>("Date")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("EmailId")
- .HasColumnType("integer");
-
- b.Property<string>("Filename")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<int>("Filesize")
- .HasColumnType("integer");
-
- b.Property<string>("MimeType")
- .IsRequired()
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.HasIndex("EmailId");
-
- b.ToTable("EmailAttachments");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailClaim", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Address")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("AddressDomain")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("AddressLocal")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("Disabled")
- .HasColumnType("boolean");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid?>("VaultManifestId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("Address")
- .IsUnique();
-
- b.HasIndex("VaultManifestId", "CreatedAt");
-
- b.HasIndex("VaultManifestId", "Disabled");
-
- b.ToTable("EmailClaims");
- });
-
- modelBuilder.Entity("AliasServerDb.Group", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Name")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<int>("Type")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("Id");
-
- b.ToTable("Groups");
- });
-
- modelBuilder.Entity("AliasServerDb.GroupMember", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid>("GroupId")
- .HasColumnType("uuid");
-
- b.Property<int>("Role")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId");
-
- b.HasIndex("GroupId", "UserId")
- .IsUnique();
-
- b.ToTable("GroupMembers");
- });
-
- modelBuilder.Entity("AliasServerDb.Log", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("Application")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("Exception")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Level")
- .IsRequired()
- .HasMaxLength(128)
- .HasColumnType("character varying(128)");
-
- b.Property<string>("LogEvent")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("LogEvent");
-
- b.Property<string>("Message")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("MessageTemplate")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Properties")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("SourceContext")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("TimeStamp")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("Id");
-
- b.HasIndex("Application");
-
- b.HasIndex("TimeStamp");
-
- b.ToTable("Logs", (string)null);
- });
-
- modelBuilder.Entity("AliasServerDb.MobileLoginRequest", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<DateTime?>("ClearedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("ClientIpAddress")
- .HasColumnType("text");
-
- b.Property<string>("ClientPublicKey")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedDecryptionKey")
- .HasColumnType("text");
-
- b.Property<DateTime?>("FulfilledAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("MobileIpAddress")
- .HasColumnType("text");
-
- b.Property<DateTime?>("RetrievedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.HasIndex(new[] { "ClientIpAddress" }, "IX_ClientIpAddress");
-
- b.HasIndex(new[] { "CreatedAt" }, "IX_CreatedAt");
-
- b.HasIndex(new[] { "MobileIpAddress" }, "IX_MobileIpAddress");
-
- b.HasIndex(new[] { "RetrievedAt", "ClearedAt", "FulfilledAt" }, "IX_RetrievedAt_ClearedAt_FulfilledAt");
-
- b.HasIndex(new[] { "UserId" }, "IX_UserId");
-
- b.ToTable("MobileLoginRequests");
- });
-
- modelBuilder.Entity("AliasServerDb.RateLimit", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<int?>("AppliesToAccountAgeMaxDays")
- .HasColumnType("integer");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("CreatedBy")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime?>("EffectiveFrom")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime?>("EffectiveUntil")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("Enabled")
- .HasColumnType("boolean");
-
- b.Property<int>("LimitType")
- .HasColumnType("integer");
-
- b.Property<int>("MaxCount")
- .HasColumnType("integer");
-
- b.Property<string>("Notes")
- .HasMaxLength(1000)
- .HasColumnType("character varying(1000)");
-
- b.Property<int?>("Tier")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<int>("WindowSeconds")
- .HasColumnType("integer");
-
- b.HasKey("Id");
-
- b.HasIndex("Tier");
-
- b.HasIndex("UserId");
-
- b.HasIndex("LimitType", "Enabled");
-
- b.ToTable("RateLimits");
- });
-
- modelBuilder.Entity("AliasServerDb.ServerSetting", b =>
- {
- b.Property<string>("Key")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Value")
- .HasColumnType("text");
-
- b.HasKey("Key");
-
- b.ToTable("ServerSettings");
- });
-
- modelBuilder.Entity("AliasServerDb.TaskRunnerJob", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<TimeOnly?>("EndTime")
- .HasColumnType("time without time zone");
-
- b.Property<string>("ErrorMessage")
- .HasColumnType("text");
-
- b.Property<bool>("IsOnDemand")
- .HasColumnType("boolean");
-
- b.Property<string>("Name")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<DateTime>("RunDate")
- .HasColumnType("timestamp with time zone");
-
- b.Property<TimeOnly>("StartTime")
- .HasColumnType("time without time zone");
-
- b.Property<int>("Status")
- .HasColumnType("integer");
-
- b.HasKey("Id");
-
- b.ToTable("TaskRunnerJobs");
- });
-
- modelBuilder.Entity("AliasServerDb.UserGrantKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedPrivateKey")
- .IsRequired()
- .HasMaxLength(4000)
- .HasColumnType("character varying(4000)");
-
- b.Property<bool>("IsPrimary")
- .HasColumnType("boolean");
-
- b.Property<string>("PublicKey")
- .IsRequired()
- .HasMaxLength(2000)
- .HasColumnType("character varying(2000)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId")
- .IsUnique()
- .HasDatabaseName("UX_UserGrantKeys_User_Primary")
- .HasFilter("\"IsPrimary\"");
-
- b.ToTable("UserGrantKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.UserUnlockKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Algorithm")
- .IsRequired()
- .HasMaxLength(30)
- .HasColumnType("character varying(30)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedAccountKey")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime?>("LastUsedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Metadata")
- .HasColumnType("jsonb");
-
- b.Property<int>("Type")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId", "Type")
- .IsUnique()
- .HasDatabaseName("UX_UserUnlockKeys_UserId_Type");
-
- b.ToTable("UserUnlockKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobObject", b =>
- {
- b.Property<string>("Hash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<string>("OwnerUserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Category")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<byte[]>("EncryptedData")
- .IsRequired()
- .HasColumnType("bytea");
-
- b.Property<DateTime>("LastReferencedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("SizeBytes")
- .HasColumnType("integer");
-
- b.HasKey("Hash", "OwnerUserId");
-
- b.HasIndex("OwnerUserId", "Category");
-
- b.ToTable("VaultBlobObjects");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobReference", b =>
- {
- b.Property<Guid>("ManifestId")
- .HasColumnType("uuid");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("BlobHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.HasKey("ManifestId", "RevisionNumber", "BlobHash");
-
- b.ToTable("VaultBlobReferences");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucket", b =>
- {
- b.Property<string>("OwnerUserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Category")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("CiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedData")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("OwnerUserId", "Category");
-
- b.ToTable("VaultDataBuckets");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucketsHistory", b =>
- {
- b.Property<string>("OwnerUserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Category")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("CiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedData")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("OwnerUserId", "Category", "RevisionNumber");
-
- b.ToTable("VaultDataBucketsHistory");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifest", b =>
- {
- b.Property<Guid>("ManifestId")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Client")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("CredentialsCount")
- .HasColumnType("integer");
-
- b.Property<int>("EmailClaimsCount")
- .HasColumnType("integer");
-
- b.Property<string>("EncryptionSettings")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("EncryptionType")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<int>("FileSize")
- .HasColumnType("integer");
-
- b.Property<bool>("IsRoot")
- .HasColumnType("boolean");
-
- b.Property<string>("ManifestBlob")
- .HasColumnType("text");
-
- b.Property<string>("ManifestCiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<string>("Name")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<Guid>("OwnerGroupId")
- .HasColumnType("uuid");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("Salt")
- .IsRequired()
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("StorageFormat")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("VaultBlob")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Verifier")
- .IsRequired()
- .HasMaxLength(1000)
- .HasColumnType("character varying(1000)");
-
- b.Property<string>("Version")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("ManifestId");
-
- b.HasIndex("OwnerGroupId")
- .IsUnique()
- .HasDatabaseName("UX_VaultManifests_OwnerGroupId_Root")
- .HasFilter("\"IsRoot\"");
-
- b.ToTable("VaultManifests");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestAccessKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Algorithm")
- .IsRequired()
- .HasMaxLength(30)
- .HasColumnType("character varying(30)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedVek")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime?>("LastUsedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Metadata")
- .HasColumnType("jsonb");
-
- b.Property<int>("Type")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid?>("UserGrantKeyId")
- .HasColumnType("uuid");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<Guid>("VaultManifestId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("UserGrantKeyId");
-
- b.HasIndex("VaultManifestId")
- .HasDatabaseName("IX_VaultManifestAccessKeys_VaultManifestId");
-
- b.HasIndex("UserId", "Type", "VaultManifestId")
- .IsUnique()
- .HasDatabaseName("UX_VaultManifestAccessKeys_UserId_Type_Manifest");
-
- b.ToTable("VaultManifestAccessKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestDeliveryKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("IsPrimary")
- .HasColumnType("boolean");
-
- b.Property<string>("PublicKey")
- .IsRequired()
- .HasMaxLength(2000)
- .HasColumnType("character varying(2000)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid>("VaultManifestId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("VaultManifestId")
- .IsUnique()
- .HasDatabaseName("UX_VaultManifestDeliveryKeys_Manifest_Primary")
- .HasFilter("\"IsPrimary\"");
-
- b.HasIndex("VaultManifestId", "IsPrimary");
-
- b.ToTable("VaultManifestDeliveryKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestsHistory", b =>
- {
- b.Property<Guid>("ManifestId")
- .HasColumnType("uuid");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("Client")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("CredentialsCount")
- .HasColumnType("integer");
-
- b.Property<int>("EmailClaimsCount")
- .HasColumnType("integer");
-
- b.Property<string>("EncryptionSettings")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("EncryptionType")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<int>("FileSize")
- .HasColumnType("integer");
-
- b.Property<string>("ManifestBlob")
- .HasColumnType("text");
-
- b.Property<string>("ManifestCiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<string>("Salt")
- .IsRequired()
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("StorageFormat")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("VaultBlob")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Verifier")
- .IsRequired()
- .HasMaxLength(1000)
- .HasColumnType("character varying(1000)");
-
- b.Property<string>("Version")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("ManifestId", "RevisionNumber");
-
- b.ToTable("VaultManifestsHistory", (string)null);
- });
-
- modelBuilder.Entity("AliasVault.WorkerStatus.Database.WorkerServiceStatus", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("CurrentStatus")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("DesiredStatus")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<DateTime>("Heartbeat")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("ServiceName")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.ToTable("WorkerServiceStatuses");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("FriendlyName")
- .HasColumnType("text");
-
- b.Property<string>("Xml")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("DataProtectionKeys");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("ClaimType")
- .HasColumnType("text");
-
- b.Property<string>("ClaimValue")
- .HasColumnType("text");
-
- b.Property<string>("RoleId")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("RoleClaims", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("ClaimType")
- .HasColumnType("text");
-
- b.Property<string>("ClaimValue")
- .HasColumnType("text");
-
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("UserClaims", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
- {
- b.Property<string>("LoginProvider")
- .HasColumnType("text");
-
- b.Property<string>("ProviderKey")
- .HasColumnType("text");
-
- b.Property<string>("ProviderDisplayName")
- .HasColumnType("text");
-
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.HasKey("LoginProvider", "ProviderKey");
-
- b.ToTable("UserLogins", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
- {
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.Property<string>("RoleId")
- .HasColumnType("text");
-
- b.HasKey("UserId", "RoleId");
-
- b.ToTable("UserRoles", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
- {
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.Property<string>("LoginProvider")
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.Property<string>("Value")
- .HasColumnType("text");
-
- b.HasKey("UserId", "LoginProvider", "Name");
-
- b.ToTable("UserTokens", (string)null);
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>
- {
- b.HasOne("AliasServerDb.Group", "PersonalGroup")
- .WithOne()
- .HasForeignKey("AliasServerDb.AliasVaultUser", "PersonalGroupId")
- .OnDelete(DeleteBehavior.Restrict)
- .IsRequired();
-
- b.Navigation("PersonalGroup");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.Email", b =>
- {
- b.HasOne("AliasServerDb.VaultManifestDeliveryKey", "EncryptionKey")
- .WithMany("Emails")
- .HasForeignKey("EncryptionKeyId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("EncryptionKey");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailAttachment", b =>
- {
- b.HasOne("AliasServerDb.Email", "Email")
- .WithMany("Attachments")
- .HasForeignKey("EmailId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Email");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailClaim", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "VaultManifest")
- .WithMany()
- .HasForeignKey("VaultManifestId")
- .OnDelete(DeleteBehavior.SetNull);
-
- b.Navigation("VaultManifest");
- });
-
- modelBuilder.Entity("AliasServerDb.GroupMember", b =>
- {
- b.HasOne("AliasServerDb.Group", "Group")
- .WithMany("Members")
- .HasForeignKey("GroupId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Group");
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.MobileLoginRequest", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.RateLimit", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.UserGrantKey", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.UserUnlockKey", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobObject", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("OwnerUserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobReference", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "Manifest")
- .WithMany()
- .HasForeignKey("ManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Manifest");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucket", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("OwnerUserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucketsHistory", b =>
- {
- b.HasOne("AliasServerDb.VaultDataBucket", "Bucket")
- .WithMany()
- .HasForeignKey("OwnerUserId", "Category")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Bucket");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifest", b =>
- {
- b.HasOne("AliasServerDb.Group", "OwnerGroup")
- .WithMany()
- .HasForeignKey("OwnerGroupId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("OwnerGroup");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestAccessKey", b =>
- {
- b.HasOne("AliasServerDb.UserGrantKey", "UserGrantKey")
- .WithMany()
- .HasForeignKey("UserGrantKeyId")
- .OnDelete(DeleteBehavior.SetNull);
-
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany("VaultManifestAccessKeys")
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
-
- b.Navigation("UserGrantKey");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestDeliveryKey", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "VaultManifest")
- .WithMany()
- .HasForeignKey("VaultManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("VaultManifest");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestsHistory", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "Manifest")
- .WithMany()
- .HasForeignKey("ManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Manifest");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>
- {
- b.Navigation("VaultManifestAccessKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.Email", b =>
- {
- b.Navigation("Attachments");
- });
-
- modelBuilder.Entity("AliasServerDb.Group", b =>
- {
- b.Navigation("Members");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestDeliveryKey", b =>
- {
- b.Navigation("Emails");
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/apps/server/Databases/AliasServerDb/Migrations/20260801120718_DescriptiveKeyTableNames.cs b/apps/server/Databases/AliasServerDb/Migrations/20260801120718_DescriptiveKeyTableNames.cs
deleted file mode 100644
index b44a06dfc..000000000
--- a/apps/server/Databases/AliasServerDb/Migrations/20260801120718_DescriptiveKeyTableNames.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-// <auto-generated>
-using Microsoft.EntityFrameworkCore.Migrations;
-
-#nullable disable
-
-namespace AliasServerDb.Migrations
-{
- /// <summary>
- /// Rename table names for clarity.
- /// </summary>
- public partial class DescriptiveKeyTableNames : Migration
- {
- /// <inheritdoc />
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.RenameTable(name: "EncryptionKeys", newName: "VaultManifestDeliveryKeys");
- migrationBuilder.RenameTable(name: "VaultKeys", newName: "VaultManifestAccessKeys");
- migrationBuilder.RenameTable(name: "UserKeys", newName: "UserGrantKeys");
-
- migrationBuilder.RenameColumn(name: "UserKeyId", table: "VaultManifestAccessKeys", newName: "UserGrantKeyId");
-
- migrationBuilder.RenameIndex(name: "IX_EncryptionKeys_VaultManifestId_IsPrimary", table: "VaultManifestDeliveryKeys", newName: "IX_VaultManifestDeliveryKeys_VaultManifestId_IsPrimary");
- migrationBuilder.RenameIndex(name: "UX_EncryptionKeys_Manifest_Primary", table: "VaultManifestDeliveryKeys", newName: "UX_VaultManifestDeliveryKeys_Manifest_Primary");
- migrationBuilder.RenameIndex(name: "IX_VaultKeys_UserKeyId", table: "VaultManifestAccessKeys", newName: "IX_VaultManifestAccessKeys_UserGrantKeyId");
- migrationBuilder.RenameIndex(name: "IX_VaultKeys_VaultManifestId", table: "VaultManifestAccessKeys", newName: "IX_VaultManifestAccessKeys_VaultManifestId");
- migrationBuilder.RenameIndex(name: "UX_VaultKeys_UserId_Type_Manifest", table: "VaultManifestAccessKeys", newName: "UX_VaultManifestAccessKeys_UserId_Type_Manifest");
- migrationBuilder.RenameIndex(name: "UX_UserKeys_User_Primary", table: "UserGrantKeys", newName: "UX_UserGrantKeys_User_Primary");
-
- // Postgres does not rename constraints with their table; realign PK/FK names with what EF derives.
- migrationBuilder.Sql("""ALTER TABLE "VaultManifestDeliveryKeys" RENAME CONSTRAINT "PK_EncryptionKeys" TO "PK_VaultManifestDeliveryKeys";""");
- migrationBuilder.Sql("""ALTER TABLE "VaultManifestDeliveryKeys" RENAME CONSTRAINT "FK_EncryptionKeys_VaultManifests_VaultManifestId" TO "FK_VaultManifestDeliveryKeys_VaultManifests_VaultManifestId";""");
- migrationBuilder.Sql("""ALTER TABLE "Emails" RENAME CONSTRAINT "FK_Emails_EncryptionKeys_EncryptionKeyId" TO "FK_Emails_VaultManifestDeliveryKeys_EncryptionKeyId";""");
- migrationBuilder.Sql("""ALTER TABLE "VaultManifestAccessKeys" RENAME CONSTRAINT "PK_VaultKeys" TO "PK_VaultManifestAccessKeys";""");
- migrationBuilder.Sql("""ALTER TABLE "VaultManifestAccessKeys" RENAME CONSTRAINT "FK_VaultKeys_AliasVaultUsers_UserId" TO "FK_VaultManifestAccessKeys_AliasVaultUsers_UserId";""");
- migrationBuilder.Sql("""ALTER TABLE "VaultManifestAccessKeys" RENAME CONSTRAINT "FK_VaultKeys_UserKeys_UserKeyId" TO "FK_VaultManifestAccessKeys_UserGrantKeys_UserGrantKeyId";""");
- migrationBuilder.Sql("""ALTER TABLE "UserGrantKeys" RENAME CONSTRAINT "PK_UserKeys" TO "PK_UserGrantKeys";""");
- migrationBuilder.Sql("""ALTER TABLE "UserGrantKeys" RENAME CONSTRAINT "FK_UserKeys_AliasVaultUsers_UserId" TO "FK_UserGrantKeys_AliasVaultUsers_UserId";""");
- }
-
- /// <inheritdoc />
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.Sql("""ALTER TABLE "UserGrantKeys" RENAME CONSTRAINT "FK_UserGrantKeys_AliasVaultUsers_UserId" TO "FK_UserKeys_AliasVaultUsers_UserId";""");
- migrationBuilder.Sql("""ALTER TABLE "UserGrantKeys" RENAME CONSTRAINT "PK_UserGrantKeys" TO "PK_UserKeys";""");
- migrationBuilder.Sql("""ALTER TABLE "VaultManifestAccessKeys" RENAME CONSTRAINT "FK_VaultManifestAccessKeys_UserGrantKeys_UserGrantKeyId" TO "FK_VaultKeys_UserKeys_UserKeyId";""");
- migrationBuilder.Sql("""ALTER TABLE "VaultManifestAccessKeys" RENAME CONSTRAINT "FK_VaultManifestAccessKeys_AliasVaultUsers_UserId" TO "FK_VaultKeys_AliasVaultUsers_UserId";""");
- migrationBuilder.Sql("""ALTER TABLE "VaultManifestAccessKeys" RENAME CONSTRAINT "PK_VaultManifestAccessKeys" TO "PK_VaultKeys";""");
- migrationBuilder.Sql("""ALTER TABLE "Emails" RENAME CONSTRAINT "FK_Emails_VaultManifestDeliveryKeys_EncryptionKeyId" TO "FK_Emails_EncryptionKeys_EncryptionKeyId";""");
- migrationBuilder.Sql("""ALTER TABLE "VaultManifestDeliveryKeys" RENAME CONSTRAINT "FK_VaultManifestDeliveryKeys_VaultManifests_VaultManifestId" TO "FK_EncryptionKeys_VaultManifests_VaultManifestId";""");
- migrationBuilder.Sql("""ALTER TABLE "VaultManifestDeliveryKeys" RENAME CONSTRAINT "PK_VaultManifestDeliveryKeys" TO "PK_EncryptionKeys";""");
-
- migrationBuilder.RenameIndex(name: "UX_UserGrantKeys_User_Primary", table: "UserGrantKeys", newName: "UX_UserKeys_User_Primary");
- migrationBuilder.RenameIndex(name: "UX_VaultManifestAccessKeys_UserId_Type_Manifest", table: "VaultManifestAccessKeys", newName: "UX_VaultKeys_UserId_Type_Manifest");
- migrationBuilder.RenameIndex(name: "IX_VaultManifestAccessKeys_VaultManifestId", table: "VaultManifestAccessKeys", newName: "IX_VaultKeys_VaultManifestId");
- migrationBuilder.RenameIndex(name: "IX_VaultManifestAccessKeys_UserGrantKeyId", table: "VaultManifestAccessKeys", newName: "IX_VaultKeys_UserKeyId");
- migrationBuilder.RenameIndex(name: "UX_VaultManifestDeliveryKeys_Manifest_Primary", table: "VaultManifestDeliveryKeys", newName: "UX_EncryptionKeys_Manifest_Primary");
- migrationBuilder.RenameIndex(name: "IX_VaultManifestDeliveryKeys_VaultManifestId_IsPrimary", table: "VaultManifestDeliveryKeys", newName: "IX_EncryptionKeys_VaultManifestId_IsPrimary");
-
- migrationBuilder.RenameColumn(name: "UserGrantKeyId", table: "VaultManifestAccessKeys", newName: "UserKeyId");
-
- migrationBuilder.RenameTable(name: "UserGrantKeys", newName: "UserKeys");
- migrationBuilder.RenameTable(name: "VaultManifestAccessKeys", newName: "VaultKeys");
- migrationBuilder.RenameTable(name: "VaultManifestDeliveryKeys", newName: "EncryptionKeys");
- }
- }
-}
diff --git a/apps/server/Databases/AliasServerDb/Migrations/20260801141139_SwapManifestKeyTypeValues.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/20260801141139_SwapManifestKeyTypeValues.Designer.cs
deleted file mode 100644
index ec8027d3a..000000000
--- a/apps/server/Databases/AliasServerDb/Migrations/20260801141139_SwapManifestKeyTypeValues.Designer.cs
+++ /dev/null
@@ -1,1657 +0,0 @@
-// <auto-generated />
-using System;
-using AliasServerDb;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
-
-#nullable disable
-
-namespace AliasServerDb.Migrations
-{
- [DbContext(typeof(AliasServerDbContext))]
- [Migration("20260801141139_SwapManifestKeyTypeValues")]
- partial class SwapManifestKeyTypeValues
- {
- /// <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)
- .HasAnnotation("Relational:MaxIdentifierLength", 63);
-
- NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
-
- modelBuilder.Entity("AliasServerDb.AdminRole", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("AdminRoles");
- });
-
- modelBuilder.Entity("AliasServerDb.AdminUser", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<int>("AccessFailedCount")
- .HasColumnType("integer");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<string>("Email")
- .HasColumnType("text");
-
- b.Property<bool>("EmailConfirmed")
- .HasColumnType("boolean");
-
- b.Property<DateTime?>("LastPasswordChanged")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("LockoutEnabled")
- .HasColumnType("boolean");
-
- b.Property<DateTimeOffset?>("LockoutEnd")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("NormalizedEmail")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedUserName")
- .HasColumnType("text");
-
- b.Property<string>("PasswordHash")
- .HasColumnType("text");
-
- b.Property<string>("PhoneNumber")
- .HasColumnType("text");
-
- b.Property<bool>("PhoneNumberConfirmed")
- .HasColumnType("boolean");
-
- b.Property<string>("SecurityStamp")
- .HasColumnType("text");
-
- b.Property<bool>("TwoFactorEnabled")
- .HasColumnType("boolean");
-
- b.Property<string>("UserName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("AdminUsers");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultRole", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("AliasVaultRoles");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<int>("AccessFailedCount")
- .HasColumnType("integer");
-
- b.Property<bool>("Blocked")
- .HasColumnType("boolean");
-
- b.Property<DateTime?>("BlockedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Email")
- .HasColumnType("text");
-
- b.Property<bool>("EmailConfirmed")
- .HasColumnType("boolean");
-
- b.Property<int>("EmailsReceived")
- .HasColumnType("integer");
-
- b.Property<DateTime?>("LastActivityDate")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("LockoutEnabled")
- .HasColumnType("boolean");
-
- b.Property<DateTimeOffset?>("LockoutEnd")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("MaxEmailAgeDays")
- .HasColumnType("integer");
-
- b.Property<int>("MaxEmails")
- .HasColumnType("integer");
-
- b.Property<string>("NormalizedEmail")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedUserName")
- .HasColumnType("text");
-
- b.Property<DateTime>("PasswordChangedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("PasswordHash")
- .HasColumnType("text");
-
- b.Property<Guid>("PersonalGroupId")
- .HasColumnType("uuid");
-
- b.Property<string>("PhoneNumber")
- .HasColumnType("text");
-
- b.Property<bool>("PhoneNumberConfirmed")
- .HasColumnType("boolean");
-
- b.Property<string>("SecurityStamp")
- .HasColumnType("text");
-
- b.Property<bool>("ShadowBlocked")
- .HasColumnType("boolean");
-
- b.Property<DateTime?>("ShadowBlockedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("SrpIdentity")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<bool>("TwoFactorEnabled")
- .HasColumnType("boolean");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.HasIndex("PersonalGroupId")
- .IsUnique()
- .HasDatabaseName("UX_AliasVaultUsers_PersonalGroupId");
-
- b.ToTable("AliasVaultUsers");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("DeviceIdentifier")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime>("ExpireDate")
- .HasMaxLength(255)
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("IpAddress")
- .HasMaxLength(45)
- .HasColumnType("character varying(45)");
-
- b.Property<string>("PreviousTokenValue")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Value")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId");
-
- b.ToTable("AliasVaultUserRefreshTokens");
- });
-
- modelBuilder.Entity("AliasServerDb.AuthLog", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("AdditionalInfo")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Browser")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("Client")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("Country")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("DeviceType")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<int>("EventType")
- .HasColumnType("integer");
-
- b.Property<int?>("FailureReason")
- .HasColumnType("integer");
-
- b.Property<string>("IpAddress")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<bool>("IsSuccess")
- .HasColumnType("boolean");
-
- b.Property<bool>("IsSuspiciousActivity")
- .HasColumnType("boolean");
-
- b.Property<string>("OperatingSystem")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("RequestPath")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<DateTime>("Timestamp")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Username")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex(new[] { "EventType" }, "IX_EventType");
-
- b.HasIndex(new[] { "IpAddress" }, "IX_IpAddress");
-
- b.HasIndex(new[] { "Timestamp" }, "IX_Timestamp");
-
- b.HasIndex(new[] { "Username", "IsSuccess", "Timestamp" }, "IX_Username_IsSuccess_Timestamp")
- .IsDescending(false, false, true);
-
- b.HasIndex(new[] { "Username", "Timestamp" }, "IX_Username_Timestamp")
- .IsDescending(false, true);
-
- b.ToTable("AuthLogs");
- });
-
- modelBuilder.Entity("AliasServerDb.BlockedIpRange", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<bool>("BlockLogin")
- .HasColumnType("boolean");
-
- b.Property<bool>("BlockRegistration")
- .HasColumnType("boolean");
-
- b.Property<bool>("BlockShadow")
- .HasColumnType("boolean");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("CreatedBy")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<bool>("Enabled")
- .HasColumnType("boolean");
-
- b.Property<string>("IpRange")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("Reason")
- .HasMaxLength(500)
- .HasColumnType("character varying(500)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("Id");
-
- b.HasIndex(new[] { "Enabled" }, "IX_BlockedIpRange_Enabled");
-
- b.HasIndex(new[] { "IpRange" }, "IX_BlockedIpRange_IpRange")
- .IsUnique();
-
- b.ToTable("BlockedIpRanges");
- });
-
- modelBuilder.Entity("AliasServerDb.Email", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<DateTime>("Date")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime>("DateSystem")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedSymmetricKey")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<Guid>("EncryptionKeyId")
- .HasMaxLength(255)
- .HasColumnType("uuid");
-
- b.Property<string>("From")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("FromDomain")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("FromLocal")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("MessageHtml")
- .HasColumnType("text");
-
- b.Property<string>("MessagePlain")
- .HasColumnType("text");
-
- b.Property<string>("MessagePreview")
- .HasColumnType("text");
-
- b.Property<string>("MessageSource")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<bool>("PushNotificationSent")
- .HasColumnType("boolean");
-
- b.Property<string>("Subject")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("To")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("ToDomain")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("ToLocal")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<bool>("Visible")
- .HasColumnType("boolean");
-
- b.HasKey("Id");
-
- b.HasIndex("Date");
-
- b.HasIndex("DateSystem");
-
- b.HasIndex("EncryptionKeyId");
-
- b.HasIndex("PushNotificationSent");
-
- b.HasIndex("Visible");
-
- b.HasIndex("To", "DateSystem");
-
- b.ToTable("Emails");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailAttachment", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<byte[]>("Bytes")
- .IsRequired()
- .HasColumnType("bytea");
-
- b.Property<DateTime>("Date")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("EmailId")
- .HasColumnType("integer");
-
- b.Property<string>("Filename")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<int>("Filesize")
- .HasColumnType("integer");
-
- b.Property<string>("MimeType")
- .IsRequired()
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.HasIndex("EmailId");
-
- b.ToTable("EmailAttachments");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailClaim", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Address")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("AddressDomain")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("AddressLocal")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("Disabled")
- .HasColumnType("boolean");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid?>("VaultManifestId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("Address")
- .IsUnique();
-
- b.HasIndex("VaultManifestId", "CreatedAt");
-
- b.HasIndex("VaultManifestId", "Disabled");
-
- b.ToTable("EmailClaims");
- });
-
- modelBuilder.Entity("AliasServerDb.Group", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Name")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<int>("Type")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("Id");
-
- b.ToTable("Groups");
- });
-
- modelBuilder.Entity("AliasServerDb.GroupMember", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid>("GroupId")
- .HasColumnType("uuid");
-
- b.Property<int>("Role")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId");
-
- b.HasIndex("GroupId", "UserId")
- .IsUnique();
-
- b.ToTable("GroupMembers");
- });
-
- modelBuilder.Entity("AliasServerDb.Log", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("Application")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("Exception")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Level")
- .IsRequired()
- .HasMaxLength(128)
- .HasColumnType("character varying(128)");
-
- b.Property<string>("LogEvent")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("LogEvent");
-
- b.Property<string>("Message")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("MessageTemplate")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Properties")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("SourceContext")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("TimeStamp")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("Id");
-
- b.HasIndex("Application");
-
- b.HasIndex("TimeStamp");
-
- b.ToTable("Logs", (string)null);
- });
-
- modelBuilder.Entity("AliasServerDb.MobileLoginRequest", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<DateTime?>("ClearedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("ClientIpAddress")
- .HasColumnType("text");
-
- b.Property<string>("ClientPublicKey")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedDecryptionKey")
- .HasColumnType("text");
-
- b.Property<DateTime?>("FulfilledAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("MobileIpAddress")
- .HasColumnType("text");
-
- b.Property<DateTime?>("RetrievedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.HasIndex(new[] { "ClientIpAddress" }, "IX_ClientIpAddress");
-
- b.HasIndex(new[] { "CreatedAt" }, "IX_CreatedAt");
-
- b.HasIndex(new[] { "MobileIpAddress" }, "IX_MobileIpAddress");
-
- b.HasIndex(new[] { "RetrievedAt", "ClearedAt", "FulfilledAt" }, "IX_RetrievedAt_ClearedAt_FulfilledAt");
-
- b.HasIndex(new[] { "UserId" }, "IX_UserId");
-
- b.ToTable("MobileLoginRequests");
- });
-
- modelBuilder.Entity("AliasServerDb.RateLimit", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<int?>("AppliesToAccountAgeMaxDays")
- .HasColumnType("integer");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("CreatedBy")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime?>("EffectiveFrom")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime?>("EffectiveUntil")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("Enabled")
- .HasColumnType("boolean");
-
- b.Property<int>("LimitType")
- .HasColumnType("integer");
-
- b.Property<int>("MaxCount")
- .HasColumnType("integer");
-
- b.Property<string>("Notes")
- .HasMaxLength(1000)
- .HasColumnType("character varying(1000)");
-
- b.Property<int?>("Tier")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<int>("WindowSeconds")
- .HasColumnType("integer");
-
- b.HasKey("Id");
-
- b.HasIndex("Tier");
-
- b.HasIndex("UserId");
-
- b.HasIndex("LimitType", "Enabled");
-
- b.ToTable("RateLimits");
- });
-
- modelBuilder.Entity("AliasServerDb.ServerSetting", b =>
- {
- b.Property<string>("Key")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Value")
- .HasColumnType("text");
-
- b.HasKey("Key");
-
- b.ToTable("ServerSettings");
- });
-
- modelBuilder.Entity("AliasServerDb.TaskRunnerJob", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<TimeOnly?>("EndTime")
- .HasColumnType("time without time zone");
-
- b.Property<string>("ErrorMessage")
- .HasColumnType("text");
-
- b.Property<bool>("IsOnDemand")
- .HasColumnType("boolean");
-
- b.Property<string>("Name")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<DateTime>("RunDate")
- .HasColumnType("timestamp with time zone");
-
- b.Property<TimeOnly>("StartTime")
- .HasColumnType("time without time zone");
-
- b.Property<int>("Status")
- .HasColumnType("integer");
-
- b.HasKey("Id");
-
- b.ToTable("TaskRunnerJobs");
- });
-
- modelBuilder.Entity("AliasServerDb.UserGrantKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedPrivateKey")
- .IsRequired()
- .HasMaxLength(4000)
- .HasColumnType("character varying(4000)");
-
- b.Property<bool>("IsPrimary")
- .HasColumnType("boolean");
-
- b.Property<string>("PublicKey")
- .IsRequired()
- .HasMaxLength(2000)
- .HasColumnType("character varying(2000)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId")
- .IsUnique()
- .HasDatabaseName("UX_UserGrantKeys_User_Primary")
- .HasFilter("\"IsPrimary\"");
-
- b.ToTable("UserGrantKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.UserUnlockKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Algorithm")
- .IsRequired()
- .HasMaxLength(30)
- .HasColumnType("character varying(30)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedAccountKey")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime?>("LastUsedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Metadata")
- .HasColumnType("jsonb");
-
- b.Property<int>("Type")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId", "Type")
- .IsUnique()
- .HasDatabaseName("UX_UserUnlockKeys_UserId_Type");
-
- b.ToTable("UserUnlockKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobObject", b =>
- {
- b.Property<string>("Hash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<string>("OwnerUserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Category")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<byte[]>("EncryptedData")
- .IsRequired()
- .HasColumnType("bytea");
-
- b.Property<DateTime>("LastReferencedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("SizeBytes")
- .HasColumnType("integer");
-
- b.HasKey("Hash", "OwnerUserId");
-
- b.HasIndex("OwnerUserId", "Category");
-
- b.ToTable("VaultBlobObjects");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobReference", b =>
- {
- b.Property<Guid>("ManifestId")
- .HasColumnType("uuid");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("BlobHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.HasKey("ManifestId", "RevisionNumber", "BlobHash");
-
- b.ToTable("VaultBlobReferences");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucket", b =>
- {
- b.Property<string>("OwnerUserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Category")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("CiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedData")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("OwnerUserId", "Category");
-
- b.ToTable("VaultDataBuckets");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucketsHistory", b =>
- {
- b.Property<string>("OwnerUserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Category")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("CiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedData")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("OwnerUserId", "Category", "RevisionNumber");
-
- b.ToTable("VaultDataBucketsHistory");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifest", b =>
- {
- b.Property<Guid>("ManifestId")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Client")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("CredentialsCount")
- .HasColumnType("integer");
-
- b.Property<int>("EmailClaimsCount")
- .HasColumnType("integer");
-
- b.Property<string>("EncryptionSettings")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("EncryptionType")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<int>("FileSize")
- .HasColumnType("integer");
-
- b.Property<bool>("IsRoot")
- .HasColumnType("boolean");
-
- b.Property<string>("ManifestBlob")
- .HasColumnType("text");
-
- b.Property<string>("ManifestCiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<string>("Name")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<Guid>("OwnerGroupId")
- .HasColumnType("uuid");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("Salt")
- .IsRequired()
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("StorageFormat")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("VaultBlob")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Verifier")
- .IsRequired()
- .HasMaxLength(1000)
- .HasColumnType("character varying(1000)");
-
- b.Property<string>("Version")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("ManifestId");
-
- b.HasIndex("OwnerGroupId")
- .IsUnique()
- .HasDatabaseName("UX_VaultManifests_OwnerGroupId_Root")
- .HasFilter("\"IsRoot\"");
-
- b.ToTable("VaultManifests");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestAccessKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Algorithm")
- .IsRequired()
- .HasMaxLength(30)
- .HasColumnType("character varying(30)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedVek")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime?>("LastUsedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Metadata")
- .HasColumnType("jsonb");
-
- b.Property<int>("Type")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid?>("UserGrantKeyId")
- .HasColumnType("uuid");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<Guid>("VaultManifestId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("UserGrantKeyId");
-
- b.HasIndex("VaultManifestId")
- .HasDatabaseName("IX_VaultManifestAccessKeys_VaultManifestId");
-
- b.HasIndex("UserId", "Type", "VaultManifestId")
- .IsUnique()
- .HasDatabaseName("UX_VaultManifestAccessKeys_UserId_Type_Manifest");
-
- b.ToTable("VaultManifestAccessKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestDeliveryKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("IsPrimary")
- .HasColumnType("boolean");
-
- b.Property<string>("PublicKey")
- .IsRequired()
- .HasMaxLength(2000)
- .HasColumnType("character varying(2000)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid>("VaultManifestId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("VaultManifestId")
- .IsUnique()
- .HasDatabaseName("UX_VaultManifestDeliveryKeys_Manifest_Primary")
- .HasFilter("\"IsPrimary\"");
-
- b.HasIndex("VaultManifestId", "IsPrimary");
-
- b.ToTable("VaultManifestDeliveryKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestsHistory", b =>
- {
- b.Property<Guid>("ManifestId")
- .HasColumnType("uuid");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("Client")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("CredentialsCount")
- .HasColumnType("integer");
-
- b.Property<int>("EmailClaimsCount")
- .HasColumnType("integer");
-
- b.Property<string>("EncryptionSettings")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("EncryptionType")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<int>("FileSize")
- .HasColumnType("integer");
-
- b.Property<string>("ManifestBlob")
- .HasColumnType("text");
-
- b.Property<string>("ManifestCiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<string>("Salt")
- .IsRequired()
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("StorageFormat")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("VaultBlob")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Verifier")
- .IsRequired()
- .HasMaxLength(1000)
- .HasColumnType("character varying(1000)");
-
- b.Property<string>("Version")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("ManifestId", "RevisionNumber");
-
- b.ToTable("VaultManifestsHistory", (string)null);
- });
-
- modelBuilder.Entity("AliasVault.WorkerStatus.Database.WorkerServiceStatus", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("CurrentStatus")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("DesiredStatus")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<DateTime>("Heartbeat")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("ServiceName")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.ToTable("WorkerServiceStatuses");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("FriendlyName")
- .HasColumnType("text");
-
- b.Property<string>("Xml")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("DataProtectionKeys");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("ClaimType")
- .HasColumnType("text");
-
- b.Property<string>("ClaimValue")
- .HasColumnType("text");
-
- b.Property<string>("RoleId")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("RoleClaims", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("ClaimType")
- .HasColumnType("text");
-
- b.Property<string>("ClaimValue")
- .HasColumnType("text");
-
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("UserClaims", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
- {
- b.Property<string>("LoginProvider")
- .HasColumnType("text");
-
- b.Property<string>("ProviderKey")
- .HasColumnType("text");
-
- b.Property<string>("ProviderDisplayName")
- .HasColumnType("text");
-
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.HasKey("LoginProvider", "ProviderKey");
-
- b.ToTable("UserLogins", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
- {
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.Property<string>("RoleId")
- .HasColumnType("text");
-
- b.HasKey("UserId", "RoleId");
-
- b.ToTable("UserRoles", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
- {
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.Property<string>("LoginProvider")
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.Property<string>("Value")
- .HasColumnType("text");
-
- b.HasKey("UserId", "LoginProvider", "Name");
-
- b.ToTable("UserTokens", (string)null);
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>
- {
- b.HasOne("AliasServerDb.Group", "PersonalGroup")
- .WithOne()
- .HasForeignKey("AliasServerDb.AliasVaultUser", "PersonalGroupId")
- .OnDelete(DeleteBehavior.Restrict)
- .IsRequired();
-
- b.Navigation("PersonalGroup");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.Email", b =>
- {
- b.HasOne("AliasServerDb.VaultManifestDeliveryKey", "EncryptionKey")
- .WithMany("Emails")
- .HasForeignKey("EncryptionKeyId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("EncryptionKey");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailAttachment", b =>
- {
- b.HasOne("AliasServerDb.Email", "Email")
- .WithMany("Attachments")
- .HasForeignKey("EmailId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Email");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailClaim", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "VaultManifest")
- .WithMany()
- .HasForeignKey("VaultManifestId")
- .OnDelete(DeleteBehavior.SetNull);
-
- b.Navigation("VaultManifest");
- });
-
- modelBuilder.Entity("AliasServerDb.GroupMember", b =>
- {
- b.HasOne("AliasServerDb.Group", "Group")
- .WithMany("Members")
- .HasForeignKey("GroupId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Group");
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.MobileLoginRequest", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.RateLimit", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.UserGrantKey", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.UserUnlockKey", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobObject", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("OwnerUserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobReference", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "Manifest")
- .WithMany()
- .HasForeignKey("ManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Manifest");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucket", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("OwnerUserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucketsHistory", b =>
- {
- b.HasOne("AliasServerDb.VaultDataBucket", "Bucket")
- .WithMany()
- .HasForeignKey("OwnerUserId", "Category")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Bucket");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifest", b =>
- {
- b.HasOne("AliasServerDb.Group", "OwnerGroup")
- .WithMany()
- .HasForeignKey("OwnerGroupId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("OwnerGroup");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestAccessKey", b =>
- {
- b.HasOne("AliasServerDb.UserGrantKey", "UserGrantKey")
- .WithMany()
- .HasForeignKey("UserGrantKeyId")
- .OnDelete(DeleteBehavior.SetNull);
-
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany("VaultManifestAccessKeys")
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
-
- b.Navigation("UserGrantKey");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestDeliveryKey", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "VaultManifest")
- .WithMany()
- .HasForeignKey("VaultManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("VaultManifest");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestsHistory", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "Manifest")
- .WithMany()
- .HasForeignKey("ManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Manifest");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>
- {
- b.Navigation("VaultManifestAccessKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.Email", b =>
- {
- b.Navigation("Attachments");
- });
-
- modelBuilder.Entity("AliasServerDb.Group", b =>
- {
- b.Navigation("Members");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestDeliveryKey", b =>
- {
- b.Navigation("Emails");
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/apps/server/Databases/AliasServerDb/Migrations/20260801141139_SwapManifestKeyTypeValues.cs b/apps/server/Databases/AliasServerDb/Migrations/20260801141139_SwapManifestKeyTypeValues.cs
deleted file mode 100644
index 7b639c700..000000000
--- a/apps/server/Databases/AliasServerDb/Migrations/20260801141139_SwapManifestKeyTypeValues.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-// <auto-generated>
-using Microsoft.EntityFrameworkCore.Migrations;
-
-#nullable disable
-
-namespace AliasServerDb.Migrations
-{
- /// <summary>
- /// Swap manifest key type values for clarity.
- /// </summary>
- public partial class SwapManifestKeyTypeValues : Migration
- {
- /// <inheritdoc />
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.Sql("""UPDATE "VaultManifestAccessKeys" SET "Type" = CASE "Type" WHEN 1 THEN 2 WHEN 2 THEN 1 ELSE "Type" END WHERE "Type" IN (1, 2);""");
- }
-
- /// <inheritdoc />
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.Sql("""UPDATE "VaultManifestAccessKeys" SET "Type" = CASE "Type" WHEN 1 THEN 2 WHEN 2 THEN 1 ELSE "Type" END WHERE "Type" IN (1, 2);""");
- }
- }
-}
diff --git a/apps/server/Databases/AliasServerDb/Migrations/20260801184559_MoveEmailAbuseCountersToGroups.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/20260801184559_MoveEmailAbuseCountersToGroups.Designer.cs
deleted file mode 100644
index eb40ec17b..000000000
--- a/apps/server/Databases/AliasServerDb/Migrations/20260801184559_MoveEmailAbuseCountersToGroups.Designer.cs
+++ /dev/null
@@ -1,1657 +0,0 @@
-// <auto-generated />
-using System;
-using AliasServerDb;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
-
-#nullable disable
-
-namespace AliasServerDb.Migrations
-{
- [DbContext(typeof(AliasServerDbContext))]
- [Migration("20260801184559_MoveEmailAbuseCountersToGroups")]
- partial class MoveEmailAbuseCountersToGroups
- {
- /// <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)
- .HasAnnotation("Relational:MaxIdentifierLength", 63);
-
- NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
-
- modelBuilder.Entity("AliasServerDb.AdminRole", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("AdminRoles");
- });
-
- modelBuilder.Entity("AliasServerDb.AdminUser", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<int>("AccessFailedCount")
- .HasColumnType("integer");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<string>("Email")
- .HasColumnType("text");
-
- b.Property<bool>("EmailConfirmed")
- .HasColumnType("boolean");
-
- b.Property<DateTime?>("LastPasswordChanged")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("LockoutEnabled")
- .HasColumnType("boolean");
-
- b.Property<DateTimeOffset?>("LockoutEnd")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("NormalizedEmail")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedUserName")
- .HasColumnType("text");
-
- b.Property<string>("PasswordHash")
- .HasColumnType("text");
-
- b.Property<string>("PhoneNumber")
- .HasColumnType("text");
-
- b.Property<bool>("PhoneNumberConfirmed")
- .HasColumnType("boolean");
-
- b.Property<string>("SecurityStamp")
- .HasColumnType("text");
-
- b.Property<bool>("TwoFactorEnabled")
- .HasColumnType("boolean");
-
- b.Property<string>("UserName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("AdminUsers");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultRole", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("AliasVaultRoles");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<int>("AccessFailedCount")
- .HasColumnType("integer");
-
- b.Property<bool>("Blocked")
- .HasColumnType("boolean");
-
- b.Property<DateTime?>("BlockedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Email")
- .HasColumnType("text");
-
- b.Property<bool>("EmailConfirmed")
- .HasColumnType("boolean");
-
- b.Property<DateTime?>("LastActivityDate")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("LockoutEnabled")
- .HasColumnType("boolean");
-
- b.Property<DateTimeOffset?>("LockoutEnd")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("NormalizedEmail")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedUserName")
- .HasColumnType("text");
-
- b.Property<DateTime>("PasswordChangedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("PasswordHash")
- .HasColumnType("text");
-
- b.Property<Guid>("PersonalGroupId")
- .HasColumnType("uuid");
-
- b.Property<string>("PhoneNumber")
- .HasColumnType("text");
-
- b.Property<bool>("PhoneNumberConfirmed")
- .HasColumnType("boolean");
-
- b.Property<string>("SecurityStamp")
- .HasColumnType("text");
-
- b.Property<string>("SrpIdentity")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<bool>("TwoFactorEnabled")
- .HasColumnType("boolean");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.HasIndex("PersonalGroupId")
- .IsUnique()
- .HasDatabaseName("UX_AliasVaultUsers_PersonalGroupId");
-
- b.ToTable("AliasVaultUsers");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("DeviceIdentifier")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime>("ExpireDate")
- .HasMaxLength(255)
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("IpAddress")
- .HasMaxLength(45)
- .HasColumnType("character varying(45)");
-
- b.Property<string>("PreviousTokenValue")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Value")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId");
-
- b.ToTable("AliasVaultUserRefreshTokens");
- });
-
- modelBuilder.Entity("AliasServerDb.AuthLog", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("AdditionalInfo")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Browser")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("Client")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("Country")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("DeviceType")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<int>("EventType")
- .HasColumnType("integer");
-
- b.Property<int?>("FailureReason")
- .HasColumnType("integer");
-
- b.Property<string>("IpAddress")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<bool>("IsSuccess")
- .HasColumnType("boolean");
-
- b.Property<bool>("IsSuspiciousActivity")
- .HasColumnType("boolean");
-
- b.Property<string>("OperatingSystem")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("RequestPath")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<DateTime>("Timestamp")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Username")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex(new[] { "EventType" }, "IX_EventType");
-
- b.HasIndex(new[] { "IpAddress" }, "IX_IpAddress");
-
- b.HasIndex(new[] { "Timestamp" }, "IX_Timestamp");
-
- b.HasIndex(new[] { "Username", "IsSuccess", "Timestamp" }, "IX_Username_IsSuccess_Timestamp")
- .IsDescending(false, false, true);
-
- b.HasIndex(new[] { "Username", "Timestamp" }, "IX_Username_Timestamp")
- .IsDescending(false, true);
-
- b.ToTable("AuthLogs");
- });
-
- modelBuilder.Entity("AliasServerDb.BlockedIpRange", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<bool>("BlockLogin")
- .HasColumnType("boolean");
-
- b.Property<bool>("BlockRegistration")
- .HasColumnType("boolean");
-
- b.Property<bool>("BlockShadow")
- .HasColumnType("boolean");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("CreatedBy")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<bool>("Enabled")
- .HasColumnType("boolean");
-
- b.Property<string>("IpRange")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("Reason")
- .HasMaxLength(500)
- .HasColumnType("character varying(500)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("Id");
-
- b.HasIndex(new[] { "Enabled" }, "IX_BlockedIpRange_Enabled");
-
- b.HasIndex(new[] { "IpRange" }, "IX_BlockedIpRange_IpRange")
- .IsUnique();
-
- b.ToTable("BlockedIpRanges");
- });
-
- modelBuilder.Entity("AliasServerDb.Email", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<DateTime>("Date")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime>("DateSystem")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedSymmetricKey")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<Guid>("EncryptionKeyId")
- .HasMaxLength(255)
- .HasColumnType("uuid");
-
- b.Property<string>("From")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("FromDomain")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("FromLocal")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("MessageHtml")
- .HasColumnType("text");
-
- b.Property<string>("MessagePlain")
- .HasColumnType("text");
-
- b.Property<string>("MessagePreview")
- .HasColumnType("text");
-
- b.Property<string>("MessageSource")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<bool>("PushNotificationSent")
- .HasColumnType("boolean");
-
- b.Property<string>("Subject")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("To")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("ToDomain")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("ToLocal")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<bool>("Visible")
- .HasColumnType("boolean");
-
- b.HasKey("Id");
-
- b.HasIndex("Date");
-
- b.HasIndex("DateSystem");
-
- b.HasIndex("EncryptionKeyId");
-
- b.HasIndex("PushNotificationSent");
-
- b.HasIndex("Visible");
-
- b.HasIndex("To", "DateSystem");
-
- b.ToTable("Emails");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailAttachment", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<byte[]>("Bytes")
- .IsRequired()
- .HasColumnType("bytea");
-
- b.Property<DateTime>("Date")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("EmailId")
- .HasColumnType("integer");
-
- b.Property<string>("Filename")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<int>("Filesize")
- .HasColumnType("integer");
-
- b.Property<string>("MimeType")
- .IsRequired()
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.HasIndex("EmailId");
-
- b.ToTable("EmailAttachments");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailClaim", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Address")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("AddressDomain")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("AddressLocal")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("Disabled")
- .HasColumnType("boolean");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid?>("VaultManifestId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("Address")
- .IsUnique();
-
- b.HasIndex("VaultManifestId", "CreatedAt");
-
- b.HasIndex("VaultManifestId", "Disabled");
-
- b.ToTable("EmailClaims");
- });
-
- modelBuilder.Entity("AliasServerDb.Group", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("EmailsReceived")
- .HasColumnType("integer");
-
- b.Property<int>("MaxEmailAgeDays")
- .HasColumnType("integer");
-
- b.Property<int>("MaxEmails")
- .HasColumnType("integer");
-
- b.Property<string>("Name")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<bool>("ShadowBlocked")
- .HasColumnType("boolean");
-
- b.Property<DateTime?>("ShadowBlockedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("Type")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("Id");
-
- b.ToTable("Groups");
- });
-
- modelBuilder.Entity("AliasServerDb.GroupMember", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid>("GroupId")
- .HasColumnType("uuid");
-
- b.Property<int>("Role")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId");
-
- b.HasIndex("GroupId", "UserId")
- .IsUnique();
-
- b.ToTable("GroupMembers");
- });
-
- modelBuilder.Entity("AliasServerDb.Log", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("Application")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("Exception")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Level")
- .IsRequired()
- .HasMaxLength(128)
- .HasColumnType("character varying(128)");
-
- b.Property<string>("LogEvent")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("LogEvent");
-
- b.Property<string>("Message")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("MessageTemplate")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Properties")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("SourceContext")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("TimeStamp")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("Id");
-
- b.HasIndex("Application");
-
- b.HasIndex("TimeStamp");
-
- b.ToTable("Logs", (string)null);
- });
-
- modelBuilder.Entity("AliasServerDb.MobileLoginRequest", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<DateTime?>("ClearedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("ClientIpAddress")
- .HasColumnType("text");
-
- b.Property<string>("ClientPublicKey")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedDecryptionKey")
- .HasColumnType("text");
-
- b.Property<DateTime?>("FulfilledAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("MobileIpAddress")
- .HasColumnType("text");
-
- b.Property<DateTime?>("RetrievedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.HasIndex(new[] { "ClientIpAddress" }, "IX_ClientIpAddress");
-
- b.HasIndex(new[] { "CreatedAt" }, "IX_CreatedAt");
-
- b.HasIndex(new[] { "MobileIpAddress" }, "IX_MobileIpAddress");
-
- b.HasIndex(new[] { "RetrievedAt", "ClearedAt", "FulfilledAt" }, "IX_RetrievedAt_ClearedAt_FulfilledAt");
-
- b.HasIndex(new[] { "UserId" }, "IX_UserId");
-
- b.ToTable("MobileLoginRequests");
- });
-
- modelBuilder.Entity("AliasServerDb.RateLimit", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<int?>("AppliesToAccountAgeMaxDays")
- .HasColumnType("integer");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("CreatedBy")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime?>("EffectiveFrom")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime?>("EffectiveUntil")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("Enabled")
- .HasColumnType("boolean");
-
- b.Property<int>("LimitType")
- .HasColumnType("integer");
-
- b.Property<int>("MaxCount")
- .HasColumnType("integer");
-
- b.Property<string>("Notes")
- .HasMaxLength(1000)
- .HasColumnType("character varying(1000)");
-
- b.Property<int?>("Tier")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<int>("WindowSeconds")
- .HasColumnType("integer");
-
- b.HasKey("Id");
-
- b.HasIndex("Tier");
-
- b.HasIndex("UserId");
-
- b.HasIndex("LimitType", "Enabled");
-
- b.ToTable("RateLimits");
- });
-
- modelBuilder.Entity("AliasServerDb.ServerSetting", b =>
- {
- b.Property<string>("Key")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Value")
- .HasColumnType("text");
-
- b.HasKey("Key");
-
- b.ToTable("ServerSettings");
- });
-
- modelBuilder.Entity("AliasServerDb.TaskRunnerJob", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<TimeOnly?>("EndTime")
- .HasColumnType("time without time zone");
-
- b.Property<string>("ErrorMessage")
- .HasColumnType("text");
-
- b.Property<bool>("IsOnDemand")
- .HasColumnType("boolean");
-
- b.Property<string>("Name")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<DateTime>("RunDate")
- .HasColumnType("timestamp with time zone");
-
- b.Property<TimeOnly>("StartTime")
- .HasColumnType("time without time zone");
-
- b.Property<int>("Status")
- .HasColumnType("integer");
-
- b.HasKey("Id");
-
- b.ToTable("TaskRunnerJobs");
- });
-
- modelBuilder.Entity("AliasServerDb.UserGrantKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedPrivateKey")
- .IsRequired()
- .HasMaxLength(4000)
- .HasColumnType("character varying(4000)");
-
- b.Property<bool>("IsPrimary")
- .HasColumnType("boolean");
-
- b.Property<string>("PublicKey")
- .IsRequired()
- .HasMaxLength(2000)
- .HasColumnType("character varying(2000)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId")
- .IsUnique()
- .HasDatabaseName("UX_UserGrantKeys_User_Primary")
- .HasFilter("\"IsPrimary\"");
-
- b.ToTable("UserGrantKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.UserUnlockKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Algorithm")
- .IsRequired()
- .HasMaxLength(30)
- .HasColumnType("character varying(30)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedAccountKey")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime?>("LastUsedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Metadata")
- .HasColumnType("jsonb");
-
- b.Property<int>("Type")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId", "Type")
- .IsUnique()
- .HasDatabaseName("UX_UserUnlockKeys_UserId_Type");
-
- b.ToTable("UserUnlockKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobObject", b =>
- {
- b.Property<string>("Hash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<string>("OwnerUserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Category")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<byte[]>("EncryptedData")
- .IsRequired()
- .HasColumnType("bytea");
-
- b.Property<DateTime>("LastReferencedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("SizeBytes")
- .HasColumnType("integer");
-
- b.HasKey("Hash", "OwnerUserId");
-
- b.HasIndex("OwnerUserId", "Category");
-
- b.ToTable("VaultBlobObjects");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobReference", b =>
- {
- b.Property<Guid>("ManifestId")
- .HasColumnType("uuid");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("BlobHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.HasKey("ManifestId", "RevisionNumber", "BlobHash");
-
- b.ToTable("VaultBlobReferences");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucket", b =>
- {
- b.Property<string>("OwnerUserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Category")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("CiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedData")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("OwnerUserId", "Category");
-
- b.ToTable("VaultDataBuckets");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucketsHistory", b =>
- {
- b.Property<string>("OwnerUserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Category")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("CiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedData")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("OwnerUserId", "Category", "RevisionNumber");
-
- b.ToTable("VaultDataBucketsHistory");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifest", b =>
- {
- b.Property<Guid>("ManifestId")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Client")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("CredentialsCount")
- .HasColumnType("integer");
-
- b.Property<int>("EmailClaimsCount")
- .HasColumnType("integer");
-
- b.Property<string>("EncryptionSettings")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("EncryptionType")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<int>("FileSize")
- .HasColumnType("integer");
-
- b.Property<bool>("IsRoot")
- .HasColumnType("boolean");
-
- b.Property<string>("ManifestBlob")
- .HasColumnType("text");
-
- b.Property<string>("ManifestCiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<string>("Name")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<Guid>("OwnerGroupId")
- .HasColumnType("uuid");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("Salt")
- .IsRequired()
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("StorageFormat")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("VaultBlob")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Verifier")
- .IsRequired()
- .HasMaxLength(1000)
- .HasColumnType("character varying(1000)");
-
- b.Property<string>("Version")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("ManifestId");
-
- b.HasIndex("OwnerGroupId")
- .IsUnique()
- .HasDatabaseName("UX_VaultManifests_OwnerGroupId_Root")
- .HasFilter("\"IsRoot\"");
-
- b.ToTable("VaultManifests");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestAccessKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Algorithm")
- .IsRequired()
- .HasMaxLength(30)
- .HasColumnType("character varying(30)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedVek")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime?>("LastUsedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Metadata")
- .HasColumnType("jsonb");
-
- b.Property<int>("Type")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid?>("UserGrantKeyId")
- .HasColumnType("uuid");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<Guid>("VaultManifestId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("UserGrantKeyId");
-
- b.HasIndex("VaultManifestId")
- .HasDatabaseName("IX_VaultManifestAccessKeys_VaultManifestId");
-
- b.HasIndex("UserId", "Type", "VaultManifestId")
- .IsUnique()
- .HasDatabaseName("UX_VaultManifestAccessKeys_UserId_Type_Manifest");
-
- b.ToTable("VaultManifestAccessKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestDeliveryKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("IsPrimary")
- .HasColumnType("boolean");
-
- b.Property<string>("PublicKey")
- .IsRequired()
- .HasMaxLength(2000)
- .HasColumnType("character varying(2000)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid>("VaultManifestId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("VaultManifestId")
- .IsUnique()
- .HasDatabaseName("UX_VaultManifestDeliveryKeys_Manifest_Primary")
- .HasFilter("\"IsPrimary\"");
-
- b.HasIndex("VaultManifestId", "IsPrimary");
-
- b.ToTable("VaultManifestDeliveryKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestsHistory", b =>
- {
- b.Property<Guid>("ManifestId")
- .HasColumnType("uuid");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("Client")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("CredentialsCount")
- .HasColumnType("integer");
-
- b.Property<int>("EmailClaimsCount")
- .HasColumnType("integer");
-
- b.Property<string>("EncryptionSettings")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("EncryptionType")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<int>("FileSize")
- .HasColumnType("integer");
-
- b.Property<string>("ManifestBlob")
- .HasColumnType("text");
-
- b.Property<string>("ManifestCiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<string>("Salt")
- .IsRequired()
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("StorageFormat")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("VaultBlob")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Verifier")
- .IsRequired()
- .HasMaxLength(1000)
- .HasColumnType("character varying(1000)");
-
- b.Property<string>("Version")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("ManifestId", "RevisionNumber");
-
- b.ToTable("VaultManifestsHistory", (string)null);
- });
-
- modelBuilder.Entity("AliasVault.WorkerStatus.Database.WorkerServiceStatus", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("CurrentStatus")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("DesiredStatus")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<DateTime>("Heartbeat")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("ServiceName")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.ToTable("WorkerServiceStatuses");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("FriendlyName")
- .HasColumnType("text");
-
- b.Property<string>("Xml")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("DataProtectionKeys");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("ClaimType")
- .HasColumnType("text");
-
- b.Property<string>("ClaimValue")
- .HasColumnType("text");
-
- b.Property<string>("RoleId")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("RoleClaims", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("ClaimType")
- .HasColumnType("text");
-
- b.Property<string>("ClaimValue")
- .HasColumnType("text");
-
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("UserClaims", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
- {
- b.Property<string>("LoginProvider")
- .HasColumnType("text");
-
- b.Property<string>("ProviderKey")
- .HasColumnType("text");
-
- b.Property<string>("ProviderDisplayName")
- .HasColumnType("text");
-
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.HasKey("LoginProvider", "ProviderKey");
-
- b.ToTable("UserLogins", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
- {
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.Property<string>("RoleId")
- .HasColumnType("text");
-
- b.HasKey("UserId", "RoleId");
-
- b.ToTable("UserRoles", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
- {
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.Property<string>("LoginProvider")
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.Property<string>("Value")
- .HasColumnType("text");
-
- b.HasKey("UserId", "LoginProvider", "Name");
-
- b.ToTable("UserTokens", (string)null);
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>
- {
- b.HasOne("AliasServerDb.Group", "PersonalGroup")
- .WithOne()
- .HasForeignKey("AliasServerDb.AliasVaultUser", "PersonalGroupId")
- .OnDelete(DeleteBehavior.Restrict)
- .IsRequired();
-
- b.Navigation("PersonalGroup");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.Email", b =>
- {
- b.HasOne("AliasServerDb.VaultManifestDeliveryKey", "EncryptionKey")
- .WithMany("Emails")
- .HasForeignKey("EncryptionKeyId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("EncryptionKey");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailAttachment", b =>
- {
- b.HasOne("AliasServerDb.Email", "Email")
- .WithMany("Attachments")
- .HasForeignKey("EmailId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Email");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailClaim", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "VaultManifest")
- .WithMany()
- .HasForeignKey("VaultManifestId")
- .OnDelete(DeleteBehavior.SetNull);
-
- b.Navigation("VaultManifest");
- });
-
- modelBuilder.Entity("AliasServerDb.GroupMember", b =>
- {
- b.HasOne("AliasServerDb.Group", "Group")
- .WithMany("Members")
- .HasForeignKey("GroupId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Group");
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.MobileLoginRequest", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.RateLimit", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.UserGrantKey", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.UserUnlockKey", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobObject", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("OwnerUserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobReference", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "Manifest")
- .WithMany()
- .HasForeignKey("ManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Manifest");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucket", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("OwnerUserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucketsHistory", b =>
- {
- b.HasOne("AliasServerDb.VaultDataBucket", "Bucket")
- .WithMany()
- .HasForeignKey("OwnerUserId", "Category")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Bucket");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifest", b =>
- {
- b.HasOne("AliasServerDb.Group", "OwnerGroup")
- .WithMany()
- .HasForeignKey("OwnerGroupId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("OwnerGroup");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestAccessKey", b =>
- {
- b.HasOne("AliasServerDb.UserGrantKey", "UserGrantKey")
- .WithMany()
- .HasForeignKey("UserGrantKeyId")
- .OnDelete(DeleteBehavior.SetNull);
-
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany("VaultManifestAccessKeys")
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
-
- b.Navigation("UserGrantKey");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestDeliveryKey", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "VaultManifest")
- .WithMany()
- .HasForeignKey("VaultManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("VaultManifest");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestsHistory", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "Manifest")
- .WithMany()
- .HasForeignKey("ManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Manifest");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>
- {
- b.Navigation("VaultManifestAccessKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.Email", b =>
- {
- b.Navigation("Attachments");
- });
-
- modelBuilder.Entity("AliasServerDb.Group", b =>
- {
- b.Navigation("Members");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestDeliveryKey", b =>
- {
- b.Navigation("Emails");
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/apps/server/Databases/AliasServerDb/Migrations/20260801184559_MoveEmailAbuseCountersToGroups.cs b/apps/server/Databases/AliasServerDb/Migrations/20260801184559_MoveEmailAbuseCountersToGroups.cs
deleted file mode 100644
index e93d745d5..000000000
--- a/apps/server/Databases/AliasServerDb/Migrations/20260801184559_MoveEmailAbuseCountersToGroups.cs
+++ /dev/null
@@ -1,153 +0,0 @@
-using System;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-#nullable disable
-
-namespace AliasServerDb.Migrations
-{
- /// <inheritdoc />
- public partial class MoveEmailAbuseCountersToGroups : Migration
- {
- /// <inheritdoc />
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.AddColumn<int>(
- name: "EmailsReceived",
- table: "Groups",
- type: "integer",
- nullable: false,
- defaultValue: 0);
-
- migrationBuilder.AddColumn<int>(
- name: "MaxEmailAgeDays",
- table: "Groups",
- type: "integer",
- nullable: false,
- defaultValue: 0);
-
- migrationBuilder.AddColumn<int>(
- name: "MaxEmails",
- table: "Groups",
- type: "integer",
- nullable: false,
- defaultValue: 0);
-
- migrationBuilder.AddColumn<bool>(
- name: "ShadowBlocked",
- table: "Groups",
- type: "boolean",
- nullable: false,
- defaultValue: false);
-
- migrationBuilder.AddColumn<DateTime>(
- name: "ShadowBlockedAt",
- table: "Groups",
- type: "timestamp with time zone",
- nullable: true);
-
- // Move the existing per-user abuse counters and email limits onto each user's personal group.
- migrationBuilder.Sql(
- """
- UPDATE "Groups" g
- SET "EmailsReceived" = u."EmailsReceived",
- "MaxEmailAgeDays" = u."MaxEmailAgeDays",
- "MaxEmails" = u."MaxEmails",
- "ShadowBlocked" = u."ShadowBlocked",
- "ShadowBlockedAt" = u."ShadowBlockedAt"
- FROM "AliasVaultUsers" u
- WHERE u."PersonalGroupId" = g."Id";
- """);
-
- migrationBuilder.DropColumn(
- name: "EmailsReceived",
- table: "AliasVaultUsers");
-
- migrationBuilder.DropColumn(
- name: "MaxEmailAgeDays",
- table: "AliasVaultUsers");
-
- migrationBuilder.DropColumn(
- name: "MaxEmails",
- table: "AliasVaultUsers");
-
- migrationBuilder.DropColumn(
- name: "ShadowBlocked",
- table: "AliasVaultUsers");
-
- migrationBuilder.DropColumn(
- name: "ShadowBlockedAt",
- table: "AliasVaultUsers");
- }
-
- /// <inheritdoc />
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.AddColumn<int>(
- name: "EmailsReceived",
- table: "AliasVaultUsers",
- type: "integer",
- nullable: false,
- defaultValue: 0);
-
- migrationBuilder.AddColumn<int>(
- name: "MaxEmailAgeDays",
- table: "AliasVaultUsers",
- type: "integer",
- nullable: false,
- defaultValue: 0);
-
- migrationBuilder.AddColumn<int>(
- name: "MaxEmails",
- table: "AliasVaultUsers",
- type: "integer",
- nullable: false,
- defaultValue: 0);
-
- migrationBuilder.AddColumn<bool>(
- name: "ShadowBlocked",
- table: "AliasVaultUsers",
- type: "boolean",
- nullable: false,
- defaultValue: false);
-
- migrationBuilder.AddColumn<DateTime>(
- name: "ShadowBlockedAt",
- table: "AliasVaultUsers",
- type: "timestamp with time zone",
- nullable: true);
-
- // Move the abuse counters and email limits from each user's personal group back onto the user record.
- migrationBuilder.Sql(
- """
- UPDATE "AliasVaultUsers" u
- SET "EmailsReceived" = g."EmailsReceived",
- "MaxEmailAgeDays" = g."MaxEmailAgeDays",
- "MaxEmails" = g."MaxEmails",
- "ShadowBlocked" = g."ShadowBlocked",
- "ShadowBlockedAt" = g."ShadowBlockedAt"
- FROM "Groups" g
- WHERE u."PersonalGroupId" = g."Id";
- """);
-
- migrationBuilder.DropColumn(
- name: "EmailsReceived",
- table: "Groups");
-
- migrationBuilder.DropColumn(
- name: "MaxEmailAgeDays",
- table: "Groups");
-
- migrationBuilder.DropColumn(
- name: "MaxEmails",
- table: "Groups");
-
- migrationBuilder.DropColumn(
- name: "ShadowBlocked",
- table: "Groups");
-
- migrationBuilder.DropColumn(
- name: "ShadowBlockedAt",
- table: "Groups");
- }
- }
-}
diff --git a/apps/server/Databases/AliasServerDb/Migrations/20260803124200_ScopeRateLimitsToGroups.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/20260803124200_ScopeRateLimitsToGroups.Designer.cs
deleted file mode 100644
index 6f835797a..000000000
--- a/apps/server/Databases/AliasServerDb/Migrations/20260803124200_ScopeRateLimitsToGroups.Designer.cs
+++ /dev/null
@@ -1,1656 +0,0 @@
-// <auto-generated />
-using System;
-using AliasServerDb;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
-
-#nullable disable
-
-namespace AliasServerDb.Migrations
-{
- [DbContext(typeof(AliasServerDbContext))]
- [Migration("20260803124200_ScopeRateLimitsToGroups")]
- partial class ScopeRateLimitsToGroups
- {
- /// <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)
- .HasAnnotation("Relational:MaxIdentifierLength", 63);
-
- NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
-
- modelBuilder.Entity("AliasServerDb.AdminRole", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("AdminRoles");
- });
-
- modelBuilder.Entity("AliasServerDb.AdminUser", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<int>("AccessFailedCount")
- .HasColumnType("integer");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<string>("Email")
- .HasColumnType("text");
-
- b.Property<bool>("EmailConfirmed")
- .HasColumnType("boolean");
-
- b.Property<DateTime?>("LastPasswordChanged")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("LockoutEnabled")
- .HasColumnType("boolean");
-
- b.Property<DateTimeOffset?>("LockoutEnd")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("NormalizedEmail")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedUserName")
- .HasColumnType("text");
-
- b.Property<string>("PasswordHash")
- .HasColumnType("text");
-
- b.Property<string>("PhoneNumber")
- .HasColumnType("text");
-
- b.Property<bool>("PhoneNumberConfirmed")
- .HasColumnType("boolean");
-
- b.Property<string>("SecurityStamp")
- .HasColumnType("text");
-
- b.Property<bool>("TwoFactorEnabled")
- .HasColumnType("boolean");
-
- b.Property<string>("UserName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("AdminUsers");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultRole", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("AliasVaultRoles");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<int>("AccessFailedCount")
- .HasColumnType("integer");
-
- b.Property<bool>("Blocked")
- .HasColumnType("boolean");
-
- b.Property<DateTime?>("BlockedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Email")
- .HasColumnType("text");
-
- b.Property<bool>("EmailConfirmed")
- .HasColumnType("boolean");
-
- b.Property<DateTime?>("LastActivityDate")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("LockoutEnabled")
- .HasColumnType("boolean");
-
- b.Property<DateTimeOffset?>("LockoutEnd")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("NormalizedEmail")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedUserName")
- .HasColumnType("text");
-
- b.Property<DateTime>("PasswordChangedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("PasswordHash")
- .HasColumnType("text");
-
- b.Property<Guid>("PersonalGroupId")
- .HasColumnType("uuid");
-
- b.Property<string>("PhoneNumber")
- .HasColumnType("text");
-
- b.Property<bool>("PhoneNumberConfirmed")
- .HasColumnType("boolean");
-
- b.Property<string>("SecurityStamp")
- .HasColumnType("text");
-
- b.Property<string>("SrpIdentity")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<bool>("TwoFactorEnabled")
- .HasColumnType("boolean");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.HasIndex("PersonalGroupId")
- .IsUnique()
- .HasDatabaseName("UX_AliasVaultUsers_PersonalGroupId");
-
- b.ToTable("AliasVaultUsers");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("DeviceIdentifier")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime>("ExpireDate")
- .HasMaxLength(255)
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("IpAddress")
- .HasMaxLength(45)
- .HasColumnType("character varying(45)");
-
- b.Property<string>("PreviousTokenValue")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Value")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId");
-
- b.ToTable("AliasVaultUserRefreshTokens");
- });
-
- modelBuilder.Entity("AliasServerDb.AuthLog", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("AdditionalInfo")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Browser")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("Client")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("Country")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("DeviceType")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<int>("EventType")
- .HasColumnType("integer");
-
- b.Property<int?>("FailureReason")
- .HasColumnType("integer");
-
- b.Property<string>("IpAddress")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<bool>("IsSuccess")
- .HasColumnType("boolean");
-
- b.Property<bool>("IsSuspiciousActivity")
- .HasColumnType("boolean");
-
- b.Property<string>("OperatingSystem")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("RequestPath")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<DateTime>("Timestamp")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Username")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex(new[] { "EventType" }, "IX_EventType");
-
- b.HasIndex(new[] { "IpAddress" }, "IX_IpAddress");
-
- b.HasIndex(new[] { "Timestamp" }, "IX_Timestamp");
-
- b.HasIndex(new[] { "Username", "IsSuccess", "Timestamp" }, "IX_Username_IsSuccess_Timestamp")
- .IsDescending(false, false, true);
-
- b.HasIndex(new[] { "Username", "Timestamp" }, "IX_Username_Timestamp")
- .IsDescending(false, true);
-
- b.ToTable("AuthLogs");
- });
-
- modelBuilder.Entity("AliasServerDb.BlockedIpRange", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<bool>("BlockLogin")
- .HasColumnType("boolean");
-
- b.Property<bool>("BlockRegistration")
- .HasColumnType("boolean");
-
- b.Property<bool>("BlockShadow")
- .HasColumnType("boolean");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("CreatedBy")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<bool>("Enabled")
- .HasColumnType("boolean");
-
- b.Property<string>("IpRange")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("Reason")
- .HasMaxLength(500)
- .HasColumnType("character varying(500)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("Id");
-
- b.HasIndex(new[] { "Enabled" }, "IX_BlockedIpRange_Enabled");
-
- b.HasIndex(new[] { "IpRange" }, "IX_BlockedIpRange_IpRange")
- .IsUnique();
-
- b.ToTable("BlockedIpRanges");
- });
-
- modelBuilder.Entity("AliasServerDb.Email", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<DateTime>("Date")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime>("DateSystem")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedSymmetricKey")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<Guid>("EncryptionKeyId")
- .HasMaxLength(255)
- .HasColumnType("uuid");
-
- b.Property<string>("From")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("FromDomain")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("FromLocal")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("MessageHtml")
- .HasColumnType("text");
-
- b.Property<string>("MessagePlain")
- .HasColumnType("text");
-
- b.Property<string>("MessagePreview")
- .HasColumnType("text");
-
- b.Property<string>("MessageSource")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<bool>("PushNotificationSent")
- .HasColumnType("boolean");
-
- b.Property<string>("Subject")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("To")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("ToDomain")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("ToLocal")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<bool>("Visible")
- .HasColumnType("boolean");
-
- b.HasKey("Id");
-
- b.HasIndex("Date");
-
- b.HasIndex("DateSystem");
-
- b.HasIndex("EncryptionKeyId");
-
- b.HasIndex("PushNotificationSent");
-
- b.HasIndex("Visible");
-
- b.HasIndex("To", "DateSystem");
-
- b.ToTable("Emails");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailAttachment", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<byte[]>("Bytes")
- .IsRequired()
- .HasColumnType("bytea");
-
- b.Property<DateTime>("Date")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("EmailId")
- .HasColumnType("integer");
-
- b.Property<string>("Filename")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<int>("Filesize")
- .HasColumnType("integer");
-
- b.Property<string>("MimeType")
- .IsRequired()
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.HasIndex("EmailId");
-
- b.ToTable("EmailAttachments");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailClaim", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Address")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("AddressDomain")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("AddressLocal")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("Disabled")
- .HasColumnType("boolean");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid?>("VaultManifestId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("Address")
- .IsUnique();
-
- b.HasIndex("VaultManifestId", "CreatedAt");
-
- b.HasIndex("VaultManifestId", "Disabled");
-
- b.ToTable("EmailClaims");
- });
-
- modelBuilder.Entity("AliasServerDb.Group", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("EmailsReceived")
- .HasColumnType("integer");
-
- b.Property<int>("MaxEmailAgeDays")
- .HasColumnType("integer");
-
- b.Property<int>("MaxEmails")
- .HasColumnType("integer");
-
- b.Property<string>("Name")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<bool>("ShadowBlocked")
- .HasColumnType("boolean");
-
- b.Property<DateTime?>("ShadowBlockedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("Type")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("Id");
-
- b.ToTable("Groups");
- });
-
- modelBuilder.Entity("AliasServerDb.GroupMember", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid>("GroupId")
- .HasColumnType("uuid");
-
- b.Property<int>("Role")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId");
-
- b.HasIndex("GroupId", "UserId")
- .IsUnique();
-
- b.ToTable("GroupMembers");
- });
-
- modelBuilder.Entity("AliasServerDb.Log", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("Application")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("Exception")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Level")
- .IsRequired()
- .HasMaxLength(128)
- .HasColumnType("character varying(128)");
-
- b.Property<string>("LogEvent")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("LogEvent");
-
- b.Property<string>("Message")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("MessageTemplate")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Properties")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("SourceContext")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("TimeStamp")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("Id");
-
- b.HasIndex("Application");
-
- b.HasIndex("TimeStamp");
-
- b.ToTable("Logs", (string)null);
- });
-
- modelBuilder.Entity("AliasServerDb.MobileLoginRequest", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<DateTime?>("ClearedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("ClientIpAddress")
- .HasColumnType("text");
-
- b.Property<string>("ClientPublicKey")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedDecryptionKey")
- .HasColumnType("text");
-
- b.Property<DateTime?>("FulfilledAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("MobileIpAddress")
- .HasColumnType("text");
-
- b.Property<DateTime?>("RetrievedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.HasIndex(new[] { "ClientIpAddress" }, "IX_ClientIpAddress");
-
- b.HasIndex(new[] { "CreatedAt" }, "IX_CreatedAt");
-
- b.HasIndex(new[] { "MobileIpAddress" }, "IX_MobileIpAddress");
-
- b.HasIndex(new[] { "RetrievedAt", "ClearedAt", "FulfilledAt" }, "IX_RetrievedAt_ClearedAt_FulfilledAt");
-
- b.HasIndex(new[] { "UserId" }, "IX_UserId");
-
- b.ToTable("MobileLoginRequests");
- });
-
- modelBuilder.Entity("AliasServerDb.RateLimit", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<int?>("AppliesToAccountAgeMaxDays")
- .HasColumnType("integer");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("CreatedBy")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime?>("EffectiveFrom")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime?>("EffectiveUntil")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("Enabled")
- .HasColumnType("boolean");
-
- b.Property<Guid?>("GroupId")
- .HasColumnType("uuid");
-
- b.Property<int>("LimitType")
- .HasColumnType("integer");
-
- b.Property<int>("MaxCount")
- .HasColumnType("integer");
-
- b.Property<string>("Notes")
- .HasMaxLength(1000)
- .HasColumnType("character varying(1000)");
-
- b.Property<int?>("Tier")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("WindowSeconds")
- .HasColumnType("integer");
-
- b.HasKey("Id");
-
- b.HasIndex("GroupId");
-
- b.HasIndex("Tier");
-
- b.HasIndex("LimitType", "Enabled");
-
- b.ToTable("RateLimits");
- });
-
- modelBuilder.Entity("AliasServerDb.ServerSetting", b =>
- {
- b.Property<string>("Key")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Value")
- .HasColumnType("text");
-
- b.HasKey("Key");
-
- b.ToTable("ServerSettings");
- });
-
- modelBuilder.Entity("AliasServerDb.TaskRunnerJob", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<TimeOnly?>("EndTime")
- .HasColumnType("time without time zone");
-
- b.Property<string>("ErrorMessage")
- .HasColumnType("text");
-
- b.Property<bool>("IsOnDemand")
- .HasColumnType("boolean");
-
- b.Property<string>("Name")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<DateTime>("RunDate")
- .HasColumnType("timestamp with time zone");
-
- b.Property<TimeOnly>("StartTime")
- .HasColumnType("time without time zone");
-
- b.Property<int>("Status")
- .HasColumnType("integer");
-
- b.HasKey("Id");
-
- b.ToTable("TaskRunnerJobs");
- });
-
- modelBuilder.Entity("AliasServerDb.UserGrantKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedPrivateKey")
- .IsRequired()
- .HasMaxLength(4000)
- .HasColumnType("character varying(4000)");
-
- b.Property<bool>("IsPrimary")
- .HasColumnType("boolean");
-
- b.Property<string>("PublicKey")
- .IsRequired()
- .HasMaxLength(2000)
- .HasColumnType("character varying(2000)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId")
- .IsUnique()
- .HasDatabaseName("UX_UserGrantKeys_User_Primary")
- .HasFilter("\"IsPrimary\"");
-
- b.ToTable("UserGrantKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.UserUnlockKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Algorithm")
- .IsRequired()
- .HasMaxLength(30)
- .HasColumnType("character varying(30)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedAccountKey")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime?>("LastUsedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Metadata")
- .HasColumnType("jsonb");
-
- b.Property<int>("Type")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId", "Type")
- .IsUnique()
- .HasDatabaseName("UX_UserUnlockKeys_UserId_Type");
-
- b.ToTable("UserUnlockKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobObject", b =>
- {
- b.Property<string>("Hash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<string>("OwnerUserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Category")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<byte[]>("EncryptedData")
- .IsRequired()
- .HasColumnType("bytea");
-
- b.Property<DateTime>("LastReferencedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("SizeBytes")
- .HasColumnType("integer");
-
- b.HasKey("Hash", "OwnerUserId");
-
- b.HasIndex("OwnerUserId", "Category");
-
- b.ToTable("VaultBlobObjects");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobReference", b =>
- {
- b.Property<Guid>("ManifestId")
- .HasColumnType("uuid");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("BlobHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.HasKey("ManifestId", "RevisionNumber", "BlobHash");
-
- b.ToTable("VaultBlobReferences");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucket", b =>
- {
- b.Property<string>("OwnerUserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Category")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("CiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedData")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("OwnerUserId", "Category");
-
- b.ToTable("VaultDataBuckets");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucketsHistory", b =>
- {
- b.Property<string>("OwnerUserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Category")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("CiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedData")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("OwnerUserId", "Category", "RevisionNumber");
-
- b.ToTable("VaultDataBucketsHistory");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifest", b =>
- {
- b.Property<Guid>("ManifestId")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Client")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("CredentialsCount")
- .HasColumnType("integer");
-
- b.Property<int>("EmailClaimsCount")
- .HasColumnType("integer");
-
- b.Property<string>("EncryptionSettings")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("EncryptionType")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<int>("FileSize")
- .HasColumnType("integer");
-
- b.Property<bool>("IsRoot")
- .HasColumnType("boolean");
-
- b.Property<string>("ManifestBlob")
- .HasColumnType("text");
-
- b.Property<string>("ManifestCiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<string>("Name")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<Guid>("OwnerGroupId")
- .HasColumnType("uuid");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("Salt")
- .IsRequired()
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("StorageFormat")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("VaultBlob")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Verifier")
- .IsRequired()
- .HasMaxLength(1000)
- .HasColumnType("character varying(1000)");
-
- b.Property<string>("Version")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("ManifestId");
-
- b.HasIndex("OwnerGroupId")
- .IsUnique()
- .HasDatabaseName("UX_VaultManifests_OwnerGroupId_Root")
- .HasFilter("\"IsRoot\"");
-
- b.ToTable("VaultManifests");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestAccessKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Algorithm")
- .IsRequired()
- .HasMaxLength(30)
- .HasColumnType("character varying(30)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedVek")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime?>("LastUsedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Metadata")
- .HasColumnType("jsonb");
-
- b.Property<int>("Type")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid?>("UserGrantKeyId")
- .HasColumnType("uuid");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<Guid>("VaultManifestId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("UserGrantKeyId");
-
- b.HasIndex("VaultManifestId")
- .HasDatabaseName("IX_VaultManifestAccessKeys_VaultManifestId");
-
- b.HasIndex("UserId", "Type", "VaultManifestId")
- .IsUnique()
- .HasDatabaseName("UX_VaultManifestAccessKeys_UserId_Type_Manifest");
-
- b.ToTable("VaultManifestAccessKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestDeliveryKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("IsPrimary")
- .HasColumnType("boolean");
-
- b.Property<string>("PublicKey")
- .IsRequired()
- .HasMaxLength(2000)
- .HasColumnType("character varying(2000)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid>("VaultManifestId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("VaultManifestId")
- .IsUnique()
- .HasDatabaseName("UX_VaultManifestDeliveryKeys_Manifest_Primary")
- .HasFilter("\"IsPrimary\"");
-
- b.HasIndex("VaultManifestId", "IsPrimary");
-
- b.ToTable("VaultManifestDeliveryKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestsHistory", b =>
- {
- b.Property<Guid>("ManifestId")
- .HasColumnType("uuid");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("Client")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("CredentialsCount")
- .HasColumnType("integer");
-
- b.Property<int>("EmailClaimsCount")
- .HasColumnType("integer");
-
- b.Property<string>("EncryptionSettings")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("EncryptionType")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<int>("FileSize")
- .HasColumnType("integer");
-
- b.Property<string>("ManifestBlob")
- .HasColumnType("text");
-
- b.Property<string>("ManifestCiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<string>("Salt")
- .IsRequired()
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("StorageFormat")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("VaultBlob")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Verifier")
- .IsRequired()
- .HasMaxLength(1000)
- .HasColumnType("character varying(1000)");
-
- b.Property<string>("Version")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("ManifestId", "RevisionNumber");
-
- b.ToTable("VaultManifestsHistory", (string)null);
- });
-
- modelBuilder.Entity("AliasVault.WorkerStatus.Database.WorkerServiceStatus", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("CurrentStatus")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("DesiredStatus")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<DateTime>("Heartbeat")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("ServiceName")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.ToTable("WorkerServiceStatuses");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("FriendlyName")
- .HasColumnType("text");
-
- b.Property<string>("Xml")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("DataProtectionKeys");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("ClaimType")
- .HasColumnType("text");
-
- b.Property<string>("ClaimValue")
- .HasColumnType("text");
-
- b.Property<string>("RoleId")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("RoleClaims", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("ClaimType")
- .HasColumnType("text");
-
- b.Property<string>("ClaimValue")
- .HasColumnType("text");
-
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("UserClaims", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
- {
- b.Property<string>("LoginProvider")
- .HasColumnType("text");
-
- b.Property<string>("ProviderKey")
- .HasColumnType("text");
-
- b.Property<string>("ProviderDisplayName")
- .HasColumnType("text");
-
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.HasKey("LoginProvider", "ProviderKey");
-
- b.ToTable("UserLogins", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
- {
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.Property<string>("RoleId")
- .HasColumnType("text");
-
- b.HasKey("UserId", "RoleId");
-
- b.ToTable("UserRoles", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
- {
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.Property<string>("LoginProvider")
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.Property<string>("Value")
- .HasColumnType("text");
-
- b.HasKey("UserId", "LoginProvider", "Name");
-
- b.ToTable("UserTokens", (string)null);
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>
- {
- b.HasOne("AliasServerDb.Group", "PersonalGroup")
- .WithOne()
- .HasForeignKey("AliasServerDb.AliasVaultUser", "PersonalGroupId")
- .OnDelete(DeleteBehavior.Restrict)
- .IsRequired();
-
- b.Navigation("PersonalGroup");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.Email", b =>
- {
- b.HasOne("AliasServerDb.VaultManifestDeliveryKey", "EncryptionKey")
- .WithMany("Emails")
- .HasForeignKey("EncryptionKeyId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("EncryptionKey");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailAttachment", b =>
- {
- b.HasOne("AliasServerDb.Email", "Email")
- .WithMany("Attachments")
- .HasForeignKey("EmailId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Email");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailClaim", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "VaultManifest")
- .WithMany()
- .HasForeignKey("VaultManifestId")
- .OnDelete(DeleteBehavior.SetNull);
-
- b.Navigation("VaultManifest");
- });
-
- modelBuilder.Entity("AliasServerDb.GroupMember", b =>
- {
- b.HasOne("AliasServerDb.Group", "Group")
- .WithMany("Members")
- .HasForeignKey("GroupId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Group");
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.MobileLoginRequest", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.RateLimit", b =>
- {
- b.HasOne("AliasServerDb.Group", "Group")
- .WithMany()
- .HasForeignKey("GroupId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.Navigation("Group");
- });
-
- modelBuilder.Entity("AliasServerDb.UserGrantKey", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.UserUnlockKey", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobObject", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("OwnerUserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobReference", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "Manifest")
- .WithMany()
- .HasForeignKey("ManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Manifest");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucket", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("OwnerUserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucketsHistory", b =>
- {
- b.HasOne("AliasServerDb.VaultDataBucket", "Bucket")
- .WithMany()
- .HasForeignKey("OwnerUserId", "Category")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Bucket");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifest", b =>
- {
- b.HasOne("AliasServerDb.Group", "OwnerGroup")
- .WithMany()
- .HasForeignKey("OwnerGroupId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("OwnerGroup");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestAccessKey", b =>
- {
- b.HasOne("AliasServerDb.UserGrantKey", "UserGrantKey")
- .WithMany()
- .HasForeignKey("UserGrantKeyId")
- .OnDelete(DeleteBehavior.SetNull);
-
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany("VaultManifestAccessKeys")
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
-
- b.Navigation("UserGrantKey");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestDeliveryKey", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "VaultManifest")
- .WithMany()
- .HasForeignKey("VaultManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("VaultManifest");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestsHistory", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "Manifest")
- .WithMany()
- .HasForeignKey("ManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Manifest");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>
- {
- b.Navigation("VaultManifestAccessKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.Email", b =>
- {
- b.Navigation("Attachments");
- });
-
- modelBuilder.Entity("AliasServerDb.Group", b =>
- {
- b.Navigation("Members");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestDeliveryKey", b =>
- {
- b.Navigation("Emails");
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/apps/server/Databases/AliasServerDb/Migrations/20260803124200_ScopeRateLimitsToGroups.cs b/apps/server/Databases/AliasServerDb/Migrations/20260803124200_ScopeRateLimitsToGroups.cs
deleted file mode 100644
index c4fb9f582..000000000
--- a/apps/server/Databases/AliasServerDb/Migrations/20260803124200_ScopeRateLimitsToGroups.cs
+++ /dev/null
@@ -1,106 +0,0 @@
-using System;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-#nullable disable
-
-namespace AliasServerDb.Migrations
-{
- /// <inheritdoc />
- public partial class ScopeRateLimitsToGroups : Migration
- {
- /// <inheritdoc />
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.AddColumn<Guid>(
- name: "GroupId",
- table: "RateLimits",
- type: "uuid",
- nullable: true);
-
- // Quotas are charged to the group that owns the content, so an existing per-user override becomes an
- // override on that user's personal group: the group their root manifest and personal aliases belong to.
- migrationBuilder.Sql(
- """
- UPDATE "RateLimits" r
- SET "GroupId" = u."PersonalGroupId"
- FROM "AliasVaultUsers" u
- WHERE r."UserId" = u."Id";
- """);
-
- migrationBuilder.DropForeignKey(
- name: "FK_RateLimits_AliasVaultUsers_UserId",
- table: "RateLimits");
-
- migrationBuilder.DropIndex(
- name: "IX_RateLimits_UserId",
- table: "RateLimits");
-
- migrationBuilder.DropColumn(
- name: "UserId",
- table: "RateLimits");
-
- migrationBuilder.CreateIndex(
- name: "IX_RateLimits_GroupId",
- table: "RateLimits",
- column: "GroupId");
-
- migrationBuilder.AddForeignKey(
- name: "FK_RateLimits_Groups_GroupId",
- table: "RateLimits",
- column: "GroupId",
- principalTable: "Groups",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- }
-
- /// <inheritdoc />
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.AddColumn<string>(
- name: "UserId",
- table: "RateLimits",
- type: "character varying(255)",
- maxLength: 255,
- nullable: true);
-
- // Only a personal group maps back to a user. A rule scoped to a shared group has no user equivalent, and
- // leaving it behind with a null UserId would silently promote it to a global rule that hits every account,
- // so those rows are deleted instead.
- migrationBuilder.Sql(
- """
- UPDATE "RateLimits" r
- SET "UserId" = u."Id"
- FROM "AliasVaultUsers" u
- WHERE r."GroupId" = u."PersonalGroupId";
-
- DELETE FROM "RateLimits"
- WHERE "GroupId" IS NOT NULL AND "UserId" IS NULL;
- """);
-
- migrationBuilder.DropForeignKey(
- name: "FK_RateLimits_Groups_GroupId",
- table: "RateLimits");
-
- migrationBuilder.DropIndex(
- name: "IX_RateLimits_GroupId",
- table: "RateLimits");
-
- migrationBuilder.DropColumn(
- name: "GroupId",
- table: "RateLimits");
-
- migrationBuilder.CreateIndex(
- name: "IX_RateLimits_UserId",
- table: "RateLimits",
- column: "UserId");
-
- migrationBuilder.AddForeignKey(
- name: "FK_RateLimits_AliasVaultUsers_UserId",
- table: "RateLimits",
- column: "UserId",
- principalTable: "AliasVaultUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- }
- }
-}
diff --git a/apps/server/Databases/AliasServerDb/Migrations/20260807192839_MakeLegacyManifestColumnsNullable.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/20260807192839_MakeLegacyManifestColumnsNullable.Designer.cs
deleted file mode 100644
index 88f55846d..000000000
--- a/apps/server/Databases/AliasServerDb/Migrations/20260807192839_MakeLegacyManifestColumnsNullable.Designer.cs
+++ /dev/null
@@ -1,1644 +0,0 @@
-// <auto-generated />
-using System;
-using AliasServerDb;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
-
-#nullable disable
-
-namespace AliasServerDb.Migrations
-{
- [DbContext(typeof(AliasServerDbContext))]
- [Migration("20260807192839_MakeLegacyManifestColumnsNullable")]
- partial class MakeLegacyManifestColumnsNullable
- {
- /// <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)
- .HasAnnotation("Relational:MaxIdentifierLength", 63);
-
- NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
-
- modelBuilder.Entity("AliasServerDb.AdminRole", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("AdminRoles");
- });
-
- modelBuilder.Entity("AliasServerDb.AdminUser", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<int>("AccessFailedCount")
- .HasColumnType("integer");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<string>("Email")
- .HasColumnType("text");
-
- b.Property<bool>("EmailConfirmed")
- .HasColumnType("boolean");
-
- b.Property<DateTime?>("LastPasswordChanged")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("LockoutEnabled")
- .HasColumnType("boolean");
-
- b.Property<DateTimeOffset?>("LockoutEnd")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("NormalizedEmail")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedUserName")
- .HasColumnType("text");
-
- b.Property<string>("PasswordHash")
- .HasColumnType("text");
-
- b.Property<string>("PhoneNumber")
- .HasColumnType("text");
-
- b.Property<bool>("PhoneNumberConfirmed")
- .HasColumnType("boolean");
-
- b.Property<string>("SecurityStamp")
- .HasColumnType("text");
-
- b.Property<bool>("TwoFactorEnabled")
- .HasColumnType("boolean");
-
- b.Property<string>("UserName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("AdminUsers");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultRole", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("AliasVaultRoles");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<int>("AccessFailedCount")
- .HasColumnType("integer");
-
- b.Property<bool>("Blocked")
- .HasColumnType("boolean");
-
- b.Property<DateTime?>("BlockedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Email")
- .HasColumnType("text");
-
- b.Property<bool>("EmailConfirmed")
- .HasColumnType("boolean");
-
- b.Property<DateTime?>("LastActivityDate")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("LockoutEnabled")
- .HasColumnType("boolean");
-
- b.Property<DateTimeOffset?>("LockoutEnd")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("NormalizedEmail")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedUserName")
- .HasColumnType("text");
-
- b.Property<DateTime>("PasswordChangedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("PasswordHash")
- .HasColumnType("text");
-
- b.Property<Guid>("PersonalGroupId")
- .HasColumnType("uuid");
-
- b.Property<string>("PhoneNumber")
- .HasColumnType("text");
-
- b.Property<bool>("PhoneNumberConfirmed")
- .HasColumnType("boolean");
-
- b.Property<string>("SecurityStamp")
- .HasColumnType("text");
-
- b.Property<string>("SrpIdentity")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<bool>("TwoFactorEnabled")
- .HasColumnType("boolean");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.HasIndex("PersonalGroupId")
- .IsUnique()
- .HasDatabaseName("UX_AliasVaultUsers_PersonalGroupId");
-
- b.ToTable("AliasVaultUsers");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("DeviceIdentifier")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime>("ExpireDate")
- .HasMaxLength(255)
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("IpAddress")
- .HasMaxLength(45)
- .HasColumnType("character varying(45)");
-
- b.Property<string>("PreviousTokenValue")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Value")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId");
-
- b.ToTable("AliasVaultUserRefreshTokens");
- });
-
- modelBuilder.Entity("AliasServerDb.AuthLog", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("AdditionalInfo")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Browser")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("Client")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("Country")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("DeviceType")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<int>("EventType")
- .HasColumnType("integer");
-
- b.Property<int?>("FailureReason")
- .HasColumnType("integer");
-
- b.Property<string>("IpAddress")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<bool>("IsSuccess")
- .HasColumnType("boolean");
-
- b.Property<bool>("IsSuspiciousActivity")
- .HasColumnType("boolean");
-
- b.Property<string>("OperatingSystem")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("RequestPath")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<DateTime>("Timestamp")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Username")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex(new[] { "EventType" }, "IX_EventType");
-
- b.HasIndex(new[] { "IpAddress" }, "IX_IpAddress");
-
- b.HasIndex(new[] { "Timestamp" }, "IX_Timestamp");
-
- b.HasIndex(new[] { "Username", "IsSuccess", "Timestamp" }, "IX_Username_IsSuccess_Timestamp")
- .IsDescending(false, false, true);
-
- b.HasIndex(new[] { "Username", "Timestamp" }, "IX_Username_Timestamp")
- .IsDescending(false, true);
-
- b.ToTable("AuthLogs");
- });
-
- modelBuilder.Entity("AliasServerDb.BlockedIpRange", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<bool>("BlockLogin")
- .HasColumnType("boolean");
-
- b.Property<bool>("BlockRegistration")
- .HasColumnType("boolean");
-
- b.Property<bool>("BlockShadow")
- .HasColumnType("boolean");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("CreatedBy")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<bool>("Enabled")
- .HasColumnType("boolean");
-
- b.Property<string>("IpRange")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("Reason")
- .HasMaxLength(500)
- .HasColumnType("character varying(500)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("Id");
-
- b.HasIndex(new[] { "Enabled" }, "IX_BlockedIpRange_Enabled");
-
- b.HasIndex(new[] { "IpRange" }, "IX_BlockedIpRange_IpRange")
- .IsUnique();
-
- b.ToTable("BlockedIpRanges");
- });
-
- modelBuilder.Entity("AliasServerDb.Email", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<DateTime>("Date")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime>("DateSystem")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedSymmetricKey")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<Guid>("EncryptionKeyId")
- .HasMaxLength(255)
- .HasColumnType("uuid");
-
- b.Property<string>("From")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("FromDomain")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("FromLocal")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("MessageHtml")
- .HasColumnType("text");
-
- b.Property<string>("MessagePlain")
- .HasColumnType("text");
-
- b.Property<string>("MessagePreview")
- .HasColumnType("text");
-
- b.Property<string>("MessageSource")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<bool>("PushNotificationSent")
- .HasColumnType("boolean");
-
- b.Property<string>("Subject")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("To")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("ToDomain")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("ToLocal")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<bool>("Visible")
- .HasColumnType("boolean");
-
- b.HasKey("Id");
-
- b.HasIndex("Date");
-
- b.HasIndex("DateSystem");
-
- b.HasIndex("EncryptionKeyId");
-
- b.HasIndex("PushNotificationSent");
-
- b.HasIndex("Visible");
-
- b.HasIndex("To", "DateSystem");
-
- b.ToTable("Emails");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailAttachment", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<byte[]>("Bytes")
- .IsRequired()
- .HasColumnType("bytea");
-
- b.Property<DateTime>("Date")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("EmailId")
- .HasColumnType("integer");
-
- b.Property<string>("Filename")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<int>("Filesize")
- .HasColumnType("integer");
-
- b.Property<string>("MimeType")
- .IsRequired()
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.HasIndex("EmailId");
-
- b.ToTable("EmailAttachments");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailClaim", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Address")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("AddressDomain")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("AddressLocal")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("Disabled")
- .HasColumnType("boolean");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid?>("VaultManifestId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("Address")
- .IsUnique();
-
- b.HasIndex("VaultManifestId", "CreatedAt");
-
- b.HasIndex("VaultManifestId", "Disabled");
-
- b.ToTable("EmailClaims");
- });
-
- modelBuilder.Entity("AliasServerDb.Group", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("EmailsReceived")
- .HasColumnType("integer");
-
- b.Property<int>("MaxEmailAgeDays")
- .HasColumnType("integer");
-
- b.Property<int>("MaxEmails")
- .HasColumnType("integer");
-
- b.Property<string>("Name")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<bool>("ShadowBlocked")
- .HasColumnType("boolean");
-
- b.Property<DateTime?>("ShadowBlockedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("Type")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("Id");
-
- b.ToTable("Groups");
- });
-
- modelBuilder.Entity("AliasServerDb.GroupMember", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid>("GroupId")
- .HasColumnType("uuid");
-
- b.Property<int>("Role")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId");
-
- b.HasIndex("GroupId", "UserId")
- .IsUnique();
-
- b.ToTable("GroupMembers");
- });
-
- modelBuilder.Entity("AliasServerDb.Log", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("Application")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("Exception")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Level")
- .IsRequired()
- .HasMaxLength(128)
- .HasColumnType("character varying(128)");
-
- b.Property<string>("LogEvent")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("LogEvent");
-
- b.Property<string>("Message")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("MessageTemplate")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Properties")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("SourceContext")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("TimeStamp")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("Id");
-
- b.HasIndex("Application");
-
- b.HasIndex("TimeStamp");
-
- b.ToTable("Logs", (string)null);
- });
-
- modelBuilder.Entity("AliasServerDb.MobileLoginRequest", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<DateTime?>("ClearedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("ClientIpAddress")
- .HasColumnType("text");
-
- b.Property<string>("ClientPublicKey")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedDecryptionKey")
- .HasColumnType("text");
-
- b.Property<DateTime?>("FulfilledAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("MobileIpAddress")
- .HasColumnType("text");
-
- b.Property<DateTime?>("RetrievedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.HasIndex(new[] { "ClientIpAddress" }, "IX_ClientIpAddress");
-
- b.HasIndex(new[] { "CreatedAt" }, "IX_CreatedAt");
-
- b.HasIndex(new[] { "MobileIpAddress" }, "IX_MobileIpAddress");
-
- b.HasIndex(new[] { "RetrievedAt", "ClearedAt", "FulfilledAt" }, "IX_RetrievedAt_ClearedAt_FulfilledAt");
-
- b.HasIndex(new[] { "UserId" }, "IX_UserId");
-
- b.ToTable("MobileLoginRequests");
- });
-
- modelBuilder.Entity("AliasServerDb.RateLimit", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<int?>("AppliesToAccountAgeMaxDays")
- .HasColumnType("integer");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("CreatedBy")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime?>("EffectiveFrom")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime?>("EffectiveUntil")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("Enabled")
- .HasColumnType("boolean");
-
- b.Property<Guid?>("GroupId")
- .HasColumnType("uuid");
-
- b.Property<int>("LimitType")
- .HasColumnType("integer");
-
- b.Property<int>("MaxCount")
- .HasColumnType("integer");
-
- b.Property<string>("Notes")
- .HasMaxLength(1000)
- .HasColumnType("character varying(1000)");
-
- b.Property<int?>("Tier")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("WindowSeconds")
- .HasColumnType("integer");
-
- b.HasKey("Id");
-
- b.HasIndex("GroupId");
-
- b.HasIndex("Tier");
-
- b.HasIndex("LimitType", "Enabled");
-
- b.ToTable("RateLimits");
- });
-
- modelBuilder.Entity("AliasServerDb.ServerSetting", b =>
- {
- b.Property<string>("Key")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Value")
- .HasColumnType("text");
-
- b.HasKey("Key");
-
- b.ToTable("ServerSettings");
- });
-
- modelBuilder.Entity("AliasServerDb.TaskRunnerJob", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<TimeOnly?>("EndTime")
- .HasColumnType("time without time zone");
-
- b.Property<string>("ErrorMessage")
- .HasColumnType("text");
-
- b.Property<bool>("IsOnDemand")
- .HasColumnType("boolean");
-
- b.Property<string>("Name")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<DateTime>("RunDate")
- .HasColumnType("timestamp with time zone");
-
- b.Property<TimeOnly>("StartTime")
- .HasColumnType("time without time zone");
-
- b.Property<int>("Status")
- .HasColumnType("integer");
-
- b.HasKey("Id");
-
- b.ToTable("TaskRunnerJobs");
- });
-
- modelBuilder.Entity("AliasServerDb.UserGrantKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedPrivateKey")
- .IsRequired()
- .HasMaxLength(4000)
- .HasColumnType("character varying(4000)");
-
- b.Property<bool>("IsPrimary")
- .HasColumnType("boolean");
-
- b.Property<string>("PublicKey")
- .IsRequired()
- .HasMaxLength(2000)
- .HasColumnType("character varying(2000)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId")
- .IsUnique()
- .HasDatabaseName("UX_UserGrantKeys_User_Primary")
- .HasFilter("\"IsPrimary\"");
-
- b.ToTable("UserGrantKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.UserUnlockKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Algorithm")
- .IsRequired()
- .HasMaxLength(30)
- .HasColumnType("character varying(30)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedAccountKey")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime?>("LastUsedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Metadata")
- .HasColumnType("jsonb");
-
- b.Property<int>("Type")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId", "Type")
- .IsUnique()
- .HasDatabaseName("UX_UserUnlockKeys_UserId_Type");
-
- b.ToTable("UserUnlockKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobObject", b =>
- {
- b.Property<string>("Hash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<string>("OwnerUserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Category")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<byte[]>("EncryptedData")
- .IsRequired()
- .HasColumnType("bytea");
-
- b.Property<DateTime>("LastReferencedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("SizeBytes")
- .HasColumnType("integer");
-
- b.HasKey("Hash", "OwnerUserId");
-
- b.HasIndex("OwnerUserId", "Category");
-
- b.ToTable("VaultBlobObjects");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobReference", b =>
- {
- b.Property<Guid>("ManifestId")
- .HasColumnType("uuid");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("BlobHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.HasKey("ManifestId", "RevisionNumber", "BlobHash");
-
- b.ToTable("VaultBlobReferences");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucket", b =>
- {
- b.Property<string>("OwnerUserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Category")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("CiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedData")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("OwnerUserId", "Category");
-
- b.ToTable("VaultDataBuckets");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucketsHistory", b =>
- {
- b.Property<string>("OwnerUserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Category")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("CiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedData")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("OwnerUserId", "Category", "RevisionNumber");
-
- b.ToTable("VaultDataBucketsHistory");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifest", b =>
- {
- b.Property<Guid>("ManifestId")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Client")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("CredentialsCount")
- .HasColumnType("integer");
-
- b.Property<int>("EmailClaimsCount")
- .HasColumnType("integer");
-
- b.Property<string>("EncryptionSettings")
- .HasColumnType("text");
-
- b.Property<string>("EncryptionType")
- .HasColumnType("text");
-
- b.Property<int>("FileSize")
- .HasColumnType("integer");
-
- b.Property<bool>("IsRoot")
- .HasColumnType("boolean");
-
- b.Property<string>("ManifestBlob")
- .HasColumnType("text");
-
- b.Property<string>("ManifestCiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<string>("Name")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<Guid>("OwnerGroupId")
- .HasColumnType("uuid");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("Salt")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("StorageFormat")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("VaultBlob")
- .HasColumnType("text");
-
- b.Property<string>("Verifier")
- .HasMaxLength(1000)
- .HasColumnType("character varying(1000)");
-
- b.Property<string>("Version")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("ManifestId");
-
- b.HasIndex("OwnerGroupId")
- .IsUnique()
- .HasDatabaseName("UX_VaultManifests_OwnerGroupId_Root")
- .HasFilter("\"IsRoot\"");
-
- b.ToTable("VaultManifests");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestAccessKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Algorithm")
- .IsRequired()
- .HasMaxLength(30)
- .HasColumnType("character varying(30)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedVek")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime?>("LastUsedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Metadata")
- .HasColumnType("jsonb");
-
- b.Property<int>("Type")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid?>("UserGrantKeyId")
- .HasColumnType("uuid");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<Guid>("VaultManifestId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("UserGrantKeyId");
-
- b.HasIndex("VaultManifestId")
- .HasDatabaseName("IX_VaultManifestAccessKeys_VaultManifestId");
-
- b.HasIndex("UserId", "Type", "VaultManifestId")
- .IsUnique()
- .HasDatabaseName("UX_VaultManifestAccessKeys_UserId_Type_Manifest");
-
- b.ToTable("VaultManifestAccessKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestDeliveryKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("IsPrimary")
- .HasColumnType("boolean");
-
- b.Property<string>("PublicKey")
- .IsRequired()
- .HasMaxLength(2000)
- .HasColumnType("character varying(2000)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid>("VaultManifestId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("VaultManifestId")
- .IsUnique()
- .HasDatabaseName("UX_VaultManifestDeliveryKeys_Manifest_Primary")
- .HasFilter("\"IsPrimary\"");
-
- b.HasIndex("VaultManifestId", "IsPrimary");
-
- b.ToTable("VaultManifestDeliveryKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestsHistory", b =>
- {
- b.Property<Guid>("ManifestId")
- .HasColumnType("uuid");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("Client")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("CredentialsCount")
- .HasColumnType("integer");
-
- b.Property<int>("EmailClaimsCount")
- .HasColumnType("integer");
-
- b.Property<string>("EncryptionSettings")
- .HasColumnType("text");
-
- b.Property<string>("EncryptionType")
- .HasColumnType("text");
-
- b.Property<int>("FileSize")
- .HasColumnType("integer");
-
- b.Property<string>("ManifestBlob")
- .HasColumnType("text");
-
- b.Property<string>("ManifestCiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<string>("Salt")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("StorageFormat")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("VaultBlob")
- .HasColumnType("text");
-
- b.Property<string>("Verifier")
- .HasMaxLength(1000)
- .HasColumnType("character varying(1000)");
-
- b.Property<string>("Version")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("ManifestId", "RevisionNumber");
-
- b.ToTable("VaultManifestsHistory", (string)null);
- });
-
- modelBuilder.Entity("AliasVault.WorkerStatus.Database.WorkerServiceStatus", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("CurrentStatus")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("DesiredStatus")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<DateTime>("Heartbeat")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("ServiceName")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.ToTable("WorkerServiceStatuses");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("FriendlyName")
- .HasColumnType("text");
-
- b.Property<string>("Xml")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("DataProtectionKeys");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("ClaimType")
- .HasColumnType("text");
-
- b.Property<string>("ClaimValue")
- .HasColumnType("text");
-
- b.Property<string>("RoleId")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("RoleClaims", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("ClaimType")
- .HasColumnType("text");
-
- b.Property<string>("ClaimValue")
- .HasColumnType("text");
-
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("UserClaims", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
- {
- b.Property<string>("LoginProvider")
- .HasColumnType("text");
-
- b.Property<string>("ProviderKey")
- .HasColumnType("text");
-
- b.Property<string>("ProviderDisplayName")
- .HasColumnType("text");
-
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.HasKey("LoginProvider", "ProviderKey");
-
- b.ToTable("UserLogins", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
- {
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.Property<string>("RoleId")
- .HasColumnType("text");
-
- b.HasKey("UserId", "RoleId");
-
- b.ToTable("UserRoles", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
- {
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.Property<string>("LoginProvider")
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.Property<string>("Value")
- .HasColumnType("text");
-
- b.HasKey("UserId", "LoginProvider", "Name");
-
- b.ToTable("UserTokens", (string)null);
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>
- {
- b.HasOne("AliasServerDb.Group", "PersonalGroup")
- .WithOne()
- .HasForeignKey("AliasServerDb.AliasVaultUser", "PersonalGroupId")
- .OnDelete(DeleteBehavior.Restrict)
- .IsRequired();
-
- b.Navigation("PersonalGroup");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.Email", b =>
- {
- b.HasOne("AliasServerDb.VaultManifestDeliveryKey", "EncryptionKey")
- .WithMany("Emails")
- .HasForeignKey("EncryptionKeyId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("EncryptionKey");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailAttachment", b =>
- {
- b.HasOne("AliasServerDb.Email", "Email")
- .WithMany("Attachments")
- .HasForeignKey("EmailId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Email");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailClaim", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "VaultManifest")
- .WithMany()
- .HasForeignKey("VaultManifestId")
- .OnDelete(DeleteBehavior.SetNull);
-
- b.Navigation("VaultManifest");
- });
-
- modelBuilder.Entity("AliasServerDb.GroupMember", b =>
- {
- b.HasOne("AliasServerDb.Group", "Group")
- .WithMany("Members")
- .HasForeignKey("GroupId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Group");
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.MobileLoginRequest", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.RateLimit", b =>
- {
- b.HasOne("AliasServerDb.Group", "Group")
- .WithMany()
- .HasForeignKey("GroupId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.Navigation("Group");
- });
-
- modelBuilder.Entity("AliasServerDb.UserGrantKey", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.UserUnlockKey", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobObject", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("OwnerUserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobReference", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "Manifest")
- .WithMany()
- .HasForeignKey("ManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Manifest");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucket", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("OwnerUserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucketsHistory", b =>
- {
- b.HasOne("AliasServerDb.VaultDataBucket", "Bucket")
- .WithMany()
- .HasForeignKey("OwnerUserId", "Category")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Bucket");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifest", b =>
- {
- b.HasOne("AliasServerDb.Group", "OwnerGroup")
- .WithMany()
- .HasForeignKey("OwnerGroupId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("OwnerGroup");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestAccessKey", b =>
- {
- b.HasOne("AliasServerDb.UserGrantKey", "UserGrantKey")
- .WithMany()
- .HasForeignKey("UserGrantKeyId")
- .OnDelete(DeleteBehavior.SetNull);
-
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany("VaultManifestAccessKeys")
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
-
- b.Navigation("UserGrantKey");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestDeliveryKey", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "VaultManifest")
- .WithMany()
- .HasForeignKey("VaultManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("VaultManifest");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestsHistory", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "Manifest")
- .WithMany()
- .HasForeignKey("ManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Manifest");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>
- {
- b.Navigation("VaultManifestAccessKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.Email", b =>
- {
- b.Navigation("Attachments");
- });
-
- modelBuilder.Entity("AliasServerDb.Group", b =>
- {
- b.Navigation("Members");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestDeliveryKey", b =>
- {
- b.Navigation("Emails");
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/apps/server/Databases/AliasServerDb/Migrations/20260807192839_MakeLegacyManifestColumnsNullable.cs b/apps/server/Databases/AliasServerDb/Migrations/20260807192839_MakeLegacyManifestColumnsNullable.cs
deleted file mode 100644
index e71dd699a..000000000
--- a/apps/server/Databases/AliasServerDb/Migrations/20260807192839_MakeLegacyManifestColumnsNullable.cs
+++ /dev/null
@@ -1,302 +0,0 @@
-using Microsoft.EntityFrameworkCore.Migrations;
-
-#nullable disable
-
-namespace AliasServerDb.Migrations
-{
- /// <inheritdoc />
- public partial class MakeLegacyManifestColumnsNullable : Migration
- {
- /// <inheritdoc />
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.AlterColumn<string>(
- name: "Version",
- table: "VaultManifestsHistory",
- type: "character varying(255)",
- maxLength: 255,
- nullable: true,
- oldClrType: typeof(string),
- oldType: "character varying(255)",
- oldMaxLength: 255);
-
- migrationBuilder.AlterColumn<string>(
- name: "Verifier",
- table: "VaultManifestsHistory",
- type: "character varying(1000)",
- maxLength: 1000,
- nullable: true,
- oldClrType: typeof(string),
- oldType: "character varying(1000)",
- oldMaxLength: 1000);
-
- migrationBuilder.AlterColumn<string>(
- name: "VaultBlob",
- table: "VaultManifestsHistory",
- type: "text",
- nullable: true,
- oldClrType: typeof(string),
- oldType: "text");
-
- migrationBuilder.AlterColumn<string>(
- name: "Salt",
- table: "VaultManifestsHistory",
- type: "character varying(100)",
- maxLength: 100,
- nullable: true,
- oldClrType: typeof(string),
- oldType: "character varying(100)",
- oldMaxLength: 100);
-
- migrationBuilder.AlterColumn<string>(
- name: "EncryptionType",
- table: "VaultManifestsHistory",
- type: "text",
- nullable: true,
- oldClrType: typeof(string),
- oldType: "text");
-
- migrationBuilder.AlterColumn<string>(
- name: "EncryptionSettings",
- table: "VaultManifestsHistory",
- type: "text",
- nullable: true,
- oldClrType: typeof(string),
- oldType: "text");
-
- migrationBuilder.AlterColumn<string>(
- name: "Version",
- table: "VaultManifests",
- type: "character varying(255)",
- maxLength: 255,
- nullable: true,
- oldClrType: typeof(string),
- oldType: "character varying(255)",
- oldMaxLength: 255);
-
- migrationBuilder.AlterColumn<string>(
- name: "Verifier",
- table: "VaultManifests",
- type: "character varying(1000)",
- maxLength: 1000,
- nullable: true,
- oldClrType: typeof(string),
- oldType: "character varying(1000)",
- oldMaxLength: 1000);
-
- migrationBuilder.AlterColumn<string>(
- name: "VaultBlob",
- table: "VaultManifests",
- type: "text",
- nullable: true,
- oldClrType: typeof(string),
- oldType: "text");
-
- migrationBuilder.AlterColumn<string>(
- name: "Salt",
- table: "VaultManifests",
- type: "character varying(100)",
- maxLength: 100,
- nullable: true,
- oldClrType: typeof(string),
- oldType: "character varying(100)",
- oldMaxLength: 100);
-
- migrationBuilder.AlterColumn<string>(
- name: "EncryptionType",
- table: "VaultManifests",
- type: "text",
- nullable: true,
- oldClrType: typeof(string),
- oldType: "text");
-
- migrationBuilder.AlterColumn<string>(
- name: "EncryptionSettings",
- table: "VaultManifests",
- type: "text",
- nullable: true,
- oldClrType: typeof(string),
- oldType: "text");
-
- // Replace the old empty-string sentinel with NULL so the columns read uniformly: a NULL VaultBlob/Version
- // means the revision is manifest-v1, and NULL SRP columns mean the credentials moved to the unlock-key
- // model. Only legacy sqlite-blob revisions keep values here.
- migrationBuilder.Sql("""
- UPDATE "VaultManifests" SET
- "VaultBlob" = NULLIF("VaultBlob", ''),
- "Version" = NULLIF("Version", ''),
- "Salt" = NULLIF("Salt", ''),
- "Verifier" = NULLIF("Verifier", ''),
- "EncryptionType" = NULLIF("EncryptionType", ''),
- "EncryptionSettings" = NULLIF("EncryptionSettings", '');
- """);
-
- migrationBuilder.Sql("""
- UPDATE "VaultManifestsHistory" SET
- "VaultBlob" = NULLIF("VaultBlob", ''),
- "Version" = NULLIF("Version", ''),
- "Salt" = NULLIF("Salt", ''),
- "Verifier" = NULLIF("Verifier", ''),
- "EncryptionType" = NULLIF("EncryptionType", ''),
- "EncryptionSettings" = NULLIF("EncryptionSettings", '');
- """);
- }
-
- /// <inheritdoc />
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- // Restore the empty-string sentinel first: the columns below go back to NOT NULL.
- migrationBuilder.Sql("""
- UPDATE "VaultManifests" SET
- "VaultBlob" = COALESCE("VaultBlob", ''),
- "Version" = COALESCE("Version", ''),
- "Salt" = COALESCE("Salt", ''),
- "Verifier" = COALESCE("Verifier", ''),
- "EncryptionType" = COALESCE("EncryptionType", ''),
- "EncryptionSettings" = COALESCE("EncryptionSettings", '');
- """);
-
- migrationBuilder.Sql("""
- UPDATE "VaultManifestsHistory" SET
- "VaultBlob" = COALESCE("VaultBlob", ''),
- "Version" = COALESCE("Version", ''),
- "Salt" = COALESCE("Salt", ''),
- "Verifier" = COALESCE("Verifier", ''),
- "EncryptionType" = COALESCE("EncryptionType", ''),
- "EncryptionSettings" = COALESCE("EncryptionSettings", '');
- """);
-
- migrationBuilder.AlterColumn<string>(
- name: "Version",
- table: "VaultManifestsHistory",
- type: "character varying(255)",
- maxLength: 255,
- nullable: false,
- defaultValue: "",
- oldClrType: typeof(string),
- oldType: "character varying(255)",
- oldMaxLength: 255,
- oldNullable: true);
-
- migrationBuilder.AlterColumn<string>(
- name: "Verifier",
- table: "VaultManifestsHistory",
- type: "character varying(1000)",
- maxLength: 1000,
- nullable: false,
- defaultValue: "",
- oldClrType: typeof(string),
- oldType: "character varying(1000)",
- oldMaxLength: 1000,
- oldNullable: true);
-
- migrationBuilder.AlterColumn<string>(
- name: "VaultBlob",
- table: "VaultManifestsHistory",
- type: "text",
- nullable: false,
- defaultValue: "",
- oldClrType: typeof(string),
- oldType: "text",
- oldNullable: true);
-
- migrationBuilder.AlterColumn<string>(
- name: "Salt",
- table: "VaultManifestsHistory",
- type: "character varying(100)",
- maxLength: 100,
- nullable: false,
- defaultValue: "",
- oldClrType: typeof(string),
- oldType: "character varying(100)",
- oldMaxLength: 100,
- oldNullable: true);
-
- migrationBuilder.AlterColumn<string>(
- name: "EncryptionType",
- table: "VaultManifestsHistory",
- type: "text",
- nullable: false,
- defaultValue: "",
- oldClrType: typeof(string),
- oldType: "text",
- oldNullable: true);
-
- migrationBuilder.AlterColumn<string>(
- name: "EncryptionSettings",
- table: "VaultManifestsHistory",
- type: "text",
- nullable: false,
- defaultValue: "",
- oldClrType: typeof(string),
- oldType: "text",
- oldNullable: true);
-
- migrationBuilder.AlterColumn<string>(
- name: "Version",
- table: "VaultManifests",
- type: "character varying(255)",
- maxLength: 255,
- nullable: false,
- defaultValue: "",
- oldClrType: typeof(string),
- oldType: "character varying(255)",
- oldMaxLength: 255,
- oldNullable: true);
-
- migrationBuilder.AlterColumn<string>(
- name: "Verifier",
- table: "VaultManifests",
- type: "character varying(1000)",
- maxLength: 1000,
- nullable: false,
- defaultValue: "",
- oldClrType: typeof(string),
- oldType: "character varying(1000)",
- oldMaxLength: 1000,
- oldNullable: true);
-
- migrationBuilder.AlterColumn<string>(
- name: "VaultBlob",
- table: "VaultManifests",
- type: "text",
- nullable: false,
- defaultValue: "",
- oldClrType: typeof(string),
- oldType: "text",
- oldNullable: true);
-
- migrationBuilder.AlterColumn<string>(
- name: "Salt",
- table: "VaultManifests",
- type: "character varying(100)",
- maxLength: 100,
- nullable: false,
- defaultValue: "",
- oldClrType: typeof(string),
- oldType: "character varying(100)",
- oldMaxLength: 100,
- oldNullable: true);
-
- migrationBuilder.AlterColumn<string>(
- name: "EncryptionType",
- table: "VaultManifests",
- type: "text",
- nullable: false,
- defaultValue: "",
- oldClrType: typeof(string),
- oldType: "text",
- oldNullable: true);
-
- migrationBuilder.AlterColumn<string>(
- name: "EncryptionSettings",
- table: "VaultManifests",
- type: "text",
- nullable: false,
- defaultValue: "",
- oldClrType: typeof(string),
- oldType: "text",
- oldNullable: true);
- }
- }
-}
diff --git a/apps/server/Databases/AliasServerDb/Migrations/20260807200945_RenameRootManifestToPersonal.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/20260807200945_RenameRootManifestToPersonal.Designer.cs
deleted file mode 100644
index fd2a504d2..000000000
--- a/apps/server/Databases/AliasServerDb/Migrations/20260807200945_RenameRootManifestToPersonal.Designer.cs
+++ /dev/null
@@ -1,1644 +0,0 @@
-// <auto-generated />
-using System;
-using AliasServerDb;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
-
-#nullable disable
-
-namespace AliasServerDb.Migrations
-{
- [DbContext(typeof(AliasServerDbContext))]
- [Migration("20260807200945_RenameRootManifestToPersonal")]
- partial class RenameRootManifestToPersonal
- {
- /// <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)
- .HasAnnotation("Relational:MaxIdentifierLength", 63);
-
- NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
-
- modelBuilder.Entity("AliasServerDb.AdminRole", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("AdminRoles");
- });
-
- modelBuilder.Entity("AliasServerDb.AdminUser", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<int>("AccessFailedCount")
- .HasColumnType("integer");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<string>("Email")
- .HasColumnType("text");
-
- b.Property<bool>("EmailConfirmed")
- .HasColumnType("boolean");
-
- b.Property<DateTime?>("LastPasswordChanged")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("LockoutEnabled")
- .HasColumnType("boolean");
-
- b.Property<DateTimeOffset?>("LockoutEnd")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("NormalizedEmail")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedUserName")
- .HasColumnType("text");
-
- b.Property<string>("PasswordHash")
- .HasColumnType("text");
-
- b.Property<string>("PhoneNumber")
- .HasColumnType("text");
-
- b.Property<bool>("PhoneNumberConfirmed")
- .HasColumnType("boolean");
-
- b.Property<string>("SecurityStamp")
- .HasColumnType("text");
-
- b.Property<bool>("TwoFactorEnabled")
- .HasColumnType("boolean");
-
- b.Property<string>("UserName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("AdminUsers");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultRole", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("AliasVaultRoles");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<int>("AccessFailedCount")
- .HasColumnType("integer");
-
- b.Property<bool>("Blocked")
- .HasColumnType("boolean");
-
- b.Property<DateTime?>("BlockedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Email")
- .HasColumnType("text");
-
- b.Property<bool>("EmailConfirmed")
- .HasColumnType("boolean");
-
- b.Property<DateTime?>("LastActivityDate")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("LockoutEnabled")
- .HasColumnType("boolean");
-
- b.Property<DateTimeOffset?>("LockoutEnd")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("NormalizedEmail")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedUserName")
- .HasColumnType("text");
-
- b.Property<DateTime>("PasswordChangedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("PasswordHash")
- .HasColumnType("text");
-
- b.Property<Guid>("PersonalGroupId")
- .HasColumnType("uuid");
-
- b.Property<string>("PhoneNumber")
- .HasColumnType("text");
-
- b.Property<bool>("PhoneNumberConfirmed")
- .HasColumnType("boolean");
-
- b.Property<string>("SecurityStamp")
- .HasColumnType("text");
-
- b.Property<string>("SrpIdentity")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<bool>("TwoFactorEnabled")
- .HasColumnType("boolean");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.HasIndex("PersonalGroupId")
- .IsUnique()
- .HasDatabaseName("UX_AliasVaultUsers_PersonalGroupId");
-
- b.ToTable("AliasVaultUsers");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("DeviceIdentifier")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime>("ExpireDate")
- .HasMaxLength(255)
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("IpAddress")
- .HasMaxLength(45)
- .HasColumnType("character varying(45)");
-
- b.Property<string>("PreviousTokenValue")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Value")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId");
-
- b.ToTable("AliasVaultUserRefreshTokens");
- });
-
- modelBuilder.Entity("AliasServerDb.AuthLog", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("AdditionalInfo")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Browser")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("Client")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("Country")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("DeviceType")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<int>("EventType")
- .HasColumnType("integer");
-
- b.Property<int?>("FailureReason")
- .HasColumnType("integer");
-
- b.Property<string>("IpAddress")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<bool>("IsSuccess")
- .HasColumnType("boolean");
-
- b.Property<bool>("IsSuspiciousActivity")
- .HasColumnType("boolean");
-
- b.Property<string>("OperatingSystem")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("RequestPath")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<DateTime>("Timestamp")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Username")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex(new[] { "EventType" }, "IX_EventType");
-
- b.HasIndex(new[] { "IpAddress" }, "IX_IpAddress");
-
- b.HasIndex(new[] { "Timestamp" }, "IX_Timestamp");
-
- b.HasIndex(new[] { "Username", "IsSuccess", "Timestamp" }, "IX_Username_IsSuccess_Timestamp")
- .IsDescending(false, false, true);
-
- b.HasIndex(new[] { "Username", "Timestamp" }, "IX_Username_Timestamp")
- .IsDescending(false, true);
-
- b.ToTable("AuthLogs");
- });
-
- modelBuilder.Entity("AliasServerDb.BlockedIpRange", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<bool>("BlockLogin")
- .HasColumnType("boolean");
-
- b.Property<bool>("BlockRegistration")
- .HasColumnType("boolean");
-
- b.Property<bool>("BlockShadow")
- .HasColumnType("boolean");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("CreatedBy")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<bool>("Enabled")
- .HasColumnType("boolean");
-
- b.Property<string>("IpRange")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("Reason")
- .HasMaxLength(500)
- .HasColumnType("character varying(500)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("Id");
-
- b.HasIndex(new[] { "Enabled" }, "IX_BlockedIpRange_Enabled");
-
- b.HasIndex(new[] { "IpRange" }, "IX_BlockedIpRange_IpRange")
- .IsUnique();
-
- b.ToTable("BlockedIpRanges");
- });
-
- modelBuilder.Entity("AliasServerDb.Email", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<DateTime>("Date")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime>("DateSystem")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedSymmetricKey")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<Guid>("EncryptionKeyId")
- .HasMaxLength(255)
- .HasColumnType("uuid");
-
- b.Property<string>("From")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("FromDomain")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("FromLocal")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("MessageHtml")
- .HasColumnType("text");
-
- b.Property<string>("MessagePlain")
- .HasColumnType("text");
-
- b.Property<string>("MessagePreview")
- .HasColumnType("text");
-
- b.Property<string>("MessageSource")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<bool>("PushNotificationSent")
- .HasColumnType("boolean");
-
- b.Property<string>("Subject")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("To")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("ToDomain")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("ToLocal")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<bool>("Visible")
- .HasColumnType("boolean");
-
- b.HasKey("Id");
-
- b.HasIndex("Date");
-
- b.HasIndex("DateSystem");
-
- b.HasIndex("EncryptionKeyId");
-
- b.HasIndex("PushNotificationSent");
-
- b.HasIndex("Visible");
-
- b.HasIndex("To", "DateSystem");
-
- b.ToTable("Emails");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailAttachment", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<byte[]>("Bytes")
- .IsRequired()
- .HasColumnType("bytea");
-
- b.Property<DateTime>("Date")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("EmailId")
- .HasColumnType("integer");
-
- b.Property<string>("Filename")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<int>("Filesize")
- .HasColumnType("integer");
-
- b.Property<string>("MimeType")
- .IsRequired()
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.HasIndex("EmailId");
-
- b.ToTable("EmailAttachments");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailClaim", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Address")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("AddressDomain")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("AddressLocal")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("Disabled")
- .HasColumnType("boolean");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid?>("VaultManifestId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("Address")
- .IsUnique();
-
- b.HasIndex("VaultManifestId", "CreatedAt");
-
- b.HasIndex("VaultManifestId", "Disabled");
-
- b.ToTable("EmailClaims");
- });
-
- modelBuilder.Entity("AliasServerDb.Group", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("EmailsReceived")
- .HasColumnType("integer");
-
- b.Property<int>("MaxEmailAgeDays")
- .HasColumnType("integer");
-
- b.Property<int>("MaxEmails")
- .HasColumnType("integer");
-
- b.Property<string>("Name")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<bool>("ShadowBlocked")
- .HasColumnType("boolean");
-
- b.Property<DateTime?>("ShadowBlockedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("Type")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("Id");
-
- b.ToTable("Groups");
- });
-
- modelBuilder.Entity("AliasServerDb.GroupMember", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid>("GroupId")
- .HasColumnType("uuid");
-
- b.Property<int>("Role")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId");
-
- b.HasIndex("GroupId", "UserId")
- .IsUnique();
-
- b.ToTable("GroupMembers");
- });
-
- modelBuilder.Entity("AliasServerDb.Log", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("Application")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("Exception")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Level")
- .IsRequired()
- .HasMaxLength(128)
- .HasColumnType("character varying(128)");
-
- b.Property<string>("LogEvent")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("LogEvent");
-
- b.Property<string>("Message")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("MessageTemplate")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Properties")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("SourceContext")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("TimeStamp")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("Id");
-
- b.HasIndex("Application");
-
- b.HasIndex("TimeStamp");
-
- b.ToTable("Logs", (string)null);
- });
-
- modelBuilder.Entity("AliasServerDb.MobileLoginRequest", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<DateTime?>("ClearedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("ClientIpAddress")
- .HasColumnType("text");
-
- b.Property<string>("ClientPublicKey")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedDecryptionKey")
- .HasColumnType("text");
-
- b.Property<DateTime?>("FulfilledAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("MobileIpAddress")
- .HasColumnType("text");
-
- b.Property<DateTime?>("RetrievedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.HasIndex(new[] { "ClientIpAddress" }, "IX_ClientIpAddress");
-
- b.HasIndex(new[] { "CreatedAt" }, "IX_CreatedAt");
-
- b.HasIndex(new[] { "MobileIpAddress" }, "IX_MobileIpAddress");
-
- b.HasIndex(new[] { "RetrievedAt", "ClearedAt", "FulfilledAt" }, "IX_RetrievedAt_ClearedAt_FulfilledAt");
-
- b.HasIndex(new[] { "UserId" }, "IX_UserId");
-
- b.ToTable("MobileLoginRequests");
- });
-
- modelBuilder.Entity("AliasServerDb.RateLimit", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<int?>("AppliesToAccountAgeMaxDays")
- .HasColumnType("integer");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("CreatedBy")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime?>("EffectiveFrom")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime?>("EffectiveUntil")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("Enabled")
- .HasColumnType("boolean");
-
- b.Property<Guid?>("GroupId")
- .HasColumnType("uuid");
-
- b.Property<int>("LimitType")
- .HasColumnType("integer");
-
- b.Property<int>("MaxCount")
- .HasColumnType("integer");
-
- b.Property<string>("Notes")
- .HasMaxLength(1000)
- .HasColumnType("character varying(1000)");
-
- b.Property<int?>("Tier")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("WindowSeconds")
- .HasColumnType("integer");
-
- b.HasKey("Id");
-
- b.HasIndex("GroupId");
-
- b.HasIndex("Tier");
-
- b.HasIndex("LimitType", "Enabled");
-
- b.ToTable("RateLimits");
- });
-
- modelBuilder.Entity("AliasServerDb.ServerSetting", b =>
- {
- b.Property<string>("Key")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Value")
- .HasColumnType("text");
-
- b.HasKey("Key");
-
- b.ToTable("ServerSettings");
- });
-
- modelBuilder.Entity("AliasServerDb.TaskRunnerJob", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<TimeOnly?>("EndTime")
- .HasColumnType("time without time zone");
-
- b.Property<string>("ErrorMessage")
- .HasColumnType("text");
-
- b.Property<bool>("IsOnDemand")
- .HasColumnType("boolean");
-
- b.Property<string>("Name")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<DateTime>("RunDate")
- .HasColumnType("timestamp with time zone");
-
- b.Property<TimeOnly>("StartTime")
- .HasColumnType("time without time zone");
-
- b.Property<int>("Status")
- .HasColumnType("integer");
-
- b.HasKey("Id");
-
- b.ToTable("TaskRunnerJobs");
- });
-
- modelBuilder.Entity("AliasServerDb.UserGrantKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedPrivateKey")
- .IsRequired()
- .HasMaxLength(4000)
- .HasColumnType("character varying(4000)");
-
- b.Property<bool>("IsPrimary")
- .HasColumnType("boolean");
-
- b.Property<string>("PublicKey")
- .IsRequired()
- .HasMaxLength(2000)
- .HasColumnType("character varying(2000)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId")
- .IsUnique()
- .HasDatabaseName("UX_UserGrantKeys_User_Primary")
- .HasFilter("\"IsPrimary\"");
-
- b.ToTable("UserGrantKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.UserUnlockKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Algorithm")
- .IsRequired()
- .HasMaxLength(30)
- .HasColumnType("character varying(30)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedAccountKey")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime?>("LastUsedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Metadata")
- .HasColumnType("jsonb");
-
- b.Property<int>("Type")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId", "Type")
- .IsUnique()
- .HasDatabaseName("UX_UserUnlockKeys_UserId_Type");
-
- b.ToTable("UserUnlockKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobObject", b =>
- {
- b.Property<string>("Hash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<string>("OwnerUserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Category")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<byte[]>("EncryptedData")
- .IsRequired()
- .HasColumnType("bytea");
-
- b.Property<DateTime>("LastReferencedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("SizeBytes")
- .HasColumnType("integer");
-
- b.HasKey("Hash", "OwnerUserId");
-
- b.HasIndex("OwnerUserId", "Category");
-
- b.ToTable("VaultBlobObjects");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobReference", b =>
- {
- b.Property<Guid>("ManifestId")
- .HasColumnType("uuid");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("BlobHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.HasKey("ManifestId", "RevisionNumber", "BlobHash");
-
- b.ToTable("VaultBlobReferences");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucket", b =>
- {
- b.Property<string>("OwnerUserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Category")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("CiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedData")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("OwnerUserId", "Category");
-
- b.ToTable("VaultDataBuckets");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucketsHistory", b =>
- {
- b.Property<string>("OwnerUserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Category")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("CiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedData")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("OwnerUserId", "Category", "RevisionNumber");
-
- b.ToTable("VaultDataBucketsHistory");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifest", b =>
- {
- b.Property<Guid>("ManifestId")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Client")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("CredentialsCount")
- .HasColumnType("integer");
-
- b.Property<int>("EmailClaimsCount")
- .HasColumnType("integer");
-
- b.Property<string>("EncryptionSettings")
- .HasColumnType("text");
-
- b.Property<string>("EncryptionType")
- .HasColumnType("text");
-
- b.Property<int>("FileSize")
- .HasColumnType("integer");
-
- b.Property<bool>("IsPersonal")
- .HasColumnType("boolean");
-
- b.Property<string>("ManifestBlob")
- .HasColumnType("text");
-
- b.Property<string>("ManifestCiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<string>("Name")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<Guid>("OwnerGroupId")
- .HasColumnType("uuid");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("Salt")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("StorageFormat")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("VaultBlob")
- .HasColumnType("text");
-
- b.Property<string>("Verifier")
- .HasMaxLength(1000)
- .HasColumnType("character varying(1000)");
-
- b.Property<string>("Version")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("ManifestId");
-
- b.HasIndex("OwnerGroupId")
- .IsUnique()
- .HasDatabaseName("UX_VaultManifests_OwnerGroupId_Personal")
- .HasFilter("\"IsPersonal\"");
-
- b.ToTable("VaultManifests");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestAccessKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Algorithm")
- .IsRequired()
- .HasMaxLength(30)
- .HasColumnType("character varying(30)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedVek")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime?>("LastUsedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Metadata")
- .HasColumnType("jsonb");
-
- b.Property<int>("Type")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid?>("UserGrantKeyId")
- .HasColumnType("uuid");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<Guid>("VaultManifestId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("UserGrantKeyId");
-
- b.HasIndex("VaultManifestId")
- .HasDatabaseName("IX_VaultManifestAccessKeys_VaultManifestId");
-
- b.HasIndex("UserId", "Type", "VaultManifestId")
- .IsUnique()
- .HasDatabaseName("UX_VaultManifestAccessKeys_UserId_Type_Manifest");
-
- b.ToTable("VaultManifestAccessKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestDeliveryKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("IsPrimary")
- .HasColumnType("boolean");
-
- b.Property<string>("PublicKey")
- .IsRequired()
- .HasMaxLength(2000)
- .HasColumnType("character varying(2000)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid>("VaultManifestId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("VaultManifestId")
- .IsUnique()
- .HasDatabaseName("UX_VaultManifestDeliveryKeys_Manifest_Primary")
- .HasFilter("\"IsPrimary\"");
-
- b.HasIndex("VaultManifestId", "IsPrimary");
-
- b.ToTable("VaultManifestDeliveryKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestsHistory", b =>
- {
- b.Property<Guid>("ManifestId")
- .HasColumnType("uuid");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("Client")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("CredentialsCount")
- .HasColumnType("integer");
-
- b.Property<int>("EmailClaimsCount")
- .HasColumnType("integer");
-
- b.Property<string>("EncryptionSettings")
- .HasColumnType("text");
-
- b.Property<string>("EncryptionType")
- .HasColumnType("text");
-
- b.Property<int>("FileSize")
- .HasColumnType("integer");
-
- b.Property<string>("ManifestBlob")
- .HasColumnType("text");
-
- b.Property<string>("ManifestCiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<string>("Salt")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("StorageFormat")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("VaultBlob")
- .HasColumnType("text");
-
- b.Property<string>("Verifier")
- .HasMaxLength(1000)
- .HasColumnType("character varying(1000)");
-
- b.Property<string>("Version")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("ManifestId", "RevisionNumber");
-
- b.ToTable("VaultManifestsHistory", (string)null);
- });
-
- modelBuilder.Entity("AliasVault.WorkerStatus.Database.WorkerServiceStatus", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("CurrentStatus")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("DesiredStatus")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<DateTime>("Heartbeat")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("ServiceName")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.ToTable("WorkerServiceStatuses");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("FriendlyName")
- .HasColumnType("text");
-
- b.Property<string>("Xml")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("DataProtectionKeys");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("ClaimType")
- .HasColumnType("text");
-
- b.Property<string>("ClaimValue")
- .HasColumnType("text");
-
- b.Property<string>("RoleId")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("RoleClaims", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("ClaimType")
- .HasColumnType("text");
-
- b.Property<string>("ClaimValue")
- .HasColumnType("text");
-
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("UserClaims", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
- {
- b.Property<string>("LoginProvider")
- .HasColumnType("text");
-
- b.Property<string>("ProviderKey")
- .HasColumnType("text");
-
- b.Property<string>("ProviderDisplayName")
- .HasColumnType("text");
-
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.HasKey("LoginProvider", "ProviderKey");
-
- b.ToTable("UserLogins", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
- {
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.Property<string>("RoleId")
- .HasColumnType("text");
-
- b.HasKey("UserId", "RoleId");
-
- b.ToTable("UserRoles", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
- {
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.Property<string>("LoginProvider")
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.Property<string>("Value")
- .HasColumnType("text");
-
- b.HasKey("UserId", "LoginProvider", "Name");
-
- b.ToTable("UserTokens", (string)null);
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>
- {
- b.HasOne("AliasServerDb.Group", "PersonalGroup")
- .WithOne()
- .HasForeignKey("AliasServerDb.AliasVaultUser", "PersonalGroupId")
- .OnDelete(DeleteBehavior.Restrict)
- .IsRequired();
-
- b.Navigation("PersonalGroup");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.Email", b =>
- {
- b.HasOne("AliasServerDb.VaultManifestDeliveryKey", "EncryptionKey")
- .WithMany("Emails")
- .HasForeignKey("EncryptionKeyId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("EncryptionKey");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailAttachment", b =>
- {
- b.HasOne("AliasServerDb.Email", "Email")
- .WithMany("Attachments")
- .HasForeignKey("EmailId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Email");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailClaim", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "VaultManifest")
- .WithMany()
- .HasForeignKey("VaultManifestId")
- .OnDelete(DeleteBehavior.SetNull);
-
- b.Navigation("VaultManifest");
- });
-
- modelBuilder.Entity("AliasServerDb.GroupMember", b =>
- {
- b.HasOne("AliasServerDb.Group", "Group")
- .WithMany("Members")
- .HasForeignKey("GroupId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Group");
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.MobileLoginRequest", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.RateLimit", b =>
- {
- b.HasOne("AliasServerDb.Group", "Group")
- .WithMany()
- .HasForeignKey("GroupId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.Navigation("Group");
- });
-
- modelBuilder.Entity("AliasServerDb.UserGrantKey", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.UserUnlockKey", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobObject", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("OwnerUserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobReference", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "Manifest")
- .WithMany()
- .HasForeignKey("ManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Manifest");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucket", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("OwnerUserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucketsHistory", b =>
- {
- b.HasOne("AliasServerDb.VaultDataBucket", "Bucket")
- .WithMany()
- .HasForeignKey("OwnerUserId", "Category")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Bucket");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifest", b =>
- {
- b.HasOne("AliasServerDb.Group", "OwnerGroup")
- .WithMany()
- .HasForeignKey("OwnerGroupId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("OwnerGroup");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestAccessKey", b =>
- {
- b.HasOne("AliasServerDb.UserGrantKey", "UserGrantKey")
- .WithMany()
- .HasForeignKey("UserGrantKeyId")
- .OnDelete(DeleteBehavior.SetNull);
-
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany("VaultManifestAccessKeys")
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
-
- b.Navigation("UserGrantKey");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestDeliveryKey", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "VaultManifest")
- .WithMany()
- .HasForeignKey("VaultManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("VaultManifest");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestsHistory", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "Manifest")
- .WithMany()
- .HasForeignKey("ManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Manifest");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>
- {
- b.Navigation("VaultManifestAccessKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.Email", b =>
- {
- b.Navigation("Attachments");
- });
-
- modelBuilder.Entity("AliasServerDb.Group", b =>
- {
- b.Navigation("Members");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestDeliveryKey", b =>
- {
- b.Navigation("Emails");
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/apps/server/Databases/AliasServerDb/Migrations/20260807200945_RenameRootManifestToPersonal.cs b/apps/server/Databases/AliasServerDb/Migrations/20260807200945_RenameRootManifestToPersonal.cs
deleted file mode 100644
index 6a4045396..000000000
--- a/apps/server/Databases/AliasServerDb/Migrations/20260807200945_RenameRootManifestToPersonal.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-using Microsoft.EntityFrameworkCore.Migrations;
-
-#nullable disable
-
-namespace AliasServerDb.Migrations
-{
- /// <inheritdoc />
- public partial class RenameRootManifestToPersonal : Migration
- {
- /// <inheritdoc />
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropIndex(
- name: "UX_VaultManifests_OwnerGroupId_Root",
- table: "VaultManifests");
-
- migrationBuilder.RenameColumn(
- name: "IsRoot",
- table: "VaultManifests",
- newName: "IsPersonal");
-
- migrationBuilder.CreateIndex(
- name: "UX_VaultManifests_OwnerGroupId_Personal",
- table: "VaultManifests",
- column: "OwnerGroupId",
- unique: true,
- filter: "\"IsPersonal\"");
- }
-
- /// <inheritdoc />
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropIndex(
- name: "UX_VaultManifests_OwnerGroupId_Personal",
- table: "VaultManifests");
-
- migrationBuilder.RenameColumn(
- name: "IsPersonal",
- table: "VaultManifests",
- newName: "IsRoot");
-
- migrationBuilder.CreateIndex(
- name: "UX_VaultManifests_OwnerGroupId_Root",
- table: "VaultManifests",
- column: "OwnerGroupId",
- unique: true,
- filter: "\"IsRoot\"");
- }
- }
-}
diff --git a/apps/server/Databases/AliasServerDb/Migrations/20260807203750_SharedManifestsOwnedBySharedGroups.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/20260807203750_SharedManifestsOwnedBySharedGroups.Designer.cs
deleted file mode 100644
index e8bd5bc1c..000000000
--- a/apps/server/Databases/AliasServerDb/Migrations/20260807203750_SharedManifestsOwnedBySharedGroups.Designer.cs
+++ /dev/null
@@ -1,1638 +0,0 @@
-// <auto-generated />
-using System;
-using AliasServerDb;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
-
-#nullable disable
-
-namespace AliasServerDb.Migrations
-{
- [DbContext(typeof(AliasServerDbContext))]
- [Migration("20260807203750_SharedManifestsOwnedBySharedGroups")]
- partial class SharedManifestsOwnedBySharedGroups
- {
- /// <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)
- .HasAnnotation("Relational:MaxIdentifierLength", 63);
-
- NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
-
- modelBuilder.Entity("AliasServerDb.AdminRole", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("AdminRoles");
- });
-
- modelBuilder.Entity("AliasServerDb.AdminUser", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<int>("AccessFailedCount")
- .HasColumnType("integer");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<string>("Email")
- .HasColumnType("text");
-
- b.Property<bool>("EmailConfirmed")
- .HasColumnType("boolean");
-
- b.Property<DateTime?>("LastPasswordChanged")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("LockoutEnabled")
- .HasColumnType("boolean");
-
- b.Property<DateTimeOffset?>("LockoutEnd")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("NormalizedEmail")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedUserName")
- .HasColumnType("text");
-
- b.Property<string>("PasswordHash")
- .HasColumnType("text");
-
- b.Property<string>("PhoneNumber")
- .HasColumnType("text");
-
- b.Property<bool>("PhoneNumberConfirmed")
- .HasColumnType("boolean");
-
- b.Property<string>("SecurityStamp")
- .HasColumnType("text");
-
- b.Property<bool>("TwoFactorEnabled")
- .HasColumnType("boolean");
-
- b.Property<string>("UserName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("AdminUsers");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultRole", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("AliasVaultRoles");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<int>("AccessFailedCount")
- .HasColumnType("integer");
-
- b.Property<bool>("Blocked")
- .HasColumnType("boolean");
-
- b.Property<DateTime?>("BlockedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Email")
- .HasColumnType("text");
-
- b.Property<bool>("EmailConfirmed")
- .HasColumnType("boolean");
-
- b.Property<DateTime?>("LastActivityDate")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("LockoutEnabled")
- .HasColumnType("boolean");
-
- b.Property<DateTimeOffset?>("LockoutEnd")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("NormalizedEmail")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedUserName")
- .HasColumnType("text");
-
- b.Property<DateTime>("PasswordChangedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("PasswordHash")
- .HasColumnType("text");
-
- b.Property<Guid>("PersonalGroupId")
- .HasColumnType("uuid");
-
- b.Property<string>("PhoneNumber")
- .HasColumnType("text");
-
- b.Property<bool>("PhoneNumberConfirmed")
- .HasColumnType("boolean");
-
- b.Property<string>("SecurityStamp")
- .HasColumnType("text");
-
- b.Property<string>("SrpIdentity")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<bool>("TwoFactorEnabled")
- .HasColumnType("boolean");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.HasIndex("PersonalGroupId")
- .IsUnique()
- .HasDatabaseName("UX_AliasVaultUsers_PersonalGroupId");
-
- b.ToTable("AliasVaultUsers");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("DeviceIdentifier")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime>("ExpireDate")
- .HasMaxLength(255)
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("IpAddress")
- .HasMaxLength(45)
- .HasColumnType("character varying(45)");
-
- b.Property<string>("PreviousTokenValue")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Value")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId");
-
- b.ToTable("AliasVaultUserRefreshTokens");
- });
-
- modelBuilder.Entity("AliasServerDb.AuthLog", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("AdditionalInfo")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Browser")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("Client")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("Country")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("DeviceType")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<int>("EventType")
- .HasColumnType("integer");
-
- b.Property<int?>("FailureReason")
- .HasColumnType("integer");
-
- b.Property<string>("IpAddress")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<bool>("IsSuccess")
- .HasColumnType("boolean");
-
- b.Property<bool>("IsSuspiciousActivity")
- .HasColumnType("boolean");
-
- b.Property<string>("OperatingSystem")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("RequestPath")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<DateTime>("Timestamp")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Username")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex(new[] { "EventType" }, "IX_EventType");
-
- b.HasIndex(new[] { "IpAddress" }, "IX_IpAddress");
-
- b.HasIndex(new[] { "Timestamp" }, "IX_Timestamp");
-
- b.HasIndex(new[] { "Username", "IsSuccess", "Timestamp" }, "IX_Username_IsSuccess_Timestamp")
- .IsDescending(false, false, true);
-
- b.HasIndex(new[] { "Username", "Timestamp" }, "IX_Username_Timestamp")
- .IsDescending(false, true);
-
- b.ToTable("AuthLogs");
- });
-
- modelBuilder.Entity("AliasServerDb.BlockedIpRange", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<bool>("BlockLogin")
- .HasColumnType("boolean");
-
- b.Property<bool>("BlockRegistration")
- .HasColumnType("boolean");
-
- b.Property<bool>("BlockShadow")
- .HasColumnType("boolean");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("CreatedBy")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<bool>("Enabled")
- .HasColumnType("boolean");
-
- b.Property<string>("IpRange")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("Reason")
- .HasMaxLength(500)
- .HasColumnType("character varying(500)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("Id");
-
- b.HasIndex(new[] { "Enabled" }, "IX_BlockedIpRange_Enabled");
-
- b.HasIndex(new[] { "IpRange" }, "IX_BlockedIpRange_IpRange")
- .IsUnique();
-
- b.ToTable("BlockedIpRanges");
- });
-
- modelBuilder.Entity("AliasServerDb.Email", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<DateTime>("Date")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime>("DateSystem")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedSymmetricKey")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<Guid>("EncryptionKeyId")
- .HasMaxLength(255)
- .HasColumnType("uuid");
-
- b.Property<string>("From")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("FromDomain")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("FromLocal")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("MessageHtml")
- .HasColumnType("text");
-
- b.Property<string>("MessagePlain")
- .HasColumnType("text");
-
- b.Property<string>("MessagePreview")
- .HasColumnType("text");
-
- b.Property<string>("MessageSource")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<bool>("PushNotificationSent")
- .HasColumnType("boolean");
-
- b.Property<string>("Subject")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("To")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("ToDomain")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("ToLocal")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<bool>("Visible")
- .HasColumnType("boolean");
-
- b.HasKey("Id");
-
- b.HasIndex("Date");
-
- b.HasIndex("DateSystem");
-
- b.HasIndex("EncryptionKeyId");
-
- b.HasIndex("PushNotificationSent");
-
- b.HasIndex("Visible");
-
- b.HasIndex("To", "DateSystem");
-
- b.ToTable("Emails");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailAttachment", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<byte[]>("Bytes")
- .IsRequired()
- .HasColumnType("bytea");
-
- b.Property<DateTime>("Date")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("EmailId")
- .HasColumnType("integer");
-
- b.Property<string>("Filename")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<int>("Filesize")
- .HasColumnType("integer");
-
- b.Property<string>("MimeType")
- .IsRequired()
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.HasIndex("EmailId");
-
- b.ToTable("EmailAttachments");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailClaim", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Address")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("AddressDomain")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("AddressLocal")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("Disabled")
- .HasColumnType("boolean");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid?>("VaultManifestId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("Address")
- .IsUnique();
-
- b.HasIndex("VaultManifestId", "CreatedAt");
-
- b.HasIndex("VaultManifestId", "Disabled");
-
- b.ToTable("EmailClaims");
- });
-
- modelBuilder.Entity("AliasServerDb.Group", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("EmailsReceived")
- .HasColumnType("integer");
-
- b.Property<int>("MaxEmailAgeDays")
- .HasColumnType("integer");
-
- b.Property<int>("MaxEmails")
- .HasColumnType("integer");
-
- b.Property<string>("Name")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<bool>("ShadowBlocked")
- .HasColumnType("boolean");
-
- b.Property<DateTime?>("ShadowBlockedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("Type")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("Id");
-
- b.ToTable("Groups");
- });
-
- modelBuilder.Entity("AliasServerDb.GroupMember", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid>("GroupId")
- .HasColumnType("uuid");
-
- b.Property<int>("Role")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId");
-
- b.HasIndex("GroupId", "UserId")
- .IsUnique();
-
- b.ToTable("GroupMembers");
- });
-
- modelBuilder.Entity("AliasServerDb.Log", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("Application")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("Exception")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Level")
- .IsRequired()
- .HasMaxLength(128)
- .HasColumnType("character varying(128)");
-
- b.Property<string>("LogEvent")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("LogEvent");
-
- b.Property<string>("Message")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("MessageTemplate")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Properties")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("SourceContext")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("TimeStamp")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("Id");
-
- b.HasIndex("Application");
-
- b.HasIndex("TimeStamp");
-
- b.ToTable("Logs", (string)null);
- });
-
- modelBuilder.Entity("AliasServerDb.MobileLoginRequest", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<DateTime?>("ClearedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("ClientIpAddress")
- .HasColumnType("text");
-
- b.Property<string>("ClientPublicKey")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedDecryptionKey")
- .HasColumnType("text");
-
- b.Property<DateTime?>("FulfilledAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("MobileIpAddress")
- .HasColumnType("text");
-
- b.Property<DateTime?>("RetrievedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.HasIndex(new[] { "ClientIpAddress" }, "IX_ClientIpAddress");
-
- b.HasIndex(new[] { "CreatedAt" }, "IX_CreatedAt");
-
- b.HasIndex(new[] { "MobileIpAddress" }, "IX_MobileIpAddress");
-
- b.HasIndex(new[] { "RetrievedAt", "ClearedAt", "FulfilledAt" }, "IX_RetrievedAt_ClearedAt_FulfilledAt");
-
- b.HasIndex(new[] { "UserId" }, "IX_UserId");
-
- b.ToTable("MobileLoginRequests");
- });
-
- modelBuilder.Entity("AliasServerDb.RateLimit", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<int?>("AppliesToAccountAgeMaxDays")
- .HasColumnType("integer");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("CreatedBy")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime?>("EffectiveFrom")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime?>("EffectiveUntil")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("Enabled")
- .HasColumnType("boolean");
-
- b.Property<Guid?>("GroupId")
- .HasColumnType("uuid");
-
- b.Property<int>("LimitType")
- .HasColumnType("integer");
-
- b.Property<int>("MaxCount")
- .HasColumnType("integer");
-
- b.Property<string>("Notes")
- .HasMaxLength(1000)
- .HasColumnType("character varying(1000)");
-
- b.Property<int?>("Tier")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("WindowSeconds")
- .HasColumnType("integer");
-
- b.HasKey("Id");
-
- b.HasIndex("GroupId");
-
- b.HasIndex("Tier");
-
- b.HasIndex("LimitType", "Enabled");
-
- b.ToTable("RateLimits");
- });
-
- modelBuilder.Entity("AliasServerDb.ServerSetting", b =>
- {
- b.Property<string>("Key")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Value")
- .HasColumnType("text");
-
- b.HasKey("Key");
-
- b.ToTable("ServerSettings");
- });
-
- modelBuilder.Entity("AliasServerDb.TaskRunnerJob", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<TimeOnly?>("EndTime")
- .HasColumnType("time without time zone");
-
- b.Property<string>("ErrorMessage")
- .HasColumnType("text");
-
- b.Property<bool>("IsOnDemand")
- .HasColumnType("boolean");
-
- b.Property<string>("Name")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<DateTime>("RunDate")
- .HasColumnType("timestamp with time zone");
-
- b.Property<TimeOnly>("StartTime")
- .HasColumnType("time without time zone");
-
- b.Property<int>("Status")
- .HasColumnType("integer");
-
- b.HasKey("Id");
-
- b.ToTable("TaskRunnerJobs");
- });
-
- modelBuilder.Entity("AliasServerDb.UserGrantKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedPrivateKey")
- .IsRequired()
- .HasMaxLength(4000)
- .HasColumnType("character varying(4000)");
-
- b.Property<bool>("IsPrimary")
- .HasColumnType("boolean");
-
- b.Property<string>("PublicKey")
- .IsRequired()
- .HasMaxLength(2000)
- .HasColumnType("character varying(2000)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId")
- .IsUnique()
- .HasDatabaseName("UX_UserGrantKeys_User_Primary")
- .HasFilter("\"IsPrimary\"");
-
- b.ToTable("UserGrantKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.UserUnlockKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Algorithm")
- .IsRequired()
- .HasMaxLength(30)
- .HasColumnType("character varying(30)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedAccountKey")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime?>("LastUsedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Metadata")
- .HasColumnType("jsonb");
-
- b.Property<int>("Type")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId", "Type")
- .IsUnique()
- .HasDatabaseName("UX_UserUnlockKeys_UserId_Type");
-
- b.ToTable("UserUnlockKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobObject", b =>
- {
- b.Property<string>("Hash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<string>("OwnerUserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Category")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<byte[]>("EncryptedData")
- .IsRequired()
- .HasColumnType("bytea");
-
- b.Property<DateTime>("LastReferencedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("SizeBytes")
- .HasColumnType("integer");
-
- b.HasKey("Hash", "OwnerUserId");
-
- b.HasIndex("OwnerUserId", "Category");
-
- b.ToTable("VaultBlobObjects");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobReference", b =>
- {
- b.Property<Guid>("ManifestId")
- .HasColumnType("uuid");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("BlobHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.HasKey("ManifestId", "RevisionNumber", "BlobHash");
-
- b.ToTable("VaultBlobReferences");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucket", b =>
- {
- b.Property<string>("OwnerUserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Category")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("CiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedData")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("OwnerUserId", "Category");
-
- b.ToTable("VaultDataBuckets");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucketsHistory", b =>
- {
- b.Property<string>("OwnerUserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Category")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("CiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedData")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("OwnerUserId", "Category", "RevisionNumber");
-
- b.ToTable("VaultDataBucketsHistory");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifest", b =>
- {
- b.Property<Guid>("ManifestId")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Client")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("CredentialsCount")
- .HasColumnType("integer");
-
- b.Property<int>("EmailClaimsCount")
- .HasColumnType("integer");
-
- b.Property<string>("EncryptionSettings")
- .HasColumnType("text");
-
- b.Property<string>("EncryptionType")
- .HasColumnType("text");
-
- b.Property<int>("FileSize")
- .HasColumnType("integer");
-
- b.Property<string>("ManifestBlob")
- .HasColumnType("text");
-
- b.Property<string>("ManifestCiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<string>("Name")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<Guid>("OwnerGroupId")
- .HasColumnType("uuid");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("Salt")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("StorageFormat")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("VaultBlob")
- .HasColumnType("text");
-
- b.Property<string>("Verifier")
- .HasMaxLength(1000)
- .HasColumnType("character varying(1000)");
-
- b.Property<string>("Version")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("ManifestId");
-
- b.HasIndex("OwnerGroupId");
-
- b.ToTable("VaultManifests");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestAccessKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Algorithm")
- .IsRequired()
- .HasMaxLength(30)
- .HasColumnType("character varying(30)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedVek")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime?>("LastUsedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Metadata")
- .HasColumnType("jsonb");
-
- b.Property<int>("Type")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid?>("UserGrantKeyId")
- .HasColumnType("uuid");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<Guid>("VaultManifestId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("UserGrantKeyId");
-
- b.HasIndex("VaultManifestId")
- .HasDatabaseName("IX_VaultManifestAccessKeys_VaultManifestId");
-
- b.HasIndex("UserId", "Type", "VaultManifestId")
- .IsUnique()
- .HasDatabaseName("UX_VaultManifestAccessKeys_UserId_Type_Manifest");
-
- b.ToTable("VaultManifestAccessKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestDeliveryKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("IsPrimary")
- .HasColumnType("boolean");
-
- b.Property<string>("PublicKey")
- .IsRequired()
- .HasMaxLength(2000)
- .HasColumnType("character varying(2000)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid>("VaultManifestId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("VaultManifestId")
- .IsUnique()
- .HasDatabaseName("UX_VaultManifestDeliveryKeys_Manifest_Primary")
- .HasFilter("\"IsPrimary\"");
-
- b.HasIndex("VaultManifestId", "IsPrimary");
-
- b.ToTable("VaultManifestDeliveryKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestsHistory", b =>
- {
- b.Property<Guid>("ManifestId")
- .HasColumnType("uuid");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("Client")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("CredentialsCount")
- .HasColumnType("integer");
-
- b.Property<int>("EmailClaimsCount")
- .HasColumnType("integer");
-
- b.Property<string>("EncryptionSettings")
- .HasColumnType("text");
-
- b.Property<string>("EncryptionType")
- .HasColumnType("text");
-
- b.Property<int>("FileSize")
- .HasColumnType("integer");
-
- b.Property<string>("ManifestBlob")
- .HasColumnType("text");
-
- b.Property<string>("ManifestCiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<string>("Salt")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("StorageFormat")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("VaultBlob")
- .HasColumnType("text");
-
- b.Property<string>("Verifier")
- .HasMaxLength(1000)
- .HasColumnType("character varying(1000)");
-
- b.Property<string>("Version")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("ManifestId", "RevisionNumber");
-
- b.ToTable("VaultManifestsHistory", (string)null);
- });
-
- modelBuilder.Entity("AliasVault.WorkerStatus.Database.WorkerServiceStatus", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("CurrentStatus")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("DesiredStatus")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<DateTime>("Heartbeat")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("ServiceName")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.ToTable("WorkerServiceStatuses");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("FriendlyName")
- .HasColumnType("text");
-
- b.Property<string>("Xml")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("DataProtectionKeys");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("ClaimType")
- .HasColumnType("text");
-
- b.Property<string>("ClaimValue")
- .HasColumnType("text");
-
- b.Property<string>("RoleId")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("RoleClaims", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("ClaimType")
- .HasColumnType("text");
-
- b.Property<string>("ClaimValue")
- .HasColumnType("text");
-
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("UserClaims", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
- {
- b.Property<string>("LoginProvider")
- .HasColumnType("text");
-
- b.Property<string>("ProviderKey")
- .HasColumnType("text");
-
- b.Property<string>("ProviderDisplayName")
- .HasColumnType("text");
-
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.HasKey("LoginProvider", "ProviderKey");
-
- b.ToTable("UserLogins", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
- {
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.Property<string>("RoleId")
- .HasColumnType("text");
-
- b.HasKey("UserId", "RoleId");
-
- b.ToTable("UserRoles", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
- {
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.Property<string>("LoginProvider")
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.Property<string>("Value")
- .HasColumnType("text");
-
- b.HasKey("UserId", "LoginProvider", "Name");
-
- b.ToTable("UserTokens", (string)null);
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>
- {
- b.HasOne("AliasServerDb.Group", "PersonalGroup")
- .WithOne()
- .HasForeignKey("AliasServerDb.AliasVaultUser", "PersonalGroupId")
- .OnDelete(DeleteBehavior.Restrict)
- .IsRequired();
-
- b.Navigation("PersonalGroup");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.Email", b =>
- {
- b.HasOne("AliasServerDb.VaultManifestDeliveryKey", "EncryptionKey")
- .WithMany("Emails")
- .HasForeignKey("EncryptionKeyId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("EncryptionKey");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailAttachment", b =>
- {
- b.HasOne("AliasServerDb.Email", "Email")
- .WithMany("Attachments")
- .HasForeignKey("EmailId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Email");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailClaim", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "VaultManifest")
- .WithMany()
- .HasForeignKey("VaultManifestId")
- .OnDelete(DeleteBehavior.SetNull);
-
- b.Navigation("VaultManifest");
- });
-
- modelBuilder.Entity("AliasServerDb.GroupMember", b =>
- {
- b.HasOne("AliasServerDb.Group", "Group")
- .WithMany("Members")
- .HasForeignKey("GroupId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Group");
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.MobileLoginRequest", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.RateLimit", b =>
- {
- b.HasOne("AliasServerDb.Group", "Group")
- .WithMany()
- .HasForeignKey("GroupId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.Navigation("Group");
- });
-
- modelBuilder.Entity("AliasServerDb.UserGrantKey", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.UserUnlockKey", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobObject", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("OwnerUserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobReference", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "Manifest")
- .WithMany()
- .HasForeignKey("ManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Manifest");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucket", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("OwnerUserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucketsHistory", b =>
- {
- b.HasOne("AliasServerDb.VaultDataBucket", "Bucket")
- .WithMany()
- .HasForeignKey("OwnerUserId", "Category")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Bucket");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifest", b =>
- {
- b.HasOne("AliasServerDb.Group", "OwnerGroup")
- .WithMany()
- .HasForeignKey("OwnerGroupId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("OwnerGroup");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestAccessKey", b =>
- {
- b.HasOne("AliasServerDb.UserGrantKey", "UserGrantKey")
- .WithMany()
- .HasForeignKey("UserGrantKeyId")
- .OnDelete(DeleteBehavior.SetNull);
-
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany("VaultManifestAccessKeys")
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
-
- b.Navigation("UserGrantKey");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestDeliveryKey", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "VaultManifest")
- .WithMany()
- .HasForeignKey("VaultManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("VaultManifest");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestsHistory", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "Manifest")
- .WithMany()
- .HasForeignKey("ManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Manifest");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>
- {
- b.Navigation("VaultManifestAccessKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.Email", b =>
- {
- b.Navigation("Attachments");
- });
-
- modelBuilder.Entity("AliasServerDb.Group", b =>
- {
- b.Navigation("Members");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestDeliveryKey", b =>
- {
- b.Navigation("Emails");
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/apps/server/Databases/AliasServerDb/Migrations/20260807203750_SharedManifestsOwnedBySharedGroups.cs b/apps/server/Databases/AliasServerDb/Migrations/20260807203750_SharedManifestsOwnedBySharedGroups.cs
deleted file mode 100644
index bd501d0cf..000000000
--- a/apps/server/Databases/AliasServerDb/Migrations/20260807203750_SharedManifestsOwnedBySharedGroups.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-using Microsoft.EntityFrameworkCore.Migrations;
-
-#nullable disable
-
-namespace AliasServerDb.Migrations
-{
- /// <inheritdoc />
- public partial class SharedManifestsOwnedBySharedGroups : Migration
- {
- /// <inheritdoc />
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropIndex(
- name: "UX_VaultManifests_OwnerGroupId_Personal",
- table: "VaultManifests");
-
- migrationBuilder.DropColumn(
- name: "IsPersonal",
- table: "VaultManifests");
-
- migrationBuilder.CreateIndex(
- name: "IX_VaultManifests_OwnerGroupId",
- table: "VaultManifests",
- column: "OwnerGroupId");
- }
-
- /// <inheritdoc />
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropIndex(
- name: "IX_VaultManifests_OwnerGroupId",
- table: "VaultManifests");
-
- migrationBuilder.AddColumn<bool>(
- name: "IsPersonal",
- table: "VaultManifests",
- type: "boolean",
- nullable: false,
- defaultValue: false);
-
- migrationBuilder.Sql("""
- UPDATE "VaultManifests" m
- SET "IsPersonal" = TRUE
- FROM "Groups" g
- WHERE g."Id" = m."OwnerGroupId" AND g."Type" = 0;
- """);
-
- migrationBuilder.CreateIndex(
- name: "UX_VaultManifests_OwnerGroupId_Personal",
- table: "VaultManifests",
- column: "OwnerGroupId",
- unique: true,
- filter: "\"IsPersonal\"");
- }
- }
-}
diff --git a/apps/server/Databases/AliasServerDb/Migrations/20260808095808_ManifestOwnedDataBuckets.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/20260808095808_ManifestOwnedDataBuckets.Designer.cs
deleted file mode 100644
index 2a1ff56f9..000000000
--- a/apps/server/Databases/AliasServerDb/Migrations/20260808095808_ManifestOwnedDataBuckets.Designer.cs
+++ /dev/null
@@ -1,1636 +0,0 @@
-// <auto-generated />
-using System;
-using AliasServerDb;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
-
-#nullable disable
-
-namespace AliasServerDb.Migrations
-{
- [DbContext(typeof(AliasServerDbContext))]
- [Migration("20260808095808_ManifestOwnedDataBuckets")]
- partial class ManifestOwnedDataBuckets
- {
- /// <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)
- .HasAnnotation("Relational:MaxIdentifierLength", 63);
-
- NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
-
- modelBuilder.Entity("AliasServerDb.AdminRole", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("AdminRoles");
- });
-
- modelBuilder.Entity("AliasServerDb.AdminUser", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<int>("AccessFailedCount")
- .HasColumnType("integer");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<string>("Email")
- .HasColumnType("text");
-
- b.Property<bool>("EmailConfirmed")
- .HasColumnType("boolean");
-
- b.Property<DateTime?>("LastPasswordChanged")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("LockoutEnabled")
- .HasColumnType("boolean");
-
- b.Property<DateTimeOffset?>("LockoutEnd")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("NormalizedEmail")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedUserName")
- .HasColumnType("text");
-
- b.Property<string>("PasswordHash")
- .HasColumnType("text");
-
- b.Property<string>("PhoneNumber")
- .HasColumnType("text");
-
- b.Property<bool>("PhoneNumberConfirmed")
- .HasColumnType("boolean");
-
- b.Property<string>("SecurityStamp")
- .HasColumnType("text");
-
- b.Property<bool>("TwoFactorEnabled")
- .HasColumnType("boolean");
-
- b.Property<string>("UserName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("AdminUsers");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultRole", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("AliasVaultRoles");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<int>("AccessFailedCount")
- .HasColumnType("integer");
-
- b.Property<bool>("Blocked")
- .HasColumnType("boolean");
-
- b.Property<DateTime?>("BlockedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("ConcurrencyStamp")
- .HasColumnType("text");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Email")
- .HasColumnType("text");
-
- b.Property<bool>("EmailConfirmed")
- .HasColumnType("boolean");
-
- b.Property<DateTime?>("LastActivityDate")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("LockoutEnabled")
- .HasColumnType("boolean");
-
- b.Property<DateTimeOffset?>("LockoutEnd")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("NormalizedEmail")
- .HasColumnType("text");
-
- b.Property<string>("NormalizedUserName")
- .HasColumnType("text");
-
- b.Property<DateTime>("PasswordChangedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("PasswordHash")
- .HasColumnType("text");
-
- b.Property<Guid>("PersonalGroupId")
- .HasColumnType("uuid");
-
- b.Property<string>("PhoneNumber")
- .HasColumnType("text");
-
- b.Property<bool>("PhoneNumberConfirmed")
- .HasColumnType("boolean");
-
- b.Property<string>("SecurityStamp")
- .HasColumnType("text");
-
- b.Property<string>("SrpIdentity")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<bool>("TwoFactorEnabled")
- .HasColumnType("boolean");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserName")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.HasIndex("PersonalGroupId")
- .IsUnique()
- .HasDatabaseName("UX_AliasVaultUsers_PersonalGroupId");
-
- b.ToTable("AliasVaultUsers");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("DeviceIdentifier")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime>("ExpireDate")
- .HasMaxLength(255)
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("IpAddress")
- .HasMaxLength(45)
- .HasColumnType("character varying(45)");
-
- b.Property<string>("PreviousTokenValue")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Value")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId");
-
- b.ToTable("AliasVaultUserRefreshTokens");
- });
-
- modelBuilder.Entity("AliasServerDb.AuthLog", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("AdditionalInfo")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Browser")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("Client")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("Country")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("DeviceType")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<int>("EventType")
- .HasColumnType("integer");
-
- b.Property<int?>("FailureReason")
- .HasColumnType("integer");
-
- b.Property<string>("IpAddress")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<bool>("IsSuccess")
- .HasColumnType("boolean");
-
- b.Property<bool>("IsSuspiciousActivity")
- .HasColumnType("boolean");
-
- b.Property<string>("OperatingSystem")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("RequestPath")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<DateTime>("Timestamp")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Username")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex(new[] { "EventType" }, "IX_EventType");
-
- b.HasIndex(new[] { "IpAddress" }, "IX_IpAddress");
-
- b.HasIndex(new[] { "Timestamp" }, "IX_Timestamp");
-
- b.HasIndex(new[] { "Username", "IsSuccess", "Timestamp" }, "IX_Username_IsSuccess_Timestamp")
- .IsDescending(false, false, true);
-
- b.HasIndex(new[] { "Username", "Timestamp" }, "IX_Username_Timestamp")
- .IsDescending(false, true);
-
- b.ToTable("AuthLogs");
- });
-
- modelBuilder.Entity("AliasServerDb.BlockedIpRange", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<bool>("BlockLogin")
- .HasColumnType("boolean");
-
- b.Property<bool>("BlockRegistration")
- .HasColumnType("boolean");
-
- b.Property<bool>("BlockShadow")
- .HasColumnType("boolean");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("CreatedBy")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<bool>("Enabled")
- .HasColumnType("boolean");
-
- b.Property<string>("IpRange")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("Reason")
- .HasMaxLength(500)
- .HasColumnType("character varying(500)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("Id");
-
- b.HasIndex(new[] { "Enabled" }, "IX_BlockedIpRange_Enabled");
-
- b.HasIndex(new[] { "IpRange" }, "IX_BlockedIpRange_IpRange")
- .IsUnique();
-
- b.ToTable("BlockedIpRanges");
- });
-
- modelBuilder.Entity("AliasServerDb.Email", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<DateTime>("Date")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime>("DateSystem")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedSymmetricKey")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<Guid>("EncryptionKeyId")
- .HasMaxLength(255)
- .HasColumnType("uuid");
-
- b.Property<string>("From")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("FromDomain")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("FromLocal")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("MessageHtml")
- .HasColumnType("text");
-
- b.Property<string>("MessagePlain")
- .HasColumnType("text");
-
- b.Property<string>("MessagePreview")
- .HasColumnType("text");
-
- b.Property<string>("MessageSource")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<bool>("PushNotificationSent")
- .HasColumnType("boolean");
-
- b.Property<string>("Subject")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("To")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("ToDomain")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("ToLocal")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<bool>("Visible")
- .HasColumnType("boolean");
-
- b.HasKey("Id");
-
- b.HasIndex("Date");
-
- b.HasIndex("DateSystem");
-
- b.HasIndex("EncryptionKeyId");
-
- b.HasIndex("PushNotificationSent");
-
- b.HasIndex("Visible");
-
- b.HasIndex("To", "DateSystem");
-
- b.ToTable("Emails");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailAttachment", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<byte[]>("Bytes")
- .IsRequired()
- .HasColumnType("bytea");
-
- b.Property<DateTime>("Date")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("EmailId")
- .HasColumnType("integer");
-
- b.Property<string>("Filename")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<int>("Filesize")
- .HasColumnType("integer");
-
- b.Property<string>("MimeType")
- .IsRequired()
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.HasIndex("EmailId");
-
- b.ToTable("EmailAttachments");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailClaim", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Address")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("AddressDomain")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("AddressLocal")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("Disabled")
- .HasColumnType("boolean");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid?>("VaultManifestId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("Address")
- .IsUnique();
-
- b.HasIndex("VaultManifestId", "CreatedAt");
-
- b.HasIndex("VaultManifestId", "Disabled");
-
- b.ToTable("EmailClaims");
- });
-
- modelBuilder.Entity("AliasServerDb.Group", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("EmailsReceived")
- .HasColumnType("integer");
-
- b.Property<int>("MaxEmailAgeDays")
- .HasColumnType("integer");
-
- b.Property<int>("MaxEmails")
- .HasColumnType("integer");
-
- b.Property<string>("Name")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<bool>("ShadowBlocked")
- .HasColumnType("boolean");
-
- b.Property<DateTime?>("ShadowBlockedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("Type")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("Id");
-
- b.ToTable("Groups");
- });
-
- modelBuilder.Entity("AliasServerDb.GroupMember", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid>("GroupId")
- .HasColumnType("uuid");
-
- b.Property<int>("Role")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId");
-
- b.HasIndex("GroupId", "UserId")
- .IsUnique();
-
- b.ToTable("GroupMembers");
- });
-
- modelBuilder.Entity("AliasServerDb.Log", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("Application")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("Exception")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Level")
- .IsRequired()
- .HasMaxLength(128)
- .HasColumnType("character varying(128)");
-
- b.Property<string>("LogEvent")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("LogEvent");
-
- b.Property<string>("Message")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("MessageTemplate")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("Properties")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<string>("SourceContext")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("TimeStamp")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("Id");
-
- b.HasIndex("Application");
-
- b.HasIndex("TimeStamp");
-
- b.ToTable("Logs", (string)null);
- });
-
- modelBuilder.Entity("AliasServerDb.MobileLoginRequest", b =>
- {
- b.Property<string>("Id")
- .HasColumnType("text");
-
- b.Property<DateTime?>("ClearedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("ClientIpAddress")
- .HasColumnType("text");
-
- b.Property<string>("ClientPublicKey")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedDecryptionKey")
- .HasColumnType("text");
-
- b.Property<DateTime?>("FulfilledAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("MobileIpAddress")
- .HasColumnType("text");
-
- b.Property<DateTime?>("RetrievedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.HasIndex(new[] { "ClientIpAddress" }, "IX_ClientIpAddress");
-
- b.HasIndex(new[] { "CreatedAt" }, "IX_CreatedAt");
-
- b.HasIndex(new[] { "MobileIpAddress" }, "IX_MobileIpAddress");
-
- b.HasIndex(new[] { "RetrievedAt", "ClearedAt", "FulfilledAt" }, "IX_RetrievedAt_ClearedAt_FulfilledAt");
-
- b.HasIndex(new[] { "UserId" }, "IX_UserId");
-
- b.ToTable("MobileLoginRequests");
- });
-
- modelBuilder.Entity("AliasServerDb.RateLimit", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<int?>("AppliesToAccountAgeMaxDays")
- .HasColumnType("integer");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("CreatedBy")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime?>("EffectiveFrom")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime?>("EffectiveUntil")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("Enabled")
- .HasColumnType("boolean");
-
- b.Property<Guid?>("GroupId")
- .HasColumnType("uuid");
-
- b.Property<int>("LimitType")
- .HasColumnType("integer");
-
- b.Property<int>("MaxCount")
- .HasColumnType("integer");
-
- b.Property<string>("Notes")
- .HasMaxLength(1000)
- .HasColumnType("character varying(1000)");
-
- b.Property<int?>("Tier")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("WindowSeconds")
- .HasColumnType("integer");
-
- b.HasKey("Id");
-
- b.HasIndex("GroupId");
-
- b.HasIndex("Tier");
-
- b.HasIndex("LimitType", "Enabled");
-
- b.ToTable("RateLimits");
- });
-
- modelBuilder.Entity("AliasServerDb.ServerSetting", b =>
- {
- b.Property<string>("Key")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Value")
- .HasColumnType("text");
-
- b.HasKey("Key");
-
- b.ToTable("ServerSettings");
- });
-
- modelBuilder.Entity("AliasServerDb.TaskRunnerJob", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<TimeOnly?>("EndTime")
- .HasColumnType("time without time zone");
-
- b.Property<string>("ErrorMessage")
- .HasColumnType("text");
-
- b.Property<bool>("IsOnDemand")
- .HasColumnType("boolean");
-
- b.Property<string>("Name")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<DateTime>("RunDate")
- .HasColumnType("timestamp with time zone");
-
- b.Property<TimeOnly>("StartTime")
- .HasColumnType("time without time zone");
-
- b.Property<int>("Status")
- .HasColumnType("integer");
-
- b.HasKey("Id");
-
- b.ToTable("TaskRunnerJobs");
- });
-
- modelBuilder.Entity("AliasServerDb.UserGrantKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedPrivateKey")
- .IsRequired()
- .HasMaxLength(4000)
- .HasColumnType("character varying(4000)");
-
- b.Property<bool>("IsPrimary")
- .HasColumnType("boolean");
-
- b.Property<string>("PublicKey")
- .IsRequired()
- .HasMaxLength(2000)
- .HasColumnType("character varying(2000)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId")
- .IsUnique()
- .HasDatabaseName("UX_UserGrantKeys_User_Primary")
- .HasFilter("\"IsPrimary\"");
-
- b.ToTable("UserGrantKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.UserUnlockKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Algorithm")
- .IsRequired()
- .HasMaxLength(30)
- .HasColumnType("character varying(30)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedAccountKey")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime?>("LastUsedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Metadata")
- .HasColumnType("jsonb");
-
- b.Property<int>("Type")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.HasIndex("UserId", "Type")
- .IsUnique()
- .HasDatabaseName("UX_UserUnlockKeys_UserId_Type");
-
- b.ToTable("UserUnlockKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobObject", b =>
- {
- b.Property<string>("Hash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<string>("OwnerUserId")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<string>("Category")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<byte[]>("EncryptedData")
- .IsRequired()
- .HasColumnType("bytea");
-
- b.Property<DateTime>("LastReferencedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("SizeBytes")
- .HasColumnType("integer");
-
- b.HasKey("Hash", "OwnerUserId");
-
- b.HasIndex("OwnerUserId", "Category");
-
- b.ToTable("VaultBlobObjects");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobReference", b =>
- {
- b.Property<Guid>("ManifestId")
- .HasColumnType("uuid");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("BlobHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.HasKey("ManifestId", "RevisionNumber", "BlobHash");
-
- b.ToTable("VaultBlobReferences");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucket", b =>
- {
- b.Property<Guid>("ManifestId")
- .HasColumnType("uuid");
-
- b.Property<string>("Category")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("CiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedData")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("ManifestId", "Category");
-
- b.ToTable("VaultDataBuckets");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucketsHistory", b =>
- {
- b.Property<Guid>("ManifestId")
- .HasColumnType("uuid");
-
- b.Property<string>("Category")
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("CiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedData")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.HasKey("ManifestId", "Category", "RevisionNumber");
-
- b.ToTable("VaultDataBucketsHistory");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifest", b =>
- {
- b.Property<Guid>("ManifestId")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Client")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("CredentialsCount")
- .HasColumnType("integer");
-
- b.Property<int>("EmailClaimsCount")
- .HasColumnType("integer");
-
- b.Property<string>("EncryptionSettings")
- .HasColumnType("text");
-
- b.Property<string>("EncryptionType")
- .HasColumnType("text");
-
- b.Property<int>("FileSize")
- .HasColumnType("integer");
-
- b.Property<string>("ManifestBlob")
- .HasColumnType("text");
-
- b.Property<string>("ManifestCiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<string>("Name")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<Guid>("OwnerGroupId")
- .HasColumnType("uuid");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("Salt")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("StorageFormat")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("VaultBlob")
- .HasColumnType("text");
-
- b.Property<string>("Verifier")
- .HasMaxLength(1000)
- .HasColumnType("character varying(1000)");
-
- b.Property<string>("Version")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("ManifestId");
-
- b.HasIndex("OwnerGroupId");
-
- b.ToTable("VaultManifests");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestAccessKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<string>("Algorithm")
- .IsRequired()
- .HasMaxLength(30)
- .HasColumnType("character varying(30)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("EncryptedVek")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property<DateTime?>("LastUsedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("Metadata")
- .HasColumnType("jsonb");
-
- b.Property<int>("Type")
- .HasColumnType("integer");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid?>("UserGrantKeyId")
- .HasColumnType("uuid");
-
- b.Property<string>("UserId")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<Guid>("VaultManifestId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("UserGrantKeyId");
-
- b.HasIndex("VaultManifestId")
- .HasDatabaseName("IX_VaultManifestAccessKeys_VaultManifestId");
-
- b.HasIndex("UserId", "Type", "VaultManifestId")
- .IsUnique()
- .HasDatabaseName("UX_VaultManifestAccessKeys_UserId_Type_Manifest");
-
- b.ToTable("VaultManifestAccessKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestDeliveryKey", b =>
- {
- b.Property<Guid>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<bool>("IsPrimary")
- .HasColumnType("boolean");
-
- b.Property<string>("PublicKey")
- .IsRequired()
- .HasMaxLength(2000)
- .HasColumnType("character varying(2000)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<Guid>("VaultManifestId")
- .HasColumnType("uuid");
-
- b.HasKey("Id");
-
- b.HasIndex("VaultManifestId")
- .IsUnique()
- .HasDatabaseName("UX_VaultManifestDeliveryKeys_Manifest_Primary")
- .HasFilter("\"IsPrimary\"");
-
- b.HasIndex("VaultManifestId", "IsPrimary");
-
- b.ToTable("VaultManifestDeliveryKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestsHistory", b =>
- {
- b.Property<Guid>("ManifestId")
- .HasColumnType("uuid");
-
- b.Property<long>("RevisionNumber")
- .HasColumnType("bigint");
-
- b.Property<string>("Client")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.Property<DateTime>("CreatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<int>("CredentialsCount")
- .HasColumnType("integer");
-
- b.Property<int>("EmailClaimsCount")
- .HasColumnType("integer");
-
- b.Property<string>("EncryptionSettings")
- .HasColumnType("text");
-
- b.Property<string>("EncryptionType")
- .HasColumnType("text");
-
- b.Property<int>("FileSize")
- .HasColumnType("integer");
-
- b.Property<string>("ManifestBlob")
- .HasColumnType("text");
-
- b.Property<string>("ManifestCiphertextHash")
- .HasMaxLength(64)
- .HasColumnType("character varying(64)");
-
- b.Property<string>("Salt")
- .HasMaxLength(100)
- .HasColumnType("character varying(100)");
-
- b.Property<string>("StorageFormat")
- .IsRequired()
- .HasMaxLength(20)
- .HasColumnType("character varying(20)");
-
- b.Property<DateTime>("UpdatedAt")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("VaultBlob")
- .HasColumnType("text");
-
- b.Property<string>("Verifier")
- .HasMaxLength(1000)
- .HasColumnType("character varying(1000)");
-
- b.Property<string>("Version")
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("ManifestId", "RevisionNumber");
-
- b.ToTable("VaultManifestsHistory", (string)null);
- });
-
- modelBuilder.Entity("AliasVault.WorkerStatus.Database.WorkerServiceStatus", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("CurrentStatus")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<string>("DesiredStatus")
- .IsRequired()
- .HasMaxLength(50)
- .HasColumnType("character varying(50)");
-
- b.Property<DateTime>("Heartbeat")
- .HasColumnType("timestamp with time zone");
-
- b.Property<string>("ServiceName")
- .IsRequired()
- .HasMaxLength(255)
- .HasColumnType("character varying(255)");
-
- b.HasKey("Id");
-
- b.ToTable("WorkerServiceStatuses");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("FriendlyName")
- .HasColumnType("text");
-
- b.Property<string>("Xml")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("DataProtectionKeys");
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("ClaimType")
- .HasColumnType("text");
-
- b.Property<string>("ClaimValue")
- .HasColumnType("text");
-
- b.Property<string>("RoleId")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("RoleClaims", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
- {
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
-
- b.Property<string>("ClaimType")
- .HasColumnType("text");
-
- b.Property<string>("ClaimValue")
- .HasColumnType("text");
-
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.HasKey("Id");
-
- b.ToTable("UserClaims", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
- {
- b.Property<string>("LoginProvider")
- .HasColumnType("text");
-
- b.Property<string>("ProviderKey")
- .HasColumnType("text");
-
- b.Property<string>("ProviderDisplayName")
- .HasColumnType("text");
-
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.HasKey("LoginProvider", "ProviderKey");
-
- b.ToTable("UserLogins", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
- {
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.Property<string>("RoleId")
- .HasColumnType("text");
-
- b.HasKey("UserId", "RoleId");
-
- b.ToTable("UserRoles", (string)null);
- });
-
- modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
- {
- b.Property<string>("UserId")
- .HasColumnType("text");
-
- b.Property<string>("LoginProvider")
- .HasColumnType("text");
-
- b.Property<string>("Name")
- .HasColumnType("text");
-
- b.Property<string>("Value")
- .HasColumnType("text");
-
- b.HasKey("UserId", "LoginProvider", "Name");
-
- b.ToTable("UserTokens", (string)null);
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>
- {
- b.HasOne("AliasServerDb.Group", "PersonalGroup")
- .WithOne()
- .HasForeignKey("AliasServerDb.AliasVaultUser", "PersonalGroupId")
- .OnDelete(DeleteBehavior.Restrict)
- .IsRequired();
-
- b.Navigation("PersonalGroup");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.Email", b =>
- {
- b.HasOne("AliasServerDb.VaultManifestDeliveryKey", "EncryptionKey")
- .WithMany("Emails")
- .HasForeignKey("EncryptionKeyId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("EncryptionKey");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailAttachment", b =>
- {
- b.HasOne("AliasServerDb.Email", "Email")
- .WithMany("Attachments")
- .HasForeignKey("EmailId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Email");
- });
-
- modelBuilder.Entity("AliasServerDb.EmailClaim", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "VaultManifest")
- .WithMany()
- .HasForeignKey("VaultManifestId")
- .OnDelete(DeleteBehavior.SetNull);
-
- b.Navigation("VaultManifest");
- });
-
- modelBuilder.Entity("AliasServerDb.GroupMember", b =>
- {
- b.HasOne("AliasServerDb.Group", "Group")
- .WithMany("Members")
- .HasForeignKey("GroupId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Group");
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.MobileLoginRequest", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.RateLimit", b =>
- {
- b.HasOne("AliasServerDb.Group", "Group")
- .WithMany()
- .HasForeignKey("GroupId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.Navigation("Group");
- });
-
- modelBuilder.Entity("AliasServerDb.UserGrantKey", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.UserUnlockKey", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobObject", b =>
- {
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany()
- .HasForeignKey("OwnerUserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultBlobReference", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "Manifest")
- .WithMany()
- .HasForeignKey("ManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Manifest");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucket", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "Manifest")
- .WithMany()
- .HasForeignKey("ManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Manifest");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultDataBucketsHistory", b =>
- {
- b.HasOne("AliasServerDb.VaultDataBucket", "Bucket")
- .WithMany()
- .HasForeignKey("ManifestId", "Category")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Bucket");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifest", b =>
- {
- b.HasOne("AliasServerDb.Group", "OwnerGroup")
- .WithMany()
- .HasForeignKey("OwnerGroupId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("OwnerGroup");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestAccessKey", b =>
- {
- b.HasOne("AliasServerDb.UserGrantKey", "UserGrantKey")
- .WithMany()
- .HasForeignKey("UserGrantKeyId")
- .OnDelete(DeleteBehavior.SetNull);
-
- b.HasOne("AliasServerDb.AliasVaultUser", "User")
- .WithMany("VaultManifestAccessKeys")
- .HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("User");
-
- b.Navigation("UserGrantKey");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestDeliveryKey", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "VaultManifest")
- .WithMany()
- .HasForeignKey("VaultManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("VaultManifest");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestsHistory", b =>
- {
- b.HasOne("AliasServerDb.VaultManifest", "Manifest")
- .WithMany()
- .HasForeignKey("ManifestId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Manifest");
- });
-
- modelBuilder.Entity("AliasServerDb.AliasVaultUser", b =>
- {
- b.Navigation("VaultManifestAccessKeys");
- });
-
- modelBuilder.Entity("AliasServerDb.Email", b =>
- {
- b.Navigation("Attachments");
- });
-
- modelBuilder.Entity("AliasServerDb.Group", b =>
- {
- b.Navigation("Members");
- });
-
- modelBuilder.Entity("AliasServerDb.VaultManifestDeliveryKey", b =>
- {
- b.Navigation("Emails");
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/apps/server/Databases/AliasServerDb/Migrations/20260808095808_ManifestOwnedDataBuckets.cs b/apps/server/Databases/AliasServerDb/Migrations/20260808095808_ManifestOwnedDataBuckets.cs
deleted file mode 100644
index 03244f38e..000000000
--- a/apps/server/Databases/AliasServerDb/Migrations/20260808095808_ManifestOwnedDataBuckets.cs
+++ /dev/null
@@ -1,190 +0,0 @@
-using System;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-#nullable disable
-
-namespace AliasServerDb.Migrations
-{
- /// <inheritdoc />
- public partial class ManifestOwnedDataBuckets : Migration
- {
- /// <inheritdoc />
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.AddColumn<Guid>(
- name: "ManifestId",
- table: "VaultDataBuckets",
- type: "uuid",
- nullable: false,
- defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
-
- migrationBuilder.AddColumn<Guid>(
- name: "ManifestId",
- table: "VaultDataBucketsHistory",
- type: "uuid",
- nullable: false,
- defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
-
- migrationBuilder.Sql(
- @"UPDATE ""VaultDataBuckets"" b
- SET ""ManifestId"" = m.""ManifestId""
- FROM ""AliasVaultUsers"" u
- JOIN ""VaultManifests"" m ON m.""OwnerGroupId"" = u.""PersonalGroupId""
- WHERE u.""Id"" = b.""OwnerUserId"";");
-
- migrationBuilder.Sql(
- @"UPDATE ""VaultDataBucketsHistory"" h
- SET ""ManifestId"" = m.""ManifestId""
- FROM ""AliasVaultUsers"" u
- JOIN ""VaultManifests"" m ON m.""OwnerGroupId"" = u.""PersonalGroupId""
- WHERE u.""Id"" = h.""OwnerUserId"";");
-
- /*
- * A bucket whose owner has no personal manifest (a user who never migrated to manifest-v1) has nothing
- * to hang off and would violate the new foreign key. Its content is settings only, and the client
- * rewrites those on its first manifest-v1 push, so dropping it costs the user nothing.
- */
- migrationBuilder.Sql(@"DELETE FROM ""VaultDataBucketsHistory"" WHERE ""ManifestId"" = '00000000-0000-0000-0000-000000000000';");
- migrationBuilder.Sql(@"DELETE FROM ""VaultDataBuckets"" WHERE ""ManifestId"" = '00000000-0000-0000-0000-000000000000';");
-
- migrationBuilder.DropForeignKey(
- name: "FK_VaultDataBuckets_AliasVaultUsers_OwnerUserId",
- table: "VaultDataBuckets");
-
- migrationBuilder.DropForeignKey(
- name: "FK_VaultDataBucketsHistory_VaultDataBuckets_OwnerUserId_Catego~",
- table: "VaultDataBucketsHistory");
-
- migrationBuilder.DropPrimaryKey(
- name: "PK_VaultDataBucketsHistory",
- table: "VaultDataBucketsHistory");
-
- migrationBuilder.DropPrimaryKey(
- name: "PK_VaultDataBuckets",
- table: "VaultDataBuckets");
-
- migrationBuilder.DropColumn(
- name: "OwnerUserId",
- table: "VaultDataBucketsHistory");
-
- migrationBuilder.DropColumn(
- name: "OwnerUserId",
- table: "VaultDataBuckets");
-
- migrationBuilder.AddPrimaryKey(
- name: "PK_VaultDataBucketsHistory",
- table: "VaultDataBucketsHistory",
- columns: new[] { "ManifestId", "Category", "RevisionNumber" });
-
- migrationBuilder.AddPrimaryKey(
- name: "PK_VaultDataBuckets",
- table: "VaultDataBuckets",
- columns: new[] { "ManifestId", "Category" });
-
- migrationBuilder.AddForeignKey(
- name: "FK_VaultDataBuckets_VaultManifests_ManifestId",
- table: "VaultDataBuckets",
- column: "ManifestId",
- principalTable: "VaultManifests",
- principalColumn: "ManifestId",
- onDelete: ReferentialAction.Cascade);
-
- migrationBuilder.AddForeignKey(
- name: "FK_VaultDataBucketsHistory_VaultDataBuckets_ManifestId_Category",
- table: "VaultDataBucketsHistory",
- columns: new[] { "ManifestId", "Category" },
- principalTable: "VaultDataBuckets",
- principalColumns: new[] { "ManifestId", "Category" },
- onDelete: ReferentialAction.Cascade);
- }
-
- /// <inheritdoc />
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropForeignKey(
- name: "FK_VaultDataBuckets_VaultManifests_ManifestId",
- table: "VaultDataBuckets");
-
- migrationBuilder.DropForeignKey(
- name: "FK_VaultDataBucketsHistory_VaultDataBuckets_ManifestId_Category",
- table: "VaultDataBucketsHistory");
-
- migrationBuilder.DropPrimaryKey(
- name: "PK_VaultDataBucketsHistory",
- table: "VaultDataBucketsHistory");
-
- migrationBuilder.DropPrimaryKey(
- name: "PK_VaultDataBuckets",
- table: "VaultDataBuckets");
-
- migrationBuilder.AddColumn<string>(
- name: "OwnerUserId",
- table: "VaultDataBuckets",
- type: "character varying(255)",
- maxLength: 255,
- nullable: false,
- defaultValue: "");
-
- migrationBuilder.AddColumn<string>(
- name: "OwnerUserId",
- table: "VaultDataBucketsHistory",
- type: "character varying(255)",
- maxLength: 255,
- nullable: false,
- defaultValue: "");
-
- // Resolve the owner back through the manifest's owning group, the inverse of the Up backfill.
- migrationBuilder.Sql(
- @"UPDATE ""VaultDataBuckets"" b
- SET ""OwnerUserId"" = u.""Id""
- FROM ""VaultManifests"" m
- JOIN ""AliasVaultUsers"" u ON u.""PersonalGroupId"" = m.""OwnerGroupId""
- WHERE m.""ManifestId"" = b.""ManifestId"";");
-
- migrationBuilder.Sql(
- @"UPDATE ""VaultDataBucketsHistory"" h
- SET ""OwnerUserId"" = u.""Id""
- FROM ""VaultManifests"" m
- JOIN ""AliasVaultUsers"" u ON u.""PersonalGroupId"" = m.""OwnerGroupId""
- WHERE m.""ManifestId"" = h.""ManifestId"";");
-
- // A bucket of a shared manifest has no single owning user to go back to.
- migrationBuilder.Sql(@"DELETE FROM ""VaultDataBucketsHistory"" WHERE ""OwnerUserId"" = '';");
- migrationBuilder.Sql(@"DELETE FROM ""VaultDataBuckets"" WHERE ""OwnerUserId"" = '';");
-
- migrationBuilder.DropColumn(
- name: "ManifestId",
- table: "VaultDataBucketsHistory");
-
- migrationBuilder.DropColumn(
- name: "ManifestId",
- table: "VaultDataBuckets");
-
- migrationBuilder.AddPrimaryKey(
- name: "PK_VaultDataBucketsHistory",
- table: "VaultDataBucketsHistory",
- columns: new[] { "OwnerUserId", "Category", "RevisionNumber" });
-
- migrationBuilder.AddPrimaryKey(
- name: "PK_VaultDataBuckets",
- table: "VaultDataBuckets",
- columns: new[] { "OwnerUserId", "Category" });
-
- migrationBuilder.AddForeignKey(
- name: "FK_VaultDataBuckets_AliasVaultUsers_OwnerUserId",
- table: "VaultDataBuckets",
- column: "OwnerUserId",
- principalTable: "AliasVaultUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
-
- migrationBuilder.AddForeignKey(
- name: "FK_VaultDataBucketsHistory_VaultDataBuckets_OwnerUserId_Catego~",
- table: "VaultDataBucketsHistory",
- columns: new[] { "OwnerUserId", "Category" },
- principalTable: "VaultDataBuckets",
- principalColumns: new[] { "OwnerUserId", "Category" },
- onDelete: ReferentialAction.Cascade);
- }
- }
-}
diff --git a/apps/server/Databases/AliasServerDb/Migrations/20260809190147_StoreKeyVocabularyAsTokens.cs b/apps/server/Databases/AliasServerDb/Migrations/20260809190147_StoreKeyVocabularyAsTokens.cs
deleted file mode 100644
index 40c857f32..000000000
--- a/apps/server/Databases/AliasServerDb/Migrations/20260809190147_StoreKeyVocabularyAsTokens.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-using Microsoft.EntityFrameworkCore.Migrations;
-
-#nullable disable
-
-namespace AliasServerDb.Migrations
-{
- /// <summary>
- /// Stores the key vocabulary Type columns as the constant string values instead of enum ints, so each key type
- /// has exactly one identifier across the database, the API and every client.
- /// </summary>
- public partial class StoreKeyVocabularyAsTokens : Migration
- {
- /// <inheritdoc />
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.Sql("""
- ALTER TABLE "VaultManifestAccessKeys"
- ALTER COLUMN "Type" TYPE character varying(30)
- USING CASE "Type" WHEN 1 THEN 'accountkey' WHEN 2 THEN 'grantkey' END;
- """);
-
- migrationBuilder.Sql("""
- ALTER TABLE "UserUnlockKeys"
- ALTER COLUMN "Type" TYPE character varying(30)
- USING CASE "Type" WHEN 0 THEN 'password' END;
- """);
- }
-
- /// <inheritdoc />
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.Sql("""
- ALTER TABLE "VaultManifestAccessKeys"
- ALTER COLUMN "Type" TYPE integer
- USING CASE "Type" WHEN 'accountkey' THEN 1 WHEN 'grantkey' THEN 2 END;
- """);
-
- migrationBuilder.Sql("""
- ALTER TABLE "UserUnlockKeys"
- ALTER COLUMN "Type" TYPE integer
- USING CASE "Type" WHEN 'password' THEN 0 END;
- """);
- }
- }
-}
diff --git a/apps/server/Databases/AliasServerDb/Migrations/20260809190147_StoreKeyVocabularyAsTokens.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/20260810093922_ManifestStorageAndGroupOwnership.Designer.cs
similarity index 99%
rename from apps/server/Databases/AliasServerDb/Migrations/20260809190147_StoreKeyVocabularyAsTokens.Designer.cs
rename to apps/server/Databases/AliasServerDb/Migrations/20260810093922_ManifestStorageAndGroupOwnership.Designer.cs
index 87b7087c5..7e110f2c1 100644
--- a/apps/server/Databases/AliasServerDb/Migrations/20260809190147_StoreKeyVocabularyAsTokens.Designer.cs
+++ b/apps/server/Databases/AliasServerDb/Migrations/20260810093922_ManifestStorageAndGroupOwnership.Designer.cs
@@ -12,8 +12,8 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace AliasServerDb.Migrations
{
[DbContext(typeof(AliasServerDbContext))]
- [Migration("20260809190147_StoreKeyVocabularyAsTokens")]
- partial class StoreKeyVocabularyAsTokens
+ [Migration("20260810093922_ManifestStorageAndGroupOwnership")]
+ partial class ManifestStorageAndGroupOwnership
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
diff --git a/apps/server/Databases/AliasServerDb/Migrations/20260810093922_ManifestStorageAndGroupOwnership.cs b/apps/server/Databases/AliasServerDb/Migrations/20260810093922_ManifestStorageAndGroupOwnership.cs
new file mode 100644
index 000000000..91e788f41
--- /dev/null
+++ b/apps/server/Databases/AliasServerDb/Migrations/20260810093922_ManifestStorageAndGroupOwnership.cs
@@ -0,0 +1,879 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace AliasServerDb.Migrations
+{
+ /// <summary>
+ /// Moves vault storage to the manifest model and makes groups the ownership path for everything a user owns.
+ ///
+ /// Existing rows are carried over in place:
+ /// - every user gains a Personal group that takes over their vault, aliases, quotas and rate limit overrides,
+ /// - the append-only "Vaults" revision log becomes one "VaultManifests" head row per user plus a
+ /// "VaultManifestsHistory" tail, keyed by a newly minted manifest id,
+ /// - per-user email encryption keys become per-manifest delivery keys.
+ ///
+ /// The tables that only the manifest-v1 write path uses (buckets, blobs, access and unlock keys) start empty.
+ /// </summary>
+ public partial class ManifestStorageAndGroupOwnership : Migration
+ {
+ /// <inheritdoc />
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ IntroduceGroups(migrationBuilder);
+ ConvertVaultsToManifests(migrationBuilder);
+ ScopeEmailClaimsToManifests(migrationBuilder);
+ ScopeDeliveryKeysToManifests(migrationBuilder);
+ ScopeRateLimitsToGroups(migrationBuilder);
+ AddManifestV1Tables(migrationBuilder);
+ }
+
+ /// <inheritdoc />
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ DropManifestV1Tables(migrationBuilder);
+ RestoreRateLimitsToUsers(migrationBuilder);
+ RestoreDeliveryKeysToUsers(migrationBuilder);
+ RestoreEmailClaimsToUsers(migrationBuilder);
+ RestoreManifestsToVaults(migrationBuilder);
+ RemoveGroups(migrationBuilder);
+ }
+
+ /// <summary>
+ /// Adds the group tables and gives every existing user a Personal group holding their email quotas.
+ /// </summary>
+ /// <param name="migrationBuilder">Migration builder.</param>
+ private static void IntroduceGroups(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateTable(
+ name: "Groups",
+ columns: table => new
+ {
+ Id = table.Column<Guid>(type: "uuid", nullable: false),
+ Name = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
+ Type = table.Column<int>(type: "integer", nullable: false),
+ ShadowBlocked = table.Column<bool>(type: "boolean", nullable: false),
+ ShadowBlockedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
+ MaxEmails = table.Column<int>(type: "integer", nullable: false),
+ MaxEmailAgeDays = table.Column<int>(type: "integer", nullable: false),
+ EmailsReceived = table.Column<int>(type: "integer", nullable: false),
+ CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
+ UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Groups", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "GroupMembers",
+ columns: table => new
+ {
+ Id = table.Column<Guid>(type: "uuid", nullable: false),
+ GroupId = table.Column<Guid>(type: "uuid", nullable: false),
+ UserId = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
+ Role = table.Column<int>(type: "integer", nullable: false),
+ CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
+ UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_GroupMembers", x => x.Id);
+ table.ForeignKey(
+ name: "FK_GroupMembers_AliasVaultUsers_UserId",
+ column: x => x.UserId,
+ principalTable: "AliasVaultUsers",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ table.ForeignKey(
+ name: "FK_GroupMembers_Groups_GroupId",
+ column: x => x.GroupId,
+ principalTable: "Groups",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateIndex(name: "IX_GroupMembers_GroupId_UserId", table: "GroupMembers", columns: new[] { "GroupId", "UserId" }, unique: true);
+ migrationBuilder.CreateIndex(name: "IX_GroupMembers_UserId", table: "GroupMembers", column: "UserId");
+
+ migrationBuilder.AddColumn<Guid>(name: "PersonalGroupId", table: "AliasVaultUsers", type: "uuid", nullable: true);
+
+ // Every user owns exactly one Personal group (type 0) and is its owner (role 0). The abuse counters and
+ // email limits are charged to the group that owns the content from here on, so they move across with it.
+ migrationBuilder.Sql("""
+ UPDATE "AliasVaultUsers" SET "PersonalGroupId" = gen_random_uuid() WHERE "PersonalGroupId" IS NULL;
+
+ INSERT INTO "Groups" ("Id", "Name", "Type", "ShadowBlocked", "ShadowBlockedAt", "MaxEmails", "MaxEmailAgeDays", "EmailsReceived", "CreatedAt", "UpdatedAt")
+ SELECT u."PersonalGroupId", COALESCE(u."UserName", 'Personal'), 0, u."ShadowBlocked", u."ShadowBlockedAt", u."MaxEmails", u."MaxEmailAgeDays", u."EmailsReceived", now(), now()
+ FROM "AliasVaultUsers" u;
+
+ INSERT INTO "GroupMembers" ("Id", "GroupId", "UserId", "Role", "CreatedAt", "UpdatedAt")
+ SELECT gen_random_uuid(), u."PersonalGroupId", u."Id", 0, now(), now()
+ FROM "AliasVaultUsers" u;
+ """);
+
+ migrationBuilder.AlterColumn<Guid>(
+ name: "PersonalGroupId",
+ table: "AliasVaultUsers",
+ type: "uuid",
+ nullable: false,
+ oldClrType: typeof(Guid),
+ oldType: "uuid",
+ oldNullable: true);
+
+ migrationBuilder.CreateIndex(name: "UX_AliasVaultUsers_PersonalGroupId", table: "AliasVaultUsers", column: "PersonalGroupId", unique: true);
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_AliasVaultUsers_Groups_PersonalGroupId",
+ table: "AliasVaultUsers",
+ column: "PersonalGroupId",
+ principalTable: "Groups",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Restrict);
+
+ migrationBuilder.DropColumn(name: "ShadowBlocked", table: "AliasVaultUsers");
+ migrationBuilder.DropColumn(name: "ShadowBlockedAt", table: "AliasVaultUsers");
+ migrationBuilder.DropColumn(name: "MaxEmails", table: "AliasVaultUsers");
+ migrationBuilder.DropColumn(name: "MaxEmailAgeDays", table: "AliasVaultUsers");
+ migrationBuilder.DropColumn(name: "EmailsReceived", table: "AliasVaultUsers");
+ }
+
+ /// <summary>
+ /// Turns the per-revision "Vaults" log into a group-owned manifest plus its revision history.
+ /// </summary>
+ /// <param name="migrationBuilder">Migration builder.</param>
+ private static void ConvertVaultsToManifests(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropForeignKey(name: "FK_Vaults_AliasVaultUsers_UserId", table: "Vaults");
+ migrationBuilder.DropIndex(name: "IX_Vaults_UserId", table: "Vaults");
+ migrationBuilder.RenameTable(name: "Vaults", newName: "VaultManifests");
+ migrationBuilder.Sql("""ALTER TABLE "VaultManifests" RENAME CONSTRAINT "PK_Vaults" TO "PK_VaultManifests";""");
+
+ migrationBuilder.AddColumn<Guid>(name: "ManifestId", table: "VaultManifests", type: "uuid", nullable: true);
+ migrationBuilder.AddColumn<Guid>(name: "OwnerGroupId", table: "VaultManifests", type: "uuid", nullable: true);
+ migrationBuilder.AddColumn<string>(name: "Name", table: "VaultManifests", type: "character varying(255)", maxLength: 255, nullable: true);
+ migrationBuilder.AddColumn<string>(name: "StorageFormat", table: "VaultManifests", type: "character varying(20)", maxLength: 20, nullable: true);
+ migrationBuilder.AddColumn<string>(name: "ManifestBlob", table: "VaultManifests", type: "text", nullable: true);
+ migrationBuilder.AddColumn<string>(name: "ManifestCiphertextHash", table: "VaultManifests", type: "character varying(64)", maxLength: 64, nullable: true);
+
+ // A manifest-v1 revision carries no vault blob and no SRP credentials, so the columns that only the legacy
+ // sqlite-blob format fills become nullable. NULL is the sole "not applicable" marker; the empty string is not.
+ MakeLegacyRevisionColumnsNullable(migrationBuilder, "VaultManifests");
+
+ // Every revision of a user's vault belongs to one manifest, owned by that user's personal group.
+ migrationBuilder.Sql("""
+ UPDATE "VaultManifests" v
+ SET "ManifestId" = ids.gid
+ FROM (SELECT "UserId", gen_random_uuid() AS gid FROM "VaultManifests" GROUP BY "UserId") ids
+ WHERE v."UserId" = ids."UserId";
+
+ UPDATE "VaultManifests" v
+ SET "OwnerGroupId" = u."PersonalGroupId", "StorageFormat" = 'sqlite-blob'
+ FROM "AliasVaultUsers" u
+ WHERE u."Id" = v."UserId";
+ """);
+
+ migrationBuilder.CreateTable(
+ name: "VaultManifestsHistory",
+ columns: table => new
+ {
+ RevisionNumber = table.Column<long>(type: "bigint", nullable: false),
+ ManifestId = table.Column<Guid>(type: "uuid", nullable: false),
+ VaultBlob = table.Column<string>(type: "text", nullable: true),
+ StorageFormat = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),
+ ManifestBlob = table.Column<string>(type: "text", nullable: true),
+ ManifestCiphertextHash = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true),
+ Version = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true),
+ FileSize = table.Column<int>(type: "integer", nullable: false),
+ Salt = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true),
+ Verifier = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: true),
+ CredentialsCount = table.Column<int>(type: "integer", nullable: false),
+ EmailClaimsCount = table.Column<int>(type: "integer", nullable: false),
+ EncryptionType = table.Column<string>(type: "text", nullable: true),
+ EncryptionSettings = table.Column<string>(type: "text", nullable: true),
+ Client = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true),
+ CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
+ UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_VaultManifestsHistory", x => new { x.ManifestId, x.RevisionNumber });
+ });
+
+ // The newest revision stays behind as the manifest head; everything older becomes history.
+ migrationBuilder.Sql("""
+ INSERT INTO "VaultManifestsHistory" ("ManifestId", "RevisionNumber", "VaultBlob", "StorageFormat", "ManifestBlob", "ManifestCiphertextHash", "Version", "FileSize", "Salt", "Verifier", "CredentialsCount", "EmailClaimsCount", "EncryptionType", "EncryptionSettings", "Client", "CreatedAt", "UpdatedAt")
+ SELECT "ManifestId", "RevisionNumber", "VaultBlob", "StorageFormat", "ManifestBlob", "ManifestCiphertextHash", "Version", "FileSize", "Salt", "Verifier", "CredentialsCount", "EmailClaimsCount", "EncryptionType", "EncryptionSettings", "Client", "CreatedAt", "UpdatedAt"
+ FROM (
+ SELECT v.*, ROW_NUMBER() OVER (PARTITION BY "ManifestId" ORDER BY "RevisionNumber" DESC, "CreatedAt" DESC, "Id" DESC) AS rn
+ FROM "VaultManifests" v
+ ) ranked
+ WHERE ranked.rn > 1
+ ON CONFLICT ("ManifestId", "RevisionNumber") DO NOTHING;
+
+ DELETE FROM "VaultManifests" v
+ USING (
+ SELECT "Id", ROW_NUMBER() OVER (PARTITION BY "ManifestId" ORDER BY "RevisionNumber" DESC, "CreatedAt" DESC, "Id" DESC) AS rn
+ FROM "VaultManifests"
+ ) ranked
+ WHERE v."Id" = ranked."Id" AND ranked.rn > 1;
+ """);
+
+ // Swap the per-revision key for the manifest key now that there is exactly one row per manifest.
+ migrationBuilder.DropPrimaryKey(name: "PK_VaultManifests", table: "VaultManifests");
+ migrationBuilder.DropColumn(name: "Id", table: "VaultManifests");
+ migrationBuilder.DropColumn(name: "UserId", table: "VaultManifests");
+
+ migrationBuilder.AlterColumn<Guid>(
+ name: "ManifestId",
+ table: "VaultManifests",
+ type: "uuid",
+ nullable: false,
+ oldClrType: typeof(Guid),
+ oldType: "uuid",
+ oldNullable: true);
+
+ migrationBuilder.AlterColumn<Guid>(
+ name: "OwnerGroupId",
+ table: "VaultManifests",
+ type: "uuid",
+ nullable: false,
+ oldClrType: typeof(Guid),
+ oldType: "uuid",
+ oldNullable: true);
+
+ migrationBuilder.AlterColumn<string>(
+ name: "StorageFormat",
+ table: "VaultManifests",
+ type: "character varying(20)",
+ maxLength: 20,
+ nullable: false,
+ oldClrType: typeof(string),
+ oldType: "character varying(20)",
+ oldMaxLength: 20,
+ oldNullable: true);
+
+ migrationBuilder.AddPrimaryKey(name: "PK_VaultManifests", table: "VaultManifests", column: "ManifestId");
+ migrationBuilder.CreateIndex(name: "IX_VaultManifests_OwnerGroupId", table: "VaultManifests", column: "OwnerGroupId");
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_VaultManifests_Groups_OwnerGroupId",
+ table: "VaultManifests",
+ column: "OwnerGroupId",
+ principalTable: "Groups",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_VaultManifestsHistory_VaultManifests_ManifestId",
+ table: "VaultManifestsHistory",
+ column: "ManifestId",
+ principalTable: "VaultManifests",
+ principalColumn: "ManifestId",
+ onDelete: ReferentialAction.Cascade);
+ }
+
+ /// <summary>
+ /// Repoints email aliases from their user to the manifest that holds the alias, which is what mail delivery
+ /// resolves the recipient's encryption key through.
+ /// </summary>
+ /// <param name="migrationBuilder">Migration builder.</param>
+ private static void ScopeEmailClaimsToManifests(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropForeignKey(name: "FK_UserEmailClaims_AliasVaultUsers_UserId", table: "UserEmailClaims");
+ migrationBuilder.DropIndex(name: "IX_UserEmailClaims_UserId_CreatedAt", table: "UserEmailClaims");
+ migrationBuilder.DropIndex(name: "IX_UserEmailClaims_UserId_Disabled", table: "UserEmailClaims");
+ migrationBuilder.RenameTable(name: "UserEmailClaims", newName: "EmailClaims");
+ migrationBuilder.Sql("""ALTER TABLE "EmailClaims" RENAME CONSTRAINT "PK_UserEmailClaims" TO "PK_EmailClaims";""");
+ migrationBuilder.RenameIndex(name: "IX_UserEmailClaims_Address", table: "EmailClaims", newName: "IX_EmailClaims_Address");
+
+ migrationBuilder.AddColumn<Guid>(name: "VaultManifestId", table: "EmailClaims", type: "uuid", nullable: true);
+
+ // A claim of a user who never uploaded a vault has no manifest to hang off and stays unassigned.
+ migrationBuilder.Sql("""
+ UPDATE "EmailClaims" c
+ SET "VaultManifestId" = m."ManifestId"
+ FROM "AliasVaultUsers" u
+ JOIN "VaultManifests" m ON m."OwnerGroupId" = u."PersonalGroupId"
+ WHERE u."Id" = c."UserId";
+ """);
+
+ migrationBuilder.DropColumn(name: "UserId", table: "EmailClaims");
+
+ migrationBuilder.CreateIndex(name: "IX_EmailClaims_VaultManifestId_CreatedAt", table: "EmailClaims", columns: new[] { "VaultManifestId", "CreatedAt" });
+ migrationBuilder.CreateIndex(name: "IX_EmailClaims_VaultManifestId_Disabled", table: "EmailClaims", columns: new[] { "VaultManifestId", "Disabled" });
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_EmailClaims_VaultManifests_VaultManifestId",
+ table: "EmailClaims",
+ column: "VaultManifestId",
+ principalTable: "VaultManifests",
+ principalColumn: "ManifestId",
+ onDelete: ReferentialAction.SetNull);
+ }
+
+ /// <summary>
+ /// Turns the per-user email encryption keys into per-manifest delivery keys.
+ /// </summary>
+ /// <param name="migrationBuilder">Migration builder.</param>
+ private static void ScopeDeliveryKeysToManifests(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropForeignKey(name: "FK_UserEncryptionKeys_AliasVaultUsers_UserId", table: "UserEncryptionKeys");
+ migrationBuilder.DropIndex(name: "IX_UserEncryptionKeys_UserId", table: "UserEncryptionKeys");
+ migrationBuilder.RenameTable(name: "UserEncryptionKeys", newName: "VaultManifestDeliveryKeys");
+ migrationBuilder.Sql("""
+ ALTER TABLE "VaultManifestDeliveryKeys" RENAME CONSTRAINT "PK_UserEncryptionKeys" TO "PK_VaultManifestDeliveryKeys";
+ ALTER TABLE "Emails" RENAME CONSTRAINT "FK_Emails_UserEncryptionKeys_UserEncryptionKeyId" TO "FK_Emails_VaultManifestDeliveryKeys_EncryptionKeyId";
+ """);
+ migrationBuilder.RenameColumn(name: "UserEncryptionKeyId", table: "Emails", newName: "EncryptionKeyId");
+ migrationBuilder.RenameIndex(name: "IX_Emails_UserEncryptionKeyId", table: "Emails", newName: "IX_Emails_EncryptionKeyId");
+
+ migrationBuilder.AddColumn<Guid>(name: "VaultManifestId", table: "VaultManifestDeliveryKeys", type: "uuid", nullable: true);
+
+ migrationBuilder.Sql("""
+ UPDATE "VaultManifestDeliveryKeys" k
+ SET "VaultManifestId" = m."ManifestId"
+ FROM "AliasVaultUsers" u
+ JOIN "VaultManifests" m ON m."OwnerGroupId" = u."PersonalGroupId"
+ WHERE u."Id" = k."UserId";
+ """);
+
+ // A key whose owner has no vault has no manifest to belong to. Its private half only ever existed inside
+ // that vault, so mail encrypted to it is already unreadable; the cascade takes those emails with it.
+ migrationBuilder.Sql("""DELETE FROM "VaultManifestDeliveryKeys" WHERE "VaultManifestId" IS NULL;""");
+
+ // The unique index below allows one primary key per manifest; keep the most recently updated one.
+ migrationBuilder.Sql("""
+ UPDATE "VaultManifestDeliveryKeys" k
+ SET "IsPrimary" = FALSE
+ WHERE k."IsPrimary"
+ AND k."Id" NOT IN (
+ SELECT DISTINCT ON ("VaultManifestId") "Id"
+ FROM "VaultManifestDeliveryKeys"
+ WHERE "IsPrimary"
+ ORDER BY "VaultManifestId", "UpdatedAt" DESC, "Id");
+ """);
+
+ migrationBuilder.DropColumn(name: "UserId", table: "VaultManifestDeliveryKeys");
+
+ migrationBuilder.AlterColumn<Guid>(
+ name: "VaultManifestId",
+ table: "VaultManifestDeliveryKeys",
+ type: "uuid",
+ nullable: false,
+ oldClrType: typeof(Guid),
+ oldType: "uuid",
+ oldNullable: true);
+
+ migrationBuilder.CreateIndex(name: "IX_VaultManifestDeliveryKeys_VaultManifestId_IsPrimary", table: "VaultManifestDeliveryKeys", columns: new[] { "VaultManifestId", "IsPrimary" });
+ migrationBuilder.CreateIndex(name: "UX_VaultManifestDeliveryKeys_Manifest_Primary", table: "VaultManifestDeliveryKeys", column: "VaultManifestId", unique: true, filter: "\"IsPrimary\"");
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_VaultManifestDeliveryKeys_VaultManifests_VaultManifestId",
+ table: "VaultManifestDeliveryKeys",
+ column: "VaultManifestId",
+ principalTable: "VaultManifests",
+ principalColumn: "ManifestId",
+ onDelete: ReferentialAction.Cascade);
+ }
+
+ /// <summary>
+ /// Charges rate limit overrides to the group that owns the content instead of to the user.
+ /// </summary>
+ /// <param name="migrationBuilder">Migration builder.</param>
+ private static void ScopeRateLimitsToGroups(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.AddColumn<Guid>(name: "GroupId", table: "RateLimits", type: "uuid", nullable: true);
+
+ migrationBuilder.Sql("""
+ UPDATE "RateLimits" r
+ SET "GroupId" = u."PersonalGroupId"
+ FROM "AliasVaultUsers" u
+ WHERE r."UserId" = u."Id";
+ """);
+
+ migrationBuilder.DropForeignKey(name: "FK_RateLimits_AliasVaultUsers_UserId", table: "RateLimits");
+ migrationBuilder.DropIndex(name: "IX_RateLimits_UserId", table: "RateLimits");
+ migrationBuilder.DropColumn(name: "UserId", table: "RateLimits");
+ migrationBuilder.CreateIndex(name: "IX_RateLimits_GroupId", table: "RateLimits", column: "GroupId");
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_RateLimits_Groups_GroupId",
+ table: "RateLimits",
+ column: "GroupId",
+ principalTable: "Groups",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ }
+
+ /// <summary>
+ /// Creates the tables that only the manifest-v1 write path uses. They start empty: a client fills them on its
+ /// first manifest-v1 push.
+ /// </summary>
+ /// <param name="migrationBuilder">Migration builder.</param>
+ private static void AddManifestV1Tables(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateTable(
+ name: "UserGrantKeys",
+ columns: table => new
+ {
+ Id = table.Column<Guid>(type: "uuid", nullable: false),
+ UserId = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
+ PublicKey = table.Column<string>(type: "character varying(2000)", maxLength: 2000, nullable: false),
+ EncryptedPrivateKey = table.Column<string>(type: "character varying(4000)", maxLength: 4000, nullable: false),
+ IsPrimary = table.Column<bool>(type: "boolean", nullable: false),
+ CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
+ UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_UserGrantKeys", x => x.Id);
+ table.ForeignKey(
+ name: "FK_UserGrantKeys_AliasVaultUsers_UserId",
+ column: x => x.UserId,
+ principalTable: "AliasVaultUsers",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "UserUnlockKeys",
+ columns: table => new
+ {
+ Id = table.Column<Guid>(type: "uuid", nullable: false),
+ UserId = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
+ Type = table.Column<string>(type: "character varying(30)", maxLength: 30, nullable: false),
+ Algorithm = table.Column<string>(type: "character varying(30)", maxLength: 30, nullable: false),
+ EncryptedAccountKey = table.Column<string>(type: "text", nullable: false),
+ Metadata = table.Column<string>(type: "jsonb", nullable: true),
+ CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
+ UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
+ LastUsedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_UserUnlockKeys", x => x.Id);
+ table.ForeignKey(
+ name: "FK_UserUnlockKeys_AliasVaultUsers_UserId",
+ column: x => x.UserId,
+ principalTable: "AliasVaultUsers",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "VaultManifestAccessKeys",
+ columns: table => new
+ {
+ Id = table.Column<Guid>(type: "uuid", nullable: false),
+ UserId = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
+ VaultManifestId = table.Column<Guid>(type: "uuid", nullable: false),
+ Type = table.Column<string>(type: "character varying(30)", maxLength: 30, nullable: false),
+ Algorithm = table.Column<string>(type: "character varying(30)", maxLength: 30, nullable: false),
+ EncryptedVek = table.Column<string>(type: "text", nullable: false),
+ UserGrantKeyId = table.Column<Guid>(type: "uuid", nullable: true),
+ Metadata = table.Column<string>(type: "jsonb", nullable: true),
+ CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
+ UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
+ LastUsedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_VaultManifestAccessKeys", x => x.Id);
+ table.ForeignKey(
+ name: "FK_VaultManifestAccessKeys_AliasVaultUsers_UserId",
+ column: x => x.UserId,
+ principalTable: "AliasVaultUsers",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ table.ForeignKey(
+ name: "FK_VaultManifestAccessKeys_UserGrantKeys_UserGrantKeyId",
+ column: x => x.UserGrantKeyId,
+ principalTable: "UserGrantKeys",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.SetNull);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "VaultBlobObjects",
+ columns: table => new
+ {
+ Hash = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
+ OwnerUserId = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
+ Category = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),
+ EncryptedData = table.Column<byte[]>(type: "bytea", nullable: false),
+ SizeBytes = table.Column<int>(type: "integer", nullable: false),
+ CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
+ LastReferencedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_VaultBlobObjects", x => new { x.Hash, x.OwnerUserId });
+ table.ForeignKey(
+ name: "FK_VaultBlobObjects_AliasVaultUsers_OwnerUserId",
+ column: x => x.OwnerUserId,
+ principalTable: "AliasVaultUsers",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "VaultBlobReferences",
+ columns: table => new
+ {
+ ManifestId = table.Column<Guid>(type: "uuid", nullable: false),
+ RevisionNumber = table.Column<long>(type: "bigint", nullable: false),
+ BlobHash = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_VaultBlobReferences", x => new { x.ManifestId, x.RevisionNumber, x.BlobHash });
+ table.ForeignKey(
+ name: "FK_VaultBlobReferences_VaultManifests_ManifestId",
+ column: x => x.ManifestId,
+ principalTable: "VaultManifests",
+ principalColumn: "ManifestId",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "VaultDataBuckets",
+ columns: table => new
+ {
+ ManifestId = table.Column<Guid>(type: "uuid", nullable: false),
+ Category = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
+ EncryptedData = table.Column<string>(type: "text", nullable: false),
+ RevisionNumber = table.Column<long>(type: "bigint", nullable: false),
+ CiphertextHash = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true),
+ CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
+ UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_VaultDataBuckets", x => new { x.ManifestId, x.Category });
+ table.ForeignKey(
+ name: "FK_VaultDataBuckets_VaultManifests_ManifestId",
+ column: x => x.ManifestId,
+ principalTable: "VaultManifests",
+ principalColumn: "ManifestId",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "VaultDataBucketsHistory",
+ columns: table => new
+ {
+ RevisionNumber = table.Column<long>(type: "bigint", nullable: false),
+ ManifestId = table.Column<Guid>(type: "uuid", nullable: false),
+ Category = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
+ EncryptedData = table.Column<string>(type: "text", nullable: false),
+ CiphertextHash = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true),
+ CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
+ UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_VaultDataBucketsHistory", x => new { x.ManifestId, x.Category, x.RevisionNumber });
+ table.ForeignKey(
+ name: "FK_VaultDataBucketsHistory_VaultDataBuckets_ManifestId_Category",
+ columns: x => new { x.ManifestId, x.Category },
+ principalTable: "VaultDataBuckets",
+ principalColumns: new[] { "ManifestId", "Category" },
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateIndex(name: "UX_UserGrantKeys_User_Primary", table: "UserGrantKeys", column: "UserId", unique: true, filter: "\"IsPrimary\"");
+ migrationBuilder.CreateIndex(name: "UX_UserUnlockKeys_UserId_Type", table: "UserUnlockKeys", columns: new[] { "UserId", "Type" }, unique: true);
+ migrationBuilder.CreateIndex(name: "IX_VaultManifestAccessKeys_UserGrantKeyId", table: "VaultManifestAccessKeys", column: "UserGrantKeyId");
+ migrationBuilder.CreateIndex(name: "IX_VaultManifestAccessKeys_VaultManifestId", table: "VaultManifestAccessKeys", column: "VaultManifestId");
+ migrationBuilder.CreateIndex(name: "UX_VaultManifestAccessKeys_UserId_Type_Manifest", table: "VaultManifestAccessKeys", columns: new[] { "UserId", "Type", "VaultManifestId" }, unique: true);
+ migrationBuilder.CreateIndex(name: "IX_VaultBlobObjects_OwnerUserId_Category", table: "VaultBlobObjects", columns: new[] { "OwnerUserId", "Category" });
+ }
+
+ /// <summary>
+ /// Drops the manifest-v1 only tables again.
+ /// </summary>
+ /// <param name="migrationBuilder">Migration builder.</param>
+ private static void DropManifestV1Tables(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(name: "VaultDataBucketsHistory");
+ migrationBuilder.DropTable(name: "VaultDataBuckets");
+ migrationBuilder.DropTable(name: "VaultBlobReferences");
+ migrationBuilder.DropTable(name: "VaultBlobObjects");
+ migrationBuilder.DropTable(name: "VaultManifestAccessKeys");
+ migrationBuilder.DropTable(name: "UserUnlockKeys");
+ migrationBuilder.DropTable(name: "UserGrantKeys");
+ }
+
+ /// <summary>
+ /// Charges rate limit overrides back to the user.
+ /// </summary>
+ /// <param name="migrationBuilder">Migration builder.</param>
+ private static void RestoreRateLimitsToUsers(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.AddColumn<string>(name: "UserId", table: "RateLimits", type: "character varying(255)", maxLength: 255, nullable: true);
+
+ // Only a personal group maps back to a user. A rule scoped to a shared group has no user equivalent.
+ migrationBuilder.Sql("""
+ UPDATE "RateLimits" r
+ SET "UserId" = u."Id"
+ FROM "AliasVaultUsers" u
+ WHERE r."GroupId" = u."PersonalGroupId";
+
+ DELETE FROM "RateLimits" WHERE "GroupId" IS NOT NULL AND "UserId" IS NULL;
+ """);
+
+ migrationBuilder.DropForeignKey(name: "FK_RateLimits_Groups_GroupId", table: "RateLimits");
+ migrationBuilder.DropIndex(name: "IX_RateLimits_GroupId", table: "RateLimits");
+ migrationBuilder.DropColumn(name: "GroupId", table: "RateLimits");
+ migrationBuilder.CreateIndex(name: "IX_RateLimits_UserId", table: "RateLimits", column: "UserId");
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_RateLimits_AliasVaultUsers_UserId",
+ table: "RateLimits",
+ column: "UserId",
+ principalTable: "AliasVaultUsers",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ }
+
+ /// <summary>
+ /// Turns the per-manifest delivery keys back into per-user email encryption keys.
+ /// </summary>
+ /// <param name="migrationBuilder">Migration builder.</param>
+ private static void RestoreDeliveryKeysToUsers(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropForeignKey(name: "FK_VaultManifestDeliveryKeys_VaultManifests_VaultManifestId", table: "VaultManifestDeliveryKeys");
+ migrationBuilder.DropIndex(name: "IX_VaultManifestDeliveryKeys_VaultManifestId_IsPrimary", table: "VaultManifestDeliveryKeys");
+ migrationBuilder.DropIndex(name: "UX_VaultManifestDeliveryKeys_Manifest_Primary", table: "VaultManifestDeliveryKeys");
+
+ migrationBuilder.AddColumn<string>(name: "UserId", table: "VaultManifestDeliveryKeys", type: "character varying(255)", maxLength: 255, nullable: true);
+
+ // A key of a shared manifest has no single owning user to go back to.
+ migrationBuilder.Sql("""
+ UPDATE "VaultManifestDeliveryKeys" k
+ SET "UserId" = u."Id"
+ FROM "VaultManifests" m
+ JOIN "AliasVaultUsers" u ON u."PersonalGroupId" = m."OwnerGroupId"
+ WHERE m."ManifestId" = k."VaultManifestId";
+
+ DELETE FROM "VaultManifestDeliveryKeys" WHERE "UserId" IS NULL;
+ """);
+
+ migrationBuilder.DropColumn(name: "VaultManifestId", table: "VaultManifestDeliveryKeys");
+
+ migrationBuilder.AlterColumn<string>(
+ name: "UserId",
+ table: "VaultManifestDeliveryKeys",
+ type: "character varying(255)",
+ maxLength: 255,
+ nullable: false,
+ defaultValue: string.Empty,
+ oldClrType: typeof(string),
+ oldType: "character varying(255)",
+ oldMaxLength: 255,
+ oldNullable: true);
+
+ migrationBuilder.RenameIndex(name: "IX_Emails_EncryptionKeyId", table: "Emails", newName: "IX_Emails_UserEncryptionKeyId");
+ migrationBuilder.RenameColumn(name: "EncryptionKeyId", table: "Emails", newName: "UserEncryptionKeyId");
+ migrationBuilder.Sql("""
+ ALTER TABLE "Emails" RENAME CONSTRAINT "FK_Emails_VaultManifestDeliveryKeys_EncryptionKeyId" TO "FK_Emails_UserEncryptionKeys_UserEncryptionKeyId";
+ ALTER TABLE "VaultManifestDeliveryKeys" RENAME CONSTRAINT "PK_VaultManifestDeliveryKeys" TO "PK_UserEncryptionKeys";
+ """);
+ migrationBuilder.RenameTable(name: "VaultManifestDeliveryKeys", newName: "UserEncryptionKeys");
+ migrationBuilder.CreateIndex(name: "IX_UserEncryptionKeys_UserId", table: "UserEncryptionKeys", column: "UserId");
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_UserEncryptionKeys_AliasVaultUsers_UserId",
+ table: "UserEncryptionKeys",
+ column: "UserId",
+ principalTable: "AliasVaultUsers",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ }
+
+ /// <summary>
+ /// Repoints email aliases from their manifest back to the owning user.
+ /// </summary>
+ /// <param name="migrationBuilder">Migration builder.</param>
+ private static void RestoreEmailClaimsToUsers(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropForeignKey(name: "FK_EmailClaims_VaultManifests_VaultManifestId", table: "EmailClaims");
+ migrationBuilder.DropIndex(name: "IX_EmailClaims_VaultManifestId_CreatedAt", table: "EmailClaims");
+ migrationBuilder.DropIndex(name: "IX_EmailClaims_VaultManifestId_Disabled", table: "EmailClaims");
+
+ migrationBuilder.AddColumn<string>(name: "UserId", table: "EmailClaims", type: "character varying(255)", maxLength: 255, nullable: true);
+
+ migrationBuilder.Sql("""
+ UPDATE "EmailClaims" c
+ SET "UserId" = u."Id"
+ FROM "VaultManifests" m
+ JOIN "AliasVaultUsers" u ON u."PersonalGroupId" = m."OwnerGroupId"
+ WHERE m."ManifestId" = c."VaultManifestId";
+ """);
+
+ migrationBuilder.DropColumn(name: "VaultManifestId", table: "EmailClaims");
+
+ migrationBuilder.RenameIndex(name: "IX_EmailClaims_Address", table: "EmailClaims", newName: "IX_UserEmailClaims_Address");
+ migrationBuilder.Sql("""ALTER TABLE "EmailClaims" RENAME CONSTRAINT "PK_EmailClaims" TO "PK_UserEmailClaims";""");
+ migrationBuilder.RenameTable(name: "EmailClaims", newName: "UserEmailClaims");
+
+ migrationBuilder.CreateIndex(name: "IX_UserEmailClaims_UserId_CreatedAt", table: "UserEmailClaims", columns: new[] { "UserId", "CreatedAt" });
+ migrationBuilder.CreateIndex(name: "IX_UserEmailClaims_UserId_Disabled", table: "UserEmailClaims", columns: new[] { "UserId", "Disabled" });
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_UserEmailClaims_AliasVaultUsers_UserId",
+ table: "UserEmailClaims",
+ column: "UserId",
+ principalTable: "AliasVaultUsers",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.SetNull);
+ }
+
+ /// <summary>
+ /// Folds the manifest head and its history back into the per-revision "Vaults" log.
+ /// </summary>
+ /// <param name="migrationBuilder">Migration builder.</param>
+ private static void RestoreManifestsToVaults(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropForeignKey(name: "FK_VaultManifestsHistory_VaultManifests_ManifestId", table: "VaultManifestsHistory");
+ migrationBuilder.DropForeignKey(name: "FK_VaultManifests_Groups_OwnerGroupId", table: "VaultManifests");
+ migrationBuilder.DropIndex(name: "IX_VaultManifests_OwnerGroupId", table: "VaultManifests");
+
+ // A shared manifest has no owning user, so there is no "Vaults" row it can become.
+ migrationBuilder.Sql("""
+ DELETE FROM "VaultManifests" m
+ WHERE NOT EXISTS (SELECT 1 FROM "AliasVaultUsers" u WHERE u."PersonalGroupId" = m."OwnerGroupId");
+ """);
+
+ migrationBuilder.AddColumn<string>(name: "UserId", table: "VaultManifests", type: "character varying(255)", maxLength: 255, nullable: true);
+ migrationBuilder.Sql("""
+ UPDATE "VaultManifests" m
+ SET "UserId" = u."Id"
+ FROM "AliasVaultUsers" u
+ WHERE u."PersonalGroupId" = m."OwnerGroupId";
+ """);
+
+ // Restore the per-revision key, then fold the history rows back in as ordinary revisions.
+ migrationBuilder.DropPrimaryKey(name: "PK_VaultManifests", table: "VaultManifests");
+ migrationBuilder.Sql("""ALTER TABLE "VaultManifests" ADD COLUMN "Id" uuid NOT NULL DEFAULT gen_random_uuid();""");
+ migrationBuilder.AddPrimaryKey(name: "PK_VaultManifests", table: "VaultManifests", column: "Id");
+
+ migrationBuilder.Sql("""
+ INSERT INTO "VaultManifests" ("Id", "ManifestId", "OwnerGroupId", "UserId", "Name", "VaultBlob", "StorageFormat", "ManifestBlob", "ManifestCiphertextHash", "Version", "RevisionNumber", "FileSize", "Salt", "Verifier", "CredentialsCount", "EmailClaimsCount", "EncryptionType", "EncryptionSettings", "Client", "CreatedAt", "UpdatedAt")
+ SELECT gen_random_uuid(), h."ManifestId", m."OwnerGroupId", m."UserId", m."Name", h."VaultBlob", h."StorageFormat", h."ManifestBlob", h."ManifestCiphertextHash", h."Version", h."RevisionNumber", h."FileSize", h."Salt", h."Verifier", h."CredentialsCount", h."EmailClaimsCount", h."EncryptionType", h."EncryptionSettings", h."Client", h."CreatedAt", h."UpdatedAt"
+ FROM "VaultManifestsHistory" h
+ INNER JOIN "VaultManifests" m ON m."ManifestId" = h."ManifestId";
+ """);
+
+ migrationBuilder.DropTable(name: "VaultManifestsHistory");
+ migrationBuilder.Sql("""ALTER TABLE "VaultManifests" ALTER COLUMN "Id" DROP DEFAULT;""");
+
+ migrationBuilder.DropColumn(name: "ManifestId", table: "VaultManifests");
+ migrationBuilder.DropColumn(name: "OwnerGroupId", table: "VaultManifests");
+ migrationBuilder.DropColumn(name: "Name", table: "VaultManifests");
+ migrationBuilder.DropColumn(name: "StorageFormat", table: "VaultManifests");
+ migrationBuilder.DropColumn(name: "ManifestBlob", table: "VaultManifests");
+ migrationBuilder.DropColumn(name: "ManifestCiphertextHash", table: "VaultManifests");
+
+ // The pre-manifest schema has no "not applicable" marker: an unset column reads as the empty string.
+ migrationBuilder.Sql("""
+ UPDATE "VaultManifests" SET
+ "VaultBlob" = COALESCE("VaultBlob", ''),
+ "Version" = COALESCE("Version", ''),
+ "Salt" = COALESCE("Salt", ''),
+ "Verifier" = COALESCE("Verifier", ''),
+ "EncryptionType" = COALESCE("EncryptionType", ''),
+ "EncryptionSettings" = COALESCE("EncryptionSettings", '');
+ """);
+
+ MakeLegacyRevisionColumnsRequired(migrationBuilder, "VaultManifests");
+
+ migrationBuilder.AlterColumn<string>(
+ name: "UserId",
+ table: "VaultManifests",
+ type: "character varying(255)",
+ maxLength: 255,
+ nullable: false,
+ defaultValue: string.Empty,
+ oldClrType: typeof(string),
+ oldType: "character varying(255)",
+ oldMaxLength: 255,
+ oldNullable: true);
+
+ migrationBuilder.Sql("""ALTER TABLE "VaultManifests" RENAME CONSTRAINT "PK_VaultManifests" TO "PK_Vaults";""");
+ migrationBuilder.RenameTable(name: "VaultManifests", newName: "Vaults");
+ migrationBuilder.CreateIndex(name: "IX_Vaults_UserId", table: "Vaults", column: "UserId");
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_Vaults_AliasVaultUsers_UserId",
+ table: "Vaults",
+ column: "UserId",
+ principalTable: "AliasVaultUsers",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ }
+
+ /// <summary>
+ /// Moves the email quotas back onto the user record and drops the group tables.
+ /// </summary>
+ /// <param name="migrationBuilder">Migration builder.</param>
+ private static void RemoveGroups(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.AddColumn<bool>(name: "ShadowBlocked", table: "AliasVaultUsers", type: "boolean", nullable: false, defaultValue: false);
+ migrationBuilder.AddColumn<DateTime>(name: "ShadowBlockedAt", table: "AliasVaultUsers", type: "timestamp with time zone", nullable: true);
+ migrationBuilder.AddColumn<int>(name: "MaxEmails", table: "AliasVaultUsers", type: "integer", nullable: false, defaultValue: 0);
+ migrationBuilder.AddColumn<int>(name: "MaxEmailAgeDays", table: "AliasVaultUsers", type: "integer", nullable: false, defaultValue: 0);
+ migrationBuilder.AddColumn<int>(name: "EmailsReceived", table: "AliasVaultUsers", type: "integer", nullable: false, defaultValue: 0);
+
+ migrationBuilder.Sql("""
+ UPDATE "AliasVaultUsers" u
+ SET "ShadowBlocked" = g."ShadowBlocked",
+ "ShadowBlockedAt" = g."ShadowBlockedAt",
+ "MaxEmails" = g."MaxEmails",
+ "MaxEmailAgeDays" = g."MaxEmailAgeDays",
+ "EmailsReceived" = g."EmailsReceived"
+ FROM "Groups" g
+ WHERE g."Id" = u."PersonalGroupId";
+ """);
+
+ migrationBuilder.DropForeignKey(name: "FK_AliasVaultUsers_Groups_PersonalGroupId", table: "AliasVaultUsers");
+ migrationBuilder.DropIndex(name: "UX_AliasVaultUsers_PersonalGroupId", table: "AliasVaultUsers");
+ migrationBuilder.DropColumn(name: "PersonalGroupId", table: "AliasVaultUsers");
+
+ migrationBuilder.DropTable(name: "GroupMembers");
+ migrationBuilder.DropTable(name: "Groups");
+ }
+
+ /// <summary>
+ /// Makes the columns that only the legacy sqlite-blob format fills nullable.
+ /// </summary>
+ /// <param name="migrationBuilder">Migration builder.</param>
+ /// <param name="table">The revision table to alter.</param>
+ private static void MakeLegacyRevisionColumnsNullable(MigrationBuilder migrationBuilder, string table)
+ {
+ migrationBuilder.AlterColumn<string>(name: "VaultBlob", table: table, type: "text", nullable: true, oldClrType: typeof(string), oldType: "text");
+ migrationBuilder.AlterColumn<string>(name: "Version", table: table, type: "character varying(255)", maxLength: 255, nullable: true, oldClrType: typeof(string), oldType: "character varying(255)", oldMaxLength: 255);
+ migrationBuilder.AlterColumn<string>(name: "Salt", table: table, type: "character varying(100)", maxLength: 100, nullable: true, oldClrType: typeof(string), oldType: "character varying(100)", oldMaxLength: 100);
+ migrationBuilder.AlterColumn<string>(name: "Verifier", table: table, type: "character varying(1000)", maxLength: 1000, nullable: true, oldClrType: typeof(string), oldType: "character varying(1000)", oldMaxLength: 1000);
+ migrationBuilder.AlterColumn<string>(name: "EncryptionType", table: table, type: "text", nullable: true, oldClrType: typeof(string), oldType: "text");
+ migrationBuilder.AlterColumn<string>(name: "EncryptionSettings", table: table, type: "text", nullable: true, oldClrType: typeof(string), oldType: "text");
+ }
+
+ /// <summary>
+ /// Makes the columns that only the legacy sqlite-blob format fills required again.
+ /// </summary>
+ /// <param name="migrationBuilder">Migration builder.</param>
+ /// <param name="table">The revision table to alter.</param>
+ private static void MakeLegacyRevisionColumnsRequired(MigrationBuilder migrationBuilder, string table)
+ {
+ migrationBuilder.AlterColumn<string>(name: "VaultBlob", table: table, type: "text", nullable: false, defaultValue: string.Empty, oldClrType: typeof(string), oldType: "text", oldNullable: true);
+ migrationBuilder.AlterColumn<string>(name: "Version", table: table, type: "character varying(255)", maxLength: 255, nullable: false, defaultValue: string.Empty, oldClrType: typeof(string), oldType: "character varying(255)", oldMaxLength: 255, oldNullable: true);
+ migrationBuilder.AlterColumn<string>(name: "Salt", table: table, type: "character varying(100)", maxLength: 100, nullable: false, defaultValue: string.Empty, oldClrType: typeof(string), oldType: "character varying(100)", oldMaxLength: 100, oldNullable: true);
+ migrationBuilder.AlterColumn<string>(name: "Verifier", table: table, type: "character varying(1000)", maxLength: 1000, nullable: false, defaultValue: string.Empty, oldClrType: typeof(string), oldType: "character varying(1000)", oldMaxLength: 1000, oldNullable: true);
+ migrationBuilder.AlterColumn<string>(name: "EncryptionType", table: table, type: "text", nullable: false, defaultValue: string.Empty, oldClrType: typeof(string), oldType: "text", oldNullable: true);
+ migrationBuilder.AlterColumn<string>(name: "EncryptionSettings", table: table, type: "text", nullable: false, defaultValue: string.Empty, oldClrType: typeof(string), oldType: "text", oldNullable: true);
+ }
+ }
+}