diff --git a/apps/server/Databases/AliasServerDb/AliasServerDb.csproj b/apps/server/Databases/AliasServerDb/AliasServerDb.csproj index b53477485..1ad0bf84b 100644 --- a/apps/server/Databases/AliasServerDb/AliasServerDb.csproj +++ b/apps/server/Databases/AliasServerDb/AliasServerDb.csproj @@ -26,8 +26,6 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - - diff --git a/apps/server/Databases/AliasServerDb/AliasServerDbContext.cs b/apps/server/Databases/AliasServerDb/AliasServerDbContext.cs index dd970eec0..097def2f0 100644 --- a/apps/server/Databases/AliasServerDb/AliasServerDbContext.cs +++ b/apps/server/Databases/AliasServerDb/AliasServerDbContext.cs @@ -11,6 +11,7 @@ using AliasVault.WorkerStatus.Database; using Microsoft.AspNetCore.DataProtection.EntityFrameworkCore; using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.Extensions.Configuration; /// @@ -136,6 +137,32 @@ public class AliasServerDbContext : WorkerStatusDbContext, IDataProtectionKeyCon /// public DbSet TaskRunnerJobs { get; set; } + /// + /// Sets up the connection string if it is not already configured. + /// + /// DbContextOptionsBuilder instance. + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) + { + AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true); + + if (optionsBuilder.IsConfigured) + { + return; + } + + var configuration = new ConfigurationBuilder() + .SetBasePath(Directory.GetCurrentDirectory()) + .AddJsonFile("appsettings.json") + .Build(); + + // Add SQLite connection with enhanced settings + var connectionString = configuration.GetConnectionString("AliasServerDbContext"); + + optionsBuilder + .UseNpgsql(connectionString, options => options.CommandTimeout(60)) + .UseLazyLoadingProxies(); + } + /// /// The OnModelCreating method. /// @@ -144,19 +171,21 @@ public class AliasServerDbContext : WorkerStatusDbContext, IDataProtectionKeyCon { base.OnModelCreating(modelBuilder); - // NOTE: This is a workaround for SQLite. Add conditional check if SQLite is used. - // NOTE: SQL server doesn't need this override. - if (Database.IsSqlite()) + // Configure all DateTime properties to use timestamp with time zone in UTC + foreach (var entityType in modelBuilder.Model.GetEntityTypes()) { - foreach (var entity in modelBuilder.Model.GetEntityTypes()) + foreach (var property in entityType.GetProperties()) { - foreach (var property in entity.GetProperties()) + if (property.ClrType == typeof(DateTime) || property.ClrType == typeof(DateTime?)) { - // SQLite does not support varchar(max) so we use TEXT. - if (property.ClrType == typeof(string) && property.GetMaxLength() == null) - { - property.SetColumnType("TEXT"); - } + property.SetColumnType("timestamp with time zone"); + + // Add value converter for DateTime properties + var converter = new ValueConverter( + v => v.ToUniversalTime(), + v => v.ToUniversalTime()); + + property.SetValueConverter(converter); } } } diff --git a/apps/server/Databases/AliasServerDb/AliasServerDbContextPostgresql.cs b/apps/server/Databases/AliasServerDb/AliasServerDbContextPostgresql.cs deleted file mode 100644 index 736569ff2..000000000 --- a/apps/server/Databases/AliasServerDb/AliasServerDbContextPostgresql.cs +++ /dev/null @@ -1,85 +0,0 @@ -//----------------------------------------------------------------------- -// -// Copyright (c) lanedirt. All rights reserved. -// Licensed under the AGPLv3 license. See LICENSE.md file in the project root for full license information. -// -//----------------------------------------------------------------------- - -namespace AliasServerDb; - -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Microsoft.Extensions.Configuration; - -/// -/// PostgreSQL implementation of the AliasServerDbContext. -/// -public class AliasServerDbContextPostgresql : AliasServerDbContext -{ - /// - /// Initializes a new instance of the class. - /// - public AliasServerDbContextPostgresql() - { - } - - /// - /// Initializes a new instance of the class. - /// - /// DbContextOptions. - public AliasServerDbContextPostgresql(DbContextOptions options) - : base(options) - { - } - - /// - /// Sets up the connection string if it is not already configured. - /// - /// DbContextOptionsBuilder instance. - protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) - { - AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true); - - if (optionsBuilder.IsConfigured) - { - return; - } - - var configuration = new ConfigurationBuilder() - .SetBasePath(Directory.GetCurrentDirectory()) - .AddJsonFile("appsettings.json") - .Build(); - - // Add SQLite connection with enhanced settings - var connectionString = configuration.GetConnectionString("AliasServerDbContext"); - - optionsBuilder - .UseNpgsql(connectionString, options => options.CommandTimeout(60)) - .UseLazyLoadingProxies(); - } - - /// - protected override void OnModelCreating(ModelBuilder modelBuilder) - { - base.OnModelCreating(modelBuilder); - - // Configure all DateTime properties to use timestamp with time zone in UTC - foreach (var entityType in modelBuilder.Model.GetEntityTypes()) - { - foreach (var property in entityType.GetProperties()) - { - if (property.ClrType == typeof(DateTime) || property.ClrType == typeof(DateTime?)) - { - property.SetColumnType("timestamp with time zone"); - - // Add value converter for DateTime properties - var converter = new ValueConverter( - v => v.ToUniversalTime(), - v => v.ToUniversalTime()); - - property.SetValueConverter(converter); - } - } - } - } -} diff --git a/apps/server/Databases/AliasServerDb/AliasServerDbContextSqlite.cs b/apps/server/Databases/AliasServerDb/AliasServerDbContextSqlite.cs deleted file mode 100644 index bc7937532..000000000 --- a/apps/server/Databases/AliasServerDb/AliasServerDbContextSqlite.cs +++ /dev/null @@ -1,107 +0,0 @@ -//----------------------------------------------------------------------- -// -// Copyright (c) lanedirt. All rights reserved. -// Licensed under the AGPLv3 license. See LICENSE.md file in the project root for full license information. -// -//----------------------------------------------------------------------- - -namespace AliasServerDb; - -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Configuration; - -/// -/// SQLite implementation of the AliasServerDbContext. -/// -public class AliasServerDbContextSqlite : AliasServerDbContext -{ - /// - /// Initializes a new instance of the class. - /// - public AliasServerDbContextSqlite() - { - SetPragmaSettings(); - } - - /// - /// Initializes a new instance of the class. - /// - /// DbContextOptions. - public AliasServerDbContextSqlite(DbContextOptions options) - : base(options) - { - SetPragmaSettings(); - } - - /// - /// The OnModelCreating method. - /// - /// ModelBuilder instance. - protected override void OnModelCreating(ModelBuilder modelBuilder) - { - base.OnModelCreating(modelBuilder); - - // Set TEXT as default column type for string properties because - // SQLite does not support varchar(max). - foreach (var entity in modelBuilder.Model.GetEntityTypes()) - { - foreach (var property in entity.GetProperties()) - { - // SQLite does not support varchar(max) so we use TEXT. - if (property.ClrType == typeof(string) && property.GetMaxLength() == null) - { - property.SetColumnType("TEXT"); - } - } - } - } - - /// - /// Sets up the connection string if it is not already configured. - /// - /// DbContextOptionsBuilder instance. - protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) - { - if (optionsBuilder.IsConfigured) - { - return; - } - - var configuration = new ConfigurationBuilder() - .SetBasePath(Directory.GetCurrentDirectory()) - .AddJsonFile("appsettings.json") - .Build(); - - // Add SQLite connection with enhanced settings - var connectionString = configuration.GetConnectionString("AliasServerDbContext") + - ";Mode=ReadWriteCreate;Cache=Shared"; - - optionsBuilder - .UseSqlite(connectionString, options => options.CommandTimeout(60)) - .UseLazyLoadingProxies(); - } - - /// - /// Sets up the PRAGMA settings for SQLite. - /// - private void SetPragmaSettings() - { - var connection = Database.GetDbConnection(); - if (connection.State != System.Data.ConnectionState.Open) - { - connection.Open(); - } - - using (var command = connection.CreateCommand()) - { - // Increase busy timeout - command.CommandText = @" - PRAGMA busy_timeout = 30000; - PRAGMA journal_mode = WAL; - PRAGMA synchronous = NORMAL; - PRAGMA temp_store = MEMORY; - PRAGMA mmap_size = 1073741824;"; - command.ExecuteNonQuery(); - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Configuration/DatabaseConfiguration.cs b/apps/server/Databases/AliasServerDb/Configuration/DatabaseConfiguration.cs index 728ab4ed6..609aaaca5 100644 --- a/apps/server/Databases/AliasServerDb/Configuration/DatabaseConfiguration.cs +++ b/apps/server/Databases/AliasServerDb/Configuration/DatabaseConfiguration.cs @@ -47,15 +47,9 @@ public static class DatabaseConfiguration } // Add custom DbContextFactory registration which supports multiple database providers - switch (dbProvider) - { - case "postgresql": - services.AddSingleton(); - break; - default: - services.AddSingleton(); - break; - } + // NOTE: previously we looked at the "dbProvider" flag for which factory to initiate, + // but as we dropped support for SQLite we now just have this one database provider. + services.AddSingleton(); // Updated DbContextFactory registration services.AddDbContextFactory((sp, options) => diff --git a/apps/server/Databases/AliasServerDb/IAliasServerDbContextFactory.cs b/apps/server/Databases/AliasServerDb/IAliasServerDbContextFactory.cs index eb1522097..1b001b4b9 100644 --- a/apps/server/Databases/AliasServerDb/IAliasServerDbContextFactory.cs +++ b/apps/server/Databases/AliasServerDb/IAliasServerDbContextFactory.cs @@ -10,7 +10,11 @@ namespace AliasServerDb; using Microsoft.EntityFrameworkCore; /// -/// The AliasServerDbContextFactory interface. +/// The AliasServerDbContextFactory interface. This factory was primarily created to support the migration window +/// from SQLite to PostgreSQL (where both were supported). Currently only PostgreSQL is supported, so this factory +/// simply creates an instance of the now default AliasServerDbContext. This factory pattern has therefore became +/// optional and does not actually has any benefits vs. just creating the DbContext directly. But we kept it for +/// now as all clients already use this factory pattern. /// public interface IAliasServerDbContextFactory { diff --git a/apps/server/Databases/AliasServerDb/Migrations/PostgresqlMigrations/20241225220047_InitialMigration.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/20241225220047_InitialMigration.Designer.cs similarity index 99% rename from apps/server/Databases/AliasServerDb/Migrations/PostgresqlMigrations/20241225220047_InitialMigration.Designer.cs rename to apps/server/Databases/AliasServerDb/Migrations/20241225220047_InitialMigration.Designer.cs index d53285c3f..8654d65b9 100644 --- a/apps/server/Databases/AliasServerDb/Migrations/PostgresqlMigrations/20241225220047_InitialMigration.Designer.cs +++ b/apps/server/Databases/AliasServerDb/Migrations/20241225220047_InitialMigration.Designer.cs @@ -9,9 +9,9 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable -namespace AliasServerDb.Migrations.PostgresqlMigrations +namespace AliasServerDb.Migrations { - [DbContext(typeof(AliasServerDbContextPostgresql))] + [DbContext(typeof(AliasServerDbContext))] [Migration("20241225220047_InitialMigration")] partial class InitialMigration { diff --git a/apps/server/Databases/AliasServerDb/Migrations/PostgresqlMigrations/20241225220047_InitialMigration.cs b/apps/server/Databases/AliasServerDb/Migrations/20241225220047_InitialMigration.cs similarity index 99% rename from apps/server/Databases/AliasServerDb/Migrations/PostgresqlMigrations/20241225220047_InitialMigration.cs rename to apps/server/Databases/AliasServerDb/Migrations/20241225220047_InitialMigration.cs index f796a0194..2bfc895b1 100644 --- a/apps/server/Databases/AliasServerDb/Migrations/PostgresqlMigrations/20241225220047_InitialMigration.cs +++ b/apps/server/Databases/AliasServerDb/Migrations/20241225220047_InitialMigration.cs @@ -5,7 +5,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable -namespace AliasServerDb.Migrations.PostgresqlMigrations +namespace AliasServerDb.Migrations { /// public partial class InitialMigration : Migration diff --git a/apps/server/Databases/AliasServerDb/Migrations/PostgresqlMigrations/20250210101233_AddAuthLogClientHeader.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/20250210101233_AddAuthLogClientHeader.Designer.cs similarity index 99% rename from apps/server/Databases/AliasServerDb/Migrations/PostgresqlMigrations/20250210101233_AddAuthLogClientHeader.Designer.cs rename to apps/server/Databases/AliasServerDb/Migrations/20250210101233_AddAuthLogClientHeader.Designer.cs index 51419bf46..753cdb1dd 100644 --- a/apps/server/Databases/AliasServerDb/Migrations/PostgresqlMigrations/20250210101233_AddAuthLogClientHeader.Designer.cs +++ b/apps/server/Databases/AliasServerDb/Migrations/20250210101233_AddAuthLogClientHeader.Designer.cs @@ -9,9 +9,9 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable -namespace AliasServerDb.Migrations.PostgresqlMigrations +namespace AliasServerDb.Migrations { - [DbContext(typeof(AliasServerDbContextPostgresql))] + [DbContext(typeof(AliasServerDbContext))] [Migration("20250210101233_AddAuthLogClientHeader")] partial class AddAuthLogClientHeader { diff --git a/apps/server/Databases/AliasServerDb/Migrations/PostgresqlMigrations/20250210101233_AddAuthLogClientHeader.cs b/apps/server/Databases/AliasServerDb/Migrations/20250210101233_AddAuthLogClientHeader.cs similarity index 93% rename from apps/server/Databases/AliasServerDb/Migrations/PostgresqlMigrations/20250210101233_AddAuthLogClientHeader.cs rename to apps/server/Databases/AliasServerDb/Migrations/20250210101233_AddAuthLogClientHeader.cs index 755956e9c..fb7cacb06 100644 --- a/apps/server/Databases/AliasServerDb/Migrations/PostgresqlMigrations/20250210101233_AddAuthLogClientHeader.cs +++ b/apps/server/Databases/AliasServerDb/Migrations/20250210101233_AddAuthLogClientHeader.cs @@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore.Migrations; #nullable disable -namespace AliasServerDb.Migrations.PostgresqlMigrations +namespace AliasServerDb.Migrations { /// public partial class AddAuthLogClientHeader : Migration diff --git a/apps/server/Databases/AliasServerDb/Migrations/PostgresqlMigrations/20250210122648_AddVaultClientColumn.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/20250210122648_AddVaultClientColumn.Designer.cs similarity index 99% rename from apps/server/Databases/AliasServerDb/Migrations/PostgresqlMigrations/20250210122648_AddVaultClientColumn.Designer.cs rename to apps/server/Databases/AliasServerDb/Migrations/20250210122648_AddVaultClientColumn.Designer.cs index 479b442da..e14ede642 100644 --- a/apps/server/Databases/AliasServerDb/Migrations/PostgresqlMigrations/20250210122648_AddVaultClientColumn.Designer.cs +++ b/apps/server/Databases/AliasServerDb/Migrations/20250210122648_AddVaultClientColumn.Designer.cs @@ -9,9 +9,9 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable -namespace AliasServerDb.Migrations.PostgresqlMigrations +namespace AliasServerDb.Migrations { - [DbContext(typeof(AliasServerDbContextPostgresql))] + [DbContext(typeof(AliasServerDbContext))] [Migration("20250210122648_AddVaultClientColumn")] partial class AddVaultClientColumn { diff --git a/apps/server/Databases/AliasServerDb/Migrations/PostgresqlMigrations/20250210122648_AddVaultClientColumn.cs b/apps/server/Databases/AliasServerDb/Migrations/20250210122648_AddVaultClientColumn.cs similarity index 93% rename from apps/server/Databases/AliasServerDb/Migrations/PostgresqlMigrations/20250210122648_AddVaultClientColumn.cs rename to apps/server/Databases/AliasServerDb/Migrations/20250210122648_AddVaultClientColumn.cs index 5f4b8d696..7b2d0c325 100644 --- a/apps/server/Databases/AliasServerDb/Migrations/PostgresqlMigrations/20250210122648_AddVaultClientColumn.cs +++ b/apps/server/Databases/AliasServerDb/Migrations/20250210122648_AddVaultClientColumn.cs @@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore.Migrations; #nullable disable -namespace AliasServerDb.Migrations.PostgresqlMigrations +namespace AliasServerDb.Migrations { /// public partial class AddVaultClientColumn : Migration diff --git a/apps/server/Databases/AliasServerDb/Migrations/PostgresqlMigrations/20250320101427_AddEmailClaimDisabledFlag.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/20250320101427_AddEmailClaimDisabledFlag.Designer.cs similarity index 99% rename from apps/server/Databases/AliasServerDb/Migrations/PostgresqlMigrations/20250320101427_AddEmailClaimDisabledFlag.Designer.cs rename to apps/server/Databases/AliasServerDb/Migrations/20250320101427_AddEmailClaimDisabledFlag.Designer.cs index 029eaa0b9..7e3e9c082 100644 --- a/apps/server/Databases/AliasServerDb/Migrations/PostgresqlMigrations/20250320101427_AddEmailClaimDisabledFlag.Designer.cs +++ b/apps/server/Databases/AliasServerDb/Migrations/20250320101427_AddEmailClaimDisabledFlag.Designer.cs @@ -9,9 +9,9 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable -namespace AliasServerDb.Migrations.PostgresqlMigrations +namespace AliasServerDb.Migrations { - [DbContext(typeof(AliasServerDbContextPostgresql))] + [DbContext(typeof(AliasServerDbContext))] [Migration("20250320101427_AddEmailClaimDisabledFlag")] partial class AddEmailClaimDisabledFlag { diff --git a/apps/server/Databases/AliasServerDb/Migrations/PostgresqlMigrations/20250320101427_AddEmailClaimDisabledFlag.cs b/apps/server/Databases/AliasServerDb/Migrations/20250320101427_AddEmailClaimDisabledFlag.cs similarity index 93% rename from apps/server/Databases/AliasServerDb/Migrations/PostgresqlMigrations/20250320101427_AddEmailClaimDisabledFlag.cs rename to apps/server/Databases/AliasServerDb/Migrations/20250320101427_AddEmailClaimDisabledFlag.cs index 65517ce8c..6c556c962 100644 --- a/apps/server/Databases/AliasServerDb/Migrations/PostgresqlMigrations/20250320101427_AddEmailClaimDisabledFlag.cs +++ b/apps/server/Databases/AliasServerDb/Migrations/20250320101427_AddEmailClaimDisabledFlag.cs @@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore.Migrations; #nullable disable -namespace AliasServerDb.Migrations.PostgresqlMigrations +namespace AliasServerDb.Migrations { /// public partial class AddEmailClaimDisabledFlag : Migration diff --git a/apps/server/Databases/AliasServerDb/Migrations/PostgresqlMigrations/AliasServerDbContextPostgresqlModelSnapshot.cs b/apps/server/Databases/AliasServerDb/Migrations/AliasServerDbContextPostgresqlModelSnapshot.cs similarity index 99% rename from apps/server/Databases/AliasServerDb/Migrations/PostgresqlMigrations/AliasServerDbContextPostgresqlModelSnapshot.cs rename to apps/server/Databases/AliasServerDb/Migrations/AliasServerDbContextPostgresqlModelSnapshot.cs index 5885af7bc..75f1e071f 100644 --- a/apps/server/Databases/AliasServerDb/Migrations/PostgresqlMigrations/AliasServerDbContextPostgresqlModelSnapshot.cs +++ b/apps/server/Databases/AliasServerDb/Migrations/AliasServerDbContextPostgresqlModelSnapshot.cs @@ -8,10 +8,10 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable -namespace AliasServerDb.Migrations.PostgresqlMigrations +namespace AliasServerDb.Migrations { - [DbContext(typeof(AliasServerDbContextPostgresql))] - partial class AliasServerDbContextPostgresqlModelSnapshot : ModelSnapshot + [DbContext(typeof(AliasServerDbContext))] + partial class AliasServerDbContextModelSnapshot : ModelSnapshot { protected override void BuildModel(ModelBuilder modelBuilder) { diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240526135300_InitialMigration.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240526135300_InitialMigration.Designer.cs deleted file mode 100644 index aab7ff0b6..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240526135300_InitialMigration.Designer.cs +++ /dev/null @@ -1,272 +0,0 @@ -// -using System; -using AliasServerDb; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - [DbContext(typeof(AliasServerDbContextSqlite))] - [Migration("20240526135300_InitialMigration")] - partial class InitialMigration - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.5") - .HasAnnotation("Proxies:ChangeTracking", false) - .HasAnnotation("Proxies:CheckEquality", false) - .HasAnnotation("Proxies:LazyLoading", true); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240526135300_InitialMigration.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240526135300_InitialMigration.cs deleted file mode 100644 index 5bf7dbdcc..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240526135300_InitialMigration.cs +++ /dev/null @@ -1,223 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - /// - public partial class InitialMigration : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "AspNetRoles", - columns: table => new - { - Id = table.Column(type: "TEXT", nullable: false), - Name = table.Column(type: "TEXT", maxLength: 256, nullable: true), - NormalizedName = table.Column(type: "TEXT", maxLength: 256, nullable: true), - ConcurrencyStamp = table.Column(type: "TEXT", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetRoles", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AspNetUsers", - columns: table => new - { - Id = table.Column(type: "TEXT", nullable: false), - UserName = table.Column(type: "TEXT", maxLength: 256, nullable: true), - NormalizedUserName = table.Column(type: "TEXT", maxLength: 256, nullable: true), - Email = table.Column(type: "TEXT", maxLength: 256, nullable: true), - NormalizedEmail = table.Column(type: "TEXT", maxLength: 256, nullable: true), - EmailConfirmed = table.Column(type: "INTEGER", nullable: false), - PasswordHash = table.Column(type: "TEXT", nullable: true), - SecurityStamp = table.Column(type: "TEXT", nullable: true), - ConcurrencyStamp = table.Column(type: "TEXT", nullable: true), - PhoneNumber = table.Column(type: "TEXT", nullable: true), - PhoneNumberConfirmed = table.Column(type: "INTEGER", nullable: false), - TwoFactorEnabled = table.Column(type: "INTEGER", nullable: false), - LockoutEnd = table.Column(type: "TEXT", nullable: true), - LockoutEnabled = table.Column(type: "INTEGER", nullable: false), - AccessFailedCount = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUsers", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AspNetRoleClaims", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - RoleId = table.Column(type: "TEXT", nullable: false), - ClaimType = table.Column(type: "TEXT", nullable: true), - ClaimValue = table.Column(type: "TEXT", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id); - table.ForeignKey( - name: "FK_AspNetRoleClaims_AspNetRoles_RoleId", - column: x => x.RoleId, - principalTable: "AspNetRoles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AspNetUserClaims", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - UserId = table.Column(type: "TEXT", nullable: false), - ClaimType = table.Column(type: "TEXT", nullable: true), - ClaimValue = table.Column(type: "TEXT", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUserClaims", x => x.Id); - table.ForeignKey( - name: "FK_AspNetUserClaims_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AspNetUserLogins", - columns: table => new - { - LoginProvider = table.Column(type: "TEXT", nullable: false), - ProviderKey = table.Column(type: "TEXT", nullable: false), - ProviderDisplayName = table.Column(type: "TEXT", nullable: true), - UserId = table.Column(type: "TEXT", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey }); - table.ForeignKey( - name: "FK_AspNetUserLogins_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AspNetUserRoles", - columns: table => new - { - UserId = table.Column(type: "TEXT", nullable: false), - RoleId = table.Column(type: "TEXT", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId }); - table.ForeignKey( - name: "FK_AspNetUserRoles_AspNetRoles_RoleId", - column: x => x.RoleId, - principalTable: "AspNetRoles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_AspNetUserRoles_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AspNetUserTokens", - columns: table => new - { - UserId = table.Column(type: "TEXT", nullable: false), - LoginProvider = table.Column(type: "TEXT", nullable: false), - Name = table.Column(type: "TEXT", nullable: false), - Value = table.Column(type: "TEXT", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name }); - table.ForeignKey( - name: "FK_AspNetUserTokens_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_AspNetRoleClaims_RoleId", - table: "AspNetRoleClaims", - column: "RoleId"); - - migrationBuilder.CreateIndex( - name: "RoleNameIndex", - table: "AspNetRoles", - column: "NormalizedName", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_AspNetUserClaims_UserId", - table: "AspNetUserClaims", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_AspNetUserLogins_UserId", - table: "AspNetUserLogins", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_AspNetUserRoles_RoleId", - table: "AspNetUserRoles", - column: "RoleId"); - - migrationBuilder.CreateIndex( - name: "EmailIndex", - table: "AspNetUsers", - column: "NormalizedEmail"); - - migrationBuilder.CreateIndex( - name: "UserNameIndex", - table: "AspNetUsers", - column: "NormalizedUserName", - unique: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "AspNetRoleClaims"); - - migrationBuilder.DropTable( - name: "AspNetUserClaims"); - - migrationBuilder.DropTable( - name: "AspNetUserLogins"); - - migrationBuilder.DropTable( - name: "AspNetUserRoles"); - - migrationBuilder.DropTable( - name: "AspNetUserTokens"); - - migrationBuilder.DropTable( - name: "AspNetRoles"); - - migrationBuilder.DropTable( - name: "AspNetUsers"); - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240527082514_BasicEntities.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240527082514_BasicEntities.Designer.cs deleted file mode 100644 index 860dc61b7..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240527082514_BasicEntities.Designer.cs +++ /dev/null @@ -1,467 +0,0 @@ -// -using System; -using AliasServerDb; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - [DbContext(typeof(AliasServerDbContextSqlite))] - [Migration("20240527082514_BasicEntities")] - partial class BasicEntities - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.5") - .HasAnnotation("Proxies:ChangeTracking", false) - .HasAnnotation("Proxies:CheckEquality", false) - .HasAnnotation("Proxies:LazyLoading", true); - - modelBuilder.Entity("AliasServerDb.Identity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("AddressCity") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("AddressCountry") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("AddressState") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("AddressStreet") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("AddressZipCode") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("BankAccountIBAN") - .HasColumnType("TEXT"); - - b.Property("BirthDate") - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("DefaultPasswordId") - .HasColumnType("TEXT"); - - b.Property("EmailPrefix") - .HasColumnType("TEXT"); - - b.Property("FirstName") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("Gender") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("Hobbies") - .HasColumnType("TEXT"); - - b.Property("LastName") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("NickName") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("PhoneMobile") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DefaultPasswordId"); - - b.ToTable("Identities"); - }); - - modelBuilder.Entity("AliasServerDb.Login", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("IdentityId") - .HasColumnType("TEXT"); - - b.Property("ServiceId") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("IdentityId"); - - b.HasIndex("ServiceId"); - - b.ToTable("Logins"); - }); - - modelBuilder.Entity("AliasServerDb.Password", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("LoginId") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("LoginId"); - - b.ToTable("Passwords"); - }); - - modelBuilder.Entity("AliasServerDb.Service", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("Services"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("AliasServerDb.Identity", b => - { - b.HasOne("AliasServerDb.Password", "DefaultPassword") - .WithMany() - .HasForeignKey("DefaultPasswordId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("DefaultPassword"); - }); - - modelBuilder.Entity("AliasServerDb.Login", b => - { - b.HasOne("AliasServerDb.Identity", "Identity") - .WithMany() - .HasForeignKey("IdentityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("AliasServerDb.Service", "Service") - .WithMany() - .HasForeignKey("ServiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Identity"); - - b.Navigation("Service"); - }); - - modelBuilder.Entity("AliasServerDb.Password", b => - { - b.HasOne("AliasServerDb.Login", "Login") - .WithMany("Passwords") - .HasForeignKey("LoginId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Login"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AliasServerDb.Login", b => - { - b.Navigation("Passwords"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240527082514_BasicEntities.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240527082514_BasicEntities.cs deleted file mode 100644 index 783fe83a5..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240527082514_BasicEntities.cs +++ /dev/null @@ -1,155 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - /// - public partial class BasicEntities : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Services", - columns: table => new - { - Id = table.Column(type: "TEXT", nullable: false), - Name = table.Column(type: "TEXT", nullable: true), - CreatedAt = table.Column(type: "TEXT", nullable: false), - UpdatedAt = table.Column(type: "TEXT", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Services", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Identities", - columns: table => new - { - Id = table.Column(type: "TEXT", nullable: false), - Gender = table.Column(type: "VARCHAR", maxLength: 255, nullable: true), - FirstName = table.Column(type: "VARCHAR", maxLength: 255, nullable: false), - LastName = table.Column(type: "VARCHAR", maxLength: 255, nullable: false), - NickName = table.Column(type: "VARCHAR", maxLength: 255, nullable: true), - BirthDate = table.Column(type: "TEXT", nullable: false), - AddressStreet = table.Column(type: "VARCHAR", maxLength: 255, nullable: true), - AddressCity = table.Column(type: "VARCHAR", maxLength: 255, nullable: true), - AddressState = table.Column(type: "VARCHAR", maxLength: 255, nullable: true), - AddressZipCode = table.Column(type: "VARCHAR", maxLength: 255, nullable: true), - AddressCountry = table.Column(type: "VARCHAR", maxLength: 255, nullable: true), - Hobbies = table.Column(type: "TEXT", nullable: true), - EmailPrefix = table.Column(type: "TEXT", nullable: true), - PhoneMobile = table.Column(type: "TEXT", nullable: true), - BankAccountIBAN = table.Column(type: "TEXT", nullable: true), - CreatedAt = table.Column(type: "TEXT", nullable: false), - UpdatedAt = table.Column(type: "TEXT", nullable: false), - DefaultPasswordId = table.Column(type: "TEXT", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Identities", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Logins", - columns: table => new - { - Id = table.Column(type: "TEXT", nullable: false), - Description = table.Column(type: "TEXT", nullable: true), - CreatedAt = table.Column(type: "TEXT", nullable: false), - UpdatedAt = table.Column(type: "TEXT", nullable: false), - IdentityId = table.Column(type: "TEXT", nullable: false), - ServiceId = table.Column(type: "TEXT", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Logins", x => x.Id); - table.ForeignKey( - name: "FK_Logins_Identities_IdentityId", - column: x => x.IdentityId, - principalTable: "Identities", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_Logins_Services_ServiceId", - column: x => x.ServiceId, - principalTable: "Services", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "Passwords", - columns: table => new - { - Id = table.Column(type: "TEXT", nullable: false), - Value = table.Column(type: "TEXT", nullable: true), - CreatedAt = table.Column(type: "TEXT", nullable: false), - UpdatedAt = table.Column(type: "TEXT", nullable: false), - LoginId = table.Column(type: "TEXT", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Passwords", x => x.Id); - table.ForeignKey( - name: "FK_Passwords_Logins_LoginId", - column: x => x.LoginId, - principalTable: "Logins", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_Identities_DefaultPasswordId", - table: "Identities", - column: "DefaultPasswordId"); - - migrationBuilder.CreateIndex( - name: "IX_Logins_IdentityId", - table: "Logins", - column: "IdentityId"); - - migrationBuilder.CreateIndex( - name: "IX_Logins_ServiceId", - table: "Logins", - column: "ServiceId"); - - migrationBuilder.CreateIndex( - name: "IX_Passwords_LoginId", - table: "Passwords", - column: "LoginId"); - - migrationBuilder.AddForeignKey( - name: "FK_Identities_Passwords_DefaultPasswordId", - table: "Identities", - column: "DefaultPasswordId", - principalTable: "Passwords", - principalColumn: "Id", - onDelete: ReferentialAction.SetNull); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Identities_Passwords_DefaultPasswordId", - table: "Identities"); - - migrationBuilder.DropTable( - name: "Passwords"); - - migrationBuilder.DropTable( - name: "Logins"); - - migrationBuilder.DropTable( - name: "Identities"); - - migrationBuilder.DropTable( - name: "Services"); - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240529140248_LoginUserId.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240529140248_LoginUserId.Designer.cs deleted file mode 100644 index 65aed4168..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240529140248_LoginUserId.Designer.cs +++ /dev/null @@ -1,481 +0,0 @@ -// -using System; -using AliasServerDb; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - [DbContext(typeof(AliasServerDbContextSqlite))] - [Migration("20240529140248_LoginUserId")] - partial class LoginUserId - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.5") - .HasAnnotation("Proxies:ChangeTracking", false) - .HasAnnotation("Proxies:CheckEquality", false) - .HasAnnotation("Proxies:LazyLoading", true); - - modelBuilder.Entity("AliasServerDb.Identity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("AddressCity") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("AddressCountry") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("AddressState") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("AddressStreet") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("AddressZipCode") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("BankAccountIBAN") - .HasColumnType("TEXT"); - - b.Property("BirthDate") - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("DefaultPasswordId") - .HasColumnType("TEXT"); - - b.Property("EmailPrefix") - .HasColumnType("TEXT"); - - b.Property("FirstName") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("Gender") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("Hobbies") - .HasColumnType("TEXT"); - - b.Property("LastName") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("NickName") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("PhoneMobile") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DefaultPasswordId"); - - b.ToTable("Identities"); - }); - - modelBuilder.Entity("AliasServerDb.Login", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("IdentityId") - .HasColumnType("TEXT"); - - b.Property("ServiceId") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("IdentityId"); - - b.HasIndex("ServiceId"); - - b.HasIndex("UserId"); - - b.ToTable("Logins"); - }); - - modelBuilder.Entity("AliasServerDb.Password", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("LoginId") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("LoginId"); - - b.ToTable("Passwords"); - }); - - modelBuilder.Entity("AliasServerDb.Service", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("Services"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("AliasServerDb.Identity", b => - { - b.HasOne("AliasServerDb.Password", "DefaultPassword") - .WithMany() - .HasForeignKey("DefaultPasswordId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("DefaultPassword"); - }); - - modelBuilder.Entity("AliasServerDb.Login", b => - { - b.HasOne("AliasServerDb.Identity", "Identity") - .WithMany() - .HasForeignKey("IdentityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("AliasServerDb.Service", "Service") - .WithMany() - .HasForeignKey("ServiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Identity"); - - b.Navigation("Service"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.Password", b => - { - b.HasOne("AliasServerDb.Login", "Login") - .WithMany("Passwords") - .HasForeignKey("LoginId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Login"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AliasServerDb.Login", b => - { - b.Navigation("Passwords"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240529140248_LoginUserId.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240529140248_LoginUserId.cs deleted file mode 100644 index a311874a8..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240529140248_LoginUserId.cs +++ /dev/null @@ -1,61 +0,0 @@ -// -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - /// - public partial class LoginUserId : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - // Add the new UserId column - migrationBuilder.AddColumn( - name: "UserId", - table: "Logins", - type: "TEXT", - nullable: false, - defaultValue: ""); - - // Fetch the first UserId from the AspNetUsers table and update the Logins table - migrationBuilder.Sql(@" - UPDATE Logins - SET UserId = (SELECT Id FROM AspNetUsers LIMIT 1) - WHERE UserId = '' - "); - - // Create the index on the UserId column - migrationBuilder.CreateIndex( - name: "IX_Logins_UserId", - table: "Logins", - column: "UserId"); - - // Add the foreign key constraint - migrationBuilder.AddForeignKey( - name: "FK_Logins_AspNetUsers_UserId", - table: "Logins", - column: "UserId", - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Logins_AspNetUsers_UserId", - table: "Logins"); - - migrationBuilder.DropIndex( - name: "IX_Logins_UserId", - table: "Logins"); - - migrationBuilder.DropColumn( - name: "UserId", - table: "Logins"); - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240531142952_AddServiceLogo.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240531142952_AddServiceLogo.Designer.cs deleted file mode 100644 index c1c137ba3..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240531142952_AddServiceLogo.Designer.cs +++ /dev/null @@ -1,496 +0,0 @@ -// -using System; -using AliasServerDb; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - [DbContext(typeof(AliasServerDbContextSqlite))] - [Migration("20240531142952_AddServiceLogo")] - partial class AddServiceLogo - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.5") - .HasAnnotation("Proxies:ChangeTracking", false) - .HasAnnotation("Proxies:CheckEquality", false) - .HasAnnotation("Proxies:LazyLoading", true); - - modelBuilder.Entity("AliasServerDb.Identity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("AddressCity") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("AddressCountry") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("AddressState") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("AddressStreet") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("AddressZipCode") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("BankAccountIBAN") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("BirthDate") - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("DefaultPasswordId") - .HasColumnType("TEXT"); - - b.Property("EmailPrefix") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("FirstName") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("Gender") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("Hobbies") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("LastName") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("NickName") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("PhoneMobile") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DefaultPasswordId"); - - b.ToTable("Identities"); - }); - - modelBuilder.Entity("AliasServerDb.Login", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("IdentityId") - .HasColumnType("TEXT"); - - b.Property("ServiceId") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("IdentityId"); - - b.HasIndex("ServiceId"); - - b.HasIndex("UserId"); - - b.ToTable("Logins"); - }); - - modelBuilder.Entity("AliasServerDb.Password", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("LoginId") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("LoginId"); - - b.ToTable("Passwords"); - }); - - modelBuilder.Entity("AliasServerDb.Service", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("Logo") - .HasColumnType("BLOB"); - - b.Property("Name") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("Url") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("Services"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("AliasServerDb.Identity", b => - { - b.HasOne("AliasServerDb.Password", "DefaultPassword") - .WithMany() - .HasForeignKey("DefaultPasswordId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("DefaultPassword"); - }); - - modelBuilder.Entity("AliasServerDb.Login", b => - { - b.HasOne("AliasServerDb.Identity", "Identity") - .WithMany() - .HasForeignKey("IdentityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("AliasServerDb.Service", "Service") - .WithMany() - .HasForeignKey("ServiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Identity"); - - b.Navigation("Service"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.Password", b => - { - b.HasOne("AliasServerDb.Login", "Login") - .WithMany("Passwords") - .HasForeignKey("LoginId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Login"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AliasServerDb.Login", b => - { - b.Navigation("Passwords"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240531142952_AddServiceLogo.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240531142952_AddServiceLogo.cs deleted file mode 100644 index cf20be6fe..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240531142952_AddServiceLogo.cs +++ /dev/null @@ -1,40 +0,0 @@ -// -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - /// - public partial class AddServiceLogo : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "Logo", - table: "Services", - type: "BLOB", - nullable: true); - - migrationBuilder.AddColumn( - name: "Url", - table: "Services", - type: "TEXT", - maxLength: 255, - nullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Logo", - table: "Services"); - - migrationBuilder.DropColumn( - name: "Url", - table: "Services"); - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240603175245_AddAspNetUserRefreshTokens.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240603175245_AddAspNetUserRefreshTokens.Designer.cs deleted file mode 100644 index 1a63b693e..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240603175245_AddAspNetUserRefreshTokens.Designer.cs +++ /dev/null @@ -1,542 +0,0 @@ -// -using System; -using AliasServerDb; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - [DbContext(typeof(AliasServerDbContextSqlite))] - [Migration("20240603175245_AddAspNetUserRefreshTokens")] - partial class AddAspNetUserRefreshTokens - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.5") - .HasAnnotation("Proxies:ChangeTracking", false) - .HasAnnotation("Proxies:CheckEquality", false) - .HasAnnotation("Proxies:LazyLoading", true); - - modelBuilder.Entity("AliasServerDb.AspNetUserRefreshTokens", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("DeviceIdentifier") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("ExpireDate") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Value") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserRefreshTokens"); - }); - - modelBuilder.Entity("AliasServerDb.Identity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("AddressCity") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("AddressCountry") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("AddressState") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("AddressStreet") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("AddressZipCode") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("BankAccountIBAN") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("BirthDate") - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("DefaultPasswordId") - .HasColumnType("TEXT"); - - b.Property("EmailPrefix") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("FirstName") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("Gender") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("Hobbies") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("LastName") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("NickName") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("PhoneMobile") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DefaultPasswordId"); - - b.ToTable("Identities"); - }); - - modelBuilder.Entity("AliasServerDb.Login", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("IdentityId") - .HasColumnType("TEXT"); - - b.Property("ServiceId") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("IdentityId"); - - b.HasIndex("ServiceId"); - - b.HasIndex("UserId"); - - b.ToTable("Logins"); - }); - - modelBuilder.Entity("AliasServerDb.Password", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("LoginId") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("LoginId"); - - b.ToTable("Passwords"); - }); - - modelBuilder.Entity("AliasServerDb.Service", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("Logo") - .HasColumnType("BLOB"); - - b.Property("Name") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("Url") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("Services"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("AliasServerDb.AspNetUserRefreshTokens", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.Identity", b => - { - b.HasOne("AliasServerDb.Password", "DefaultPassword") - .WithMany() - .HasForeignKey("DefaultPasswordId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("DefaultPassword"); - }); - - modelBuilder.Entity("AliasServerDb.Login", b => - { - b.HasOne("AliasServerDb.Identity", "Identity") - .WithMany() - .HasForeignKey("IdentityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("AliasServerDb.Service", "Service") - .WithMany() - .HasForeignKey("ServiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Identity"); - - b.Navigation("Service"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.Password", b => - { - b.HasOne("AliasServerDb.Login", "Login") - .WithMany("Passwords") - .HasForeignKey("LoginId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Login"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AliasServerDb.Login", b => - { - b.Navigation("Passwords"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240603175245_AddAspNetUserRefreshTokens.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240603175245_AddAspNetUserRefreshTokens.cs deleted file mode 100644 index 517a453ab..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240603175245_AddAspNetUserRefreshTokens.cs +++ /dev/null @@ -1,50 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - /// - public partial class AddAspNetUserRefreshTokens : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "AspNetUserRefreshTokens", - columns: table => new - { - Id = table.Column(type: "TEXT", nullable: false), - UserId = table.Column(type: "TEXT", maxLength: 255, nullable: false), - DeviceIdentifier = table.Column(type: "TEXT", maxLength: 255, nullable: false), - Value = table.Column(type: "TEXT", maxLength: 255, nullable: false), - ExpireDate = table.Column(type: "TEXT", maxLength: 255, nullable: false), - CreatedAt = table.Column(type: "TEXT", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUserRefreshTokens", x => x.Id); - table.ForeignKey( - name: "FK_AspNetUserRefreshTokens_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_AspNetUserRefreshTokens_UserId", - table: "AspNetUserRefreshTokens", - column: "UserId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "AspNetUserRefreshTokens"); - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240616200303_ChangeColumnDefinitions.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240616200303_ChangeColumnDefinitions.Designer.cs deleted file mode 100644 index debf65a4a..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240616200303_ChangeColumnDefinitions.Designer.cs +++ /dev/null @@ -1,540 +0,0 @@ -// -using System; -using AliasServerDb; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - [DbContext(typeof(AliasServerDbContextSqlite))] - [Migration("20240616200303_ChangeColumnDefinitions")] - partial class ChangeColumnDefinitions - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.6") - .HasAnnotation("Proxies:ChangeTracking", false) - .HasAnnotation("Proxies:CheckEquality", false) - .HasAnnotation("Proxies:LazyLoading", true); - - modelBuilder.Entity("AliasServerDb.AspNetUserRefreshToken", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("DeviceIdentifier") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("ExpireDate") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Value") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserRefreshTokens"); - }); - - modelBuilder.Entity("AliasServerDb.Identity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("AddressCity") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("AddressCountry") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("AddressState") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("AddressStreet") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("AddressZipCode") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("BankAccountIBAN") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("BirthDate") - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("DefaultPasswordId") - .HasColumnType("TEXT"); - - b.Property("EmailPrefix") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("FirstName") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("Gender") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("Hobbies") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("LastName") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("NickName") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("PhoneMobile") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DefaultPasswordId"); - - b.ToTable("Identities"); - }); - - modelBuilder.Entity("AliasServerDb.Login", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("IdentityId") - .HasColumnType("TEXT"); - - b.Property("ServiceId") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("IdentityId"); - - b.HasIndex("ServiceId"); - - b.HasIndex("UserId"); - - b.ToTable("Logins"); - }); - - modelBuilder.Entity("AliasServerDb.Password", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("LoginId") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("LoginId"); - - b.ToTable("Passwords"); - }); - - modelBuilder.Entity("AliasServerDb.Service", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("Logo") - .HasColumnType("BLOB"); - - b.Property("Name") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("Url") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("Services"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("AliasServerDb.AspNetUserRefreshToken", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.Identity", b => - { - b.HasOne("AliasServerDb.Password", "DefaultPassword") - .WithMany() - .HasForeignKey("DefaultPasswordId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("DefaultPassword"); - }); - - modelBuilder.Entity("AliasServerDb.Login", b => - { - b.HasOne("AliasServerDb.Identity", "Identity") - .WithMany() - .HasForeignKey("IdentityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("AliasServerDb.Service", "Service") - .WithMany() - .HasForeignKey("ServiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Identity"); - - b.Navigation("Service"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.Password", b => - { - b.HasOne("AliasServerDb.Login", "Login") - .WithMany("Passwords") - .HasForeignKey("LoginId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Login"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AliasServerDb.Login", b => - { - b.Navigation("Passwords"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240616200303_ChangeColumnDefinitions.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240616200303_ChangeColumnDefinitions.cs deleted file mode 100644 index df27a5a0e..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240616200303_ChangeColumnDefinitions.cs +++ /dev/null @@ -1,63 +0,0 @@ -// -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - /// - public partial class ChangeColumnDefinitions : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "LastName", - table: "Identities", - type: "VARCHAR", - maxLength: 255, - nullable: true, - oldClrType: typeof(string), - oldType: "VARCHAR", - oldMaxLength: 255); - - migrationBuilder.AlterColumn( - name: "FirstName", - table: "Identities", - type: "VARCHAR", - maxLength: 255, - nullable: true, - oldClrType: typeof(string), - oldType: "VARCHAR", - oldMaxLength: 255); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "LastName", - table: "Identities", - type: "VARCHAR", - maxLength: 255, - nullable: false, - defaultValue: "", - oldClrType: typeof(string), - oldType: "VARCHAR", - oldMaxLength: 255, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "FirstName", - table: "Identities", - type: "VARCHAR", - maxLength: 255, - nullable: false, - defaultValue: "", - oldClrType: typeof(string), - oldType: "VARCHAR", - oldMaxLength: 255, - oldNullable: true); - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240621092501_AddAliasVaultUser.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240621092501_AddAliasVaultUser.Designer.cs deleted file mode 100644 index b4723c464..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240621092501_AddAliasVaultUser.Designer.cs +++ /dev/null @@ -1,548 +0,0 @@ -// -using System; -using AliasServerDb; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - [DbContext(typeof(AliasServerDbContextSqlite))] - [Migration("20240621092501_AddAliasVaultUser")] - partial class AddAliasVaultUser - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.6") - .HasAnnotation("Proxies:ChangeTracking", false) - .HasAnnotation("Proxies:CheckEquality", false) - .HasAnnotation("Proxies:LazyLoading", true); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("Salt") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("Verifier") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("AliasServerDb.AspNetUserRefreshToken", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("DeviceIdentifier") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("ExpireDate") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Value") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserRefreshTokens"); - }); - - modelBuilder.Entity("AliasServerDb.Identity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("AddressCity") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("AddressCountry") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("AddressState") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("AddressStreet") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("AddressZipCode") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("BankAccountIBAN") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("BirthDate") - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("DefaultPasswordId") - .HasColumnType("TEXT"); - - b.Property("EmailPrefix") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("FirstName") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("Gender") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("Hobbies") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("LastName") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("NickName") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("PhoneMobile") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DefaultPasswordId"); - - b.ToTable("Identities"); - }); - - modelBuilder.Entity("AliasServerDb.Login", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("IdentityId") - .HasColumnType("TEXT"); - - b.Property("ServiceId") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("IdentityId"); - - b.HasIndex("ServiceId"); - - b.HasIndex("UserId"); - - b.ToTable("Logins"); - }); - - modelBuilder.Entity("AliasServerDb.Password", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("LoginId") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("LoginId"); - - b.ToTable("Passwords"); - }); - - modelBuilder.Entity("AliasServerDb.Service", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("Logo") - .HasColumnType("BLOB"); - - b.Property("Name") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("Url") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("Services"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("AliasServerDb.AspNetUserRefreshToken", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.Identity", b => - { - b.HasOne("AliasServerDb.Password", "DefaultPassword") - .WithMany() - .HasForeignKey("DefaultPasswordId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("DefaultPassword"); - }); - - modelBuilder.Entity("AliasServerDb.Login", b => - { - b.HasOne("AliasServerDb.Identity", "Identity") - .WithMany() - .HasForeignKey("IdentityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("AliasServerDb.Service", "Service") - .WithMany() - .HasForeignKey("ServiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Identity"); - - b.Navigation("Service"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.Password", b => - { - b.HasOne("AliasServerDb.Login", "Login") - .WithMany("Passwords") - .HasForeignKey("LoginId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Login"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("AliasServerDb.AliasVaultUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AliasServerDb.Login", b => - { - b.Navigation("Passwords"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240621092501_AddAliasVaultUser.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240621092501_AddAliasVaultUser.cs deleted file mode 100644 index 47c48fd29..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240621092501_AddAliasVaultUser.cs +++ /dev/null @@ -1,41 +0,0 @@ -// -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - /// - public partial class AddAliasVaultUser : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "Salt", - table: "AspNetUsers", - type: "TEXT", - nullable: false, - defaultValue: ""); - - migrationBuilder.AddColumn( - name: "Verifier", - table: "AspNetUsers", - type: "TEXT", - nullable: false, - defaultValue: ""); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Salt", - table: "AspNetUsers"); - - migrationBuilder.DropColumn( - name: "Verifier", - table: "AspNetUsers"); - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240624125214_AddVaultsTable.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240624125214_AddVaultsTable.Designer.cs deleted file mode 100644 index ff9a29658..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240624125214_AddVaultsTable.Designer.cs +++ /dev/null @@ -1,587 +0,0 @@ -// -using System; -using AliasServerDb; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - [DbContext(typeof(AliasServerDbContextSqlite))] - [Migration("20240624125214_AddVaultsTable")] - partial class AddVaultsTable - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.6") - .HasAnnotation("Proxies:ChangeTracking", false) - .HasAnnotation("Proxies:CheckEquality", false) - .HasAnnotation("Proxies:LazyLoading", true); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("Salt") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("Verifier") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("AliasServerDb.AspNetUserRefreshToken", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("DeviceIdentifier") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("ExpireDate") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Value") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserRefreshTokens"); - }); - - modelBuilder.Entity("AliasServerDb.Identity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("AddressCity") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("AddressCountry") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("AddressState") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("AddressStreet") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("AddressZipCode") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("BankAccountIBAN") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("BirthDate") - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("DefaultPasswordId") - .HasColumnType("TEXT"); - - b.Property("EmailPrefix") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("FirstName") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("Gender") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("Hobbies") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("LastName") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("NickName") - .HasMaxLength(255) - .HasColumnType("VARCHAR"); - - b.Property("PhoneMobile") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("DefaultPasswordId"); - - b.ToTable("Identities"); - }); - - modelBuilder.Entity("AliasServerDb.Login", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("IdentityId") - .HasColumnType("TEXT"); - - b.Property("ServiceId") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("IdentityId"); - - b.HasIndex("ServiceId"); - - b.HasIndex("UserId"); - - b.ToTable("Logins"); - }); - - modelBuilder.Entity("AliasServerDb.Password", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("LoginId") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("LoginId"); - - b.ToTable("Passwords"); - }); - - modelBuilder.Entity("AliasServerDb.Service", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("Logo") - .HasColumnType("BLOB"); - - b.Property("Name") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("Url") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("Services"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("VaultBlob") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Vaults"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("AliasServerDb.AspNetUserRefreshToken", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.Identity", b => - { - b.HasOne("AliasServerDb.Password", "DefaultPassword") - .WithMany() - .HasForeignKey("DefaultPasswordId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("DefaultPassword"); - }); - - modelBuilder.Entity("AliasServerDb.Login", b => - { - b.HasOne("AliasServerDb.Identity", "Identity") - .WithMany() - .HasForeignKey("IdentityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("AliasServerDb.Service", "Service") - .WithMany() - .HasForeignKey("ServiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Identity"); - - b.Navigation("Service"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.Password", b => - { - b.HasOne("AliasServerDb.Login", "Login") - .WithMany("Passwords") - .HasForeignKey("LoginId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Login"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("AliasServerDb.AliasVaultUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AliasServerDb.Login", b => - { - b.Navigation("Passwords"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240624125214_AddVaultsTable.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240624125214_AddVaultsTable.cs deleted file mode 100644 index e9254a798..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240624125214_AddVaultsTable.cs +++ /dev/null @@ -1,49 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - /// - public partial class AddVaultsTable : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Vaults", - columns: table => new - { - Id = table.Column(type: "TEXT", nullable: false), - UserId = table.Column(type: "TEXT", maxLength: 255, nullable: false), - VaultBlob = table.Column(type: "TEXT", nullable: false), - CreatedAt = table.Column(type: "TEXT", nullable: false), - UpdatedAt = table.Column(type: "TEXT", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Vaults", x => x.Id); - table.ForeignKey( - name: "FK_Vaults_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_Vaults_UserId", - table: "Vaults", - column: "UserId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "Vaults"); - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240701104445_RemoveClientTables.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240701104445_RemoveClientTables.Designer.cs deleted file mode 100644 index e4e7185d1..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240701104445_RemoveClientTables.Designer.cs +++ /dev/null @@ -1,365 +0,0 @@ -// -using System; -using AliasServerDb; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - [DbContext(typeof(AliasServerDbContextSqlite))] - [Migration("20240701104445_RemoveClientTables")] - partial class RemoveClientTables - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.6") - .HasAnnotation("Proxies:ChangeTracking", false) - .HasAnnotation("Proxies:CheckEquality", false) - .HasAnnotation("Proxies:LazyLoading", true); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("Salt") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("Verifier") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("AliasServerDb.AspNetUserRefreshToken", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("DeviceIdentifier") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("ExpireDate") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Value") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserRefreshTokens"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("VaultBlob") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Vaults"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("AliasServerDb.AspNetUserRefreshToken", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("AliasServerDb.AliasVaultUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240701104445_RemoveClientTables.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240701104445_RemoveClientTables.cs deleted file mode 100644 index edf01f11b..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240701104445_RemoveClientTables.cs +++ /dev/null @@ -1,168 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - /// - public partial class RemoveClientTables : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "Passwords"); - - migrationBuilder.DropTable( - name: "Logins"); - - migrationBuilder.DropTable( - name: "Identities"); - - migrationBuilder.DropTable( - name: "Services"); - - // Delete all rows from the vaults table because datamodel has changed. - migrationBuilder.Sql("DELETE FROM Vaults;"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Services", - columns: table => new - { - Id = table.Column(type: "TEXT", nullable: false), - CreatedAt = table.Column(type: "TEXT", nullable: false), - Logo = table.Column(type: "BLOB", nullable: true), - Name = table.Column(type: "TEXT", maxLength: 255, nullable: true), - UpdatedAt = table.Column(type: "TEXT", nullable: false), - Url = table.Column(type: "TEXT", maxLength: 255, nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Services", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Identities", - columns: table => new - { - Id = table.Column(type: "TEXT", nullable: false), - DefaultPasswordId = table.Column(type: "TEXT", nullable: true), - AddressCity = table.Column(type: "VARCHAR", maxLength: 255, nullable: true), - AddressCountry = table.Column(type: "VARCHAR", maxLength: 255, nullable: true), - AddressState = table.Column(type: "VARCHAR", maxLength: 255, nullable: true), - AddressStreet = table.Column(type: "VARCHAR", maxLength: 255, nullable: true), - AddressZipCode = table.Column(type: "VARCHAR", maxLength: 255, nullable: true), - BankAccountIBAN = table.Column(type: "TEXT", maxLength: 255, nullable: true), - BirthDate = table.Column(type: "TEXT", nullable: false), - CreatedAt = table.Column(type: "TEXT", nullable: false), - EmailPrefix = table.Column(type: "TEXT", maxLength: 255, nullable: true), - FirstName = table.Column(type: "VARCHAR", maxLength: 255, nullable: true), - Gender = table.Column(type: "VARCHAR", maxLength: 255, nullable: true), - Hobbies = table.Column(type: "TEXT", maxLength: 255, nullable: true), - LastName = table.Column(type: "VARCHAR", maxLength: 255, nullable: true), - NickName = table.Column(type: "VARCHAR", maxLength: 255, nullable: true), - PhoneMobile = table.Column(type: "TEXT", maxLength: 255, nullable: true), - UpdatedAt = table.Column(type: "TEXT", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Identities", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Logins", - columns: table => new - { - Id = table.Column(type: "TEXT", nullable: false), - IdentityId = table.Column(type: "TEXT", nullable: false), - ServiceId = table.Column(type: "TEXT", nullable: false), - UserId = table.Column(type: "TEXT", maxLength: 255, nullable: false), - CreatedAt = table.Column(type: "TEXT", nullable: false), - Description = table.Column(type: "TEXT", maxLength: 255, nullable: true), - UpdatedAt = table.Column(type: "TEXT", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Logins", x => x.Id); - table.ForeignKey( - name: "FK_Logins_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_Logins_Identities_IdentityId", - column: x => x.IdentityId, - principalTable: "Identities", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_Logins_Services_ServiceId", - column: x => x.ServiceId, - principalTable: "Services", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "Passwords", - columns: table => new - { - Id = table.Column(type: "TEXT", nullable: false), - LoginId = table.Column(type: "TEXT", nullable: false), - CreatedAt = table.Column(type: "TEXT", nullable: false), - UpdatedAt = table.Column(type: "TEXT", nullable: false), - Value = table.Column(type: "TEXT", maxLength: 255, nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Passwords", x => x.Id); - table.ForeignKey( - name: "FK_Passwords_Logins_LoginId", - column: x => x.LoginId, - principalTable: "Logins", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_Identities_DefaultPasswordId", - table: "Identities", - column: "DefaultPasswordId"); - - migrationBuilder.CreateIndex( - name: "IX_Logins_IdentityId", - table: "Logins", - column: "IdentityId"); - - migrationBuilder.CreateIndex( - name: "IX_Logins_ServiceId", - table: "Logins", - column: "ServiceId"); - - migrationBuilder.CreateIndex( - name: "IX_Logins_UserId", - table: "Logins", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_Passwords_LoginId", - table: "Passwords", - column: "LoginId"); - - migrationBuilder.AddForeignKey( - name: "FK_Identities_Passwords_DefaultPasswordId", - table: "Identities", - column: "DefaultPasswordId", - principalTable: "Passwords", - principalColumn: "Id", - onDelete: ReferentialAction.SetNull); - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240708113743_AddVaultVersionColumn.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240708113743_AddVaultVersionColumn.Designer.cs deleted file mode 100644 index ee85470ff..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240708113743_AddVaultVersionColumn.Designer.cs +++ /dev/null @@ -1,370 +0,0 @@ -// -using System; -using AliasServerDb; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - [DbContext(typeof(AliasServerDbContextSqlite))] - [Migration("20240708113743_AddVaultVersionColumn")] - partial class AddVaultVersionColumn - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.6") - .HasAnnotation("Proxies:ChangeTracking", false) - .HasAnnotation("Proxies:CheckEquality", false) - .HasAnnotation("Proxies:LazyLoading", true); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("Salt") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("Verifier") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("AliasServerDb.AspNetUserRefreshToken", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("DeviceIdentifier") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("ExpireDate") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Value") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserRefreshTokens"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("VaultBlob") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Version") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Vaults"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("AliasServerDb.AspNetUserRefreshToken", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("AliasServerDb.AliasVaultUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240708113743_AddVaultVersionColumn.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240708113743_AddVaultVersionColumn.cs deleted file mode 100644 index 0291f9380..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240708113743_AddVaultVersionColumn.cs +++ /dev/null @@ -1,31 +0,0 @@ -// -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - /// - public partial class AddVaultVersionColumn : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "Version", - table: "Vaults", - type: "TEXT", - maxLength: 255, - nullable: false, - defaultValue: ""); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Version", - table: "Vaults"); - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240720151458_AddEmailTables.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240720151458_AddEmailTables.Designer.cs deleted file mode 100644 index 9efc7da9d..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240720151458_AddEmailTables.Designer.cs +++ /dev/null @@ -1,494 +0,0 @@ -// -using System; -using AliasServerDb; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - [DbContext(typeof(AliasServerDbContextSqlite))] - [Migration("20240718151458_AddEmailTables")] - partial class AddEmailTables - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.6") - .HasAnnotation("Proxies:ChangeTracking", false) - .HasAnnotation("Proxies:CheckEquality", false) - .HasAnnotation("Proxies:LazyLoading", true); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("Salt") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("Verifier") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("AliasServerDb.AspNetUserRefreshToken", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("DeviceIdentifier") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("ExpireDate") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Value") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserRefreshTokens"); - }); - - modelBuilder.Entity("AliasServerDb.Email", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("DateSystem") - .HasColumnType("TEXT"); - - b.Property("From") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageHtml") - .HasColumnType("TEXT"); - - b.Property("MessagePlain") - .HasColumnType("TEXT"); - - b.Property("MessagePreview") - .HasColumnType("TEXT"); - - b.Property("MessageSource") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("PushNotificationSent") - .HasColumnType("INTEGER"); - - b.Property("Subject") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("To") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Visible") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Date"); - - b.HasIndex("DateSystem"); - - b.HasIndex("PushNotificationSent"); - - b.HasIndex("ToLocal"); - - b.HasIndex("Visible"); - - b.ToTable("Emails"); - }); - - modelBuilder.Entity("AliasServerDb.EmailAttachment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Bytes") - .IsRequired() - .HasColumnType("BLOB"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("EmailId") - .HasColumnType("INTEGER"); - - b.Property("Filename") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Filesize") - .HasColumnType("INTEGER"); - - b.Property("MimeType") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("EmailId"); - - b.ToTable("EmailAttachments"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("VaultBlob") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Version") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Vaults"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("AliasServerDb.AspNetUserRefreshToken", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.EmailAttachment", b => - { - b.HasOne("AliasServerDb.Email", "Email") - .WithMany("Attachments") - .HasForeignKey("EmailId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Email"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("AliasServerDb.AliasVaultUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AliasServerDb.Email", b => - { - b.Navigation("Attachments"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240720151458_AddEmailTables.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240720151458_AddEmailTables.cs deleted file mode 100644 index 4c6bf16ed..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240720151458_AddEmailTables.cs +++ /dev/null @@ -1,107 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - /// - public partial class AddEmailTables : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Emails", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Subject = table.Column(type: "TEXT", nullable: false), - From = table.Column(type: "TEXT", nullable: false), - FromLocal = table.Column(type: "TEXT", nullable: false), - FromDomain = table.Column(type: "TEXT", nullable: false), - To = table.Column(type: "TEXT", nullable: false), - ToLocal = table.Column(type: "TEXT", nullable: false), - ToDomain = table.Column(type: "TEXT", nullable: false), - Date = table.Column(type: "TEXT", nullable: false), - DateSystem = table.Column(type: "TEXT", nullable: false), - MessageHtml = table.Column(type: "TEXT", nullable: true), - MessagePlain = table.Column(type: "TEXT", nullable: true), - MessagePreview = table.Column(type: "TEXT", nullable: true), - MessageSource = table.Column(type: "TEXT", nullable: false), - Visible = table.Column(type: "INTEGER", nullable: false), - PushNotificationSent = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Emails", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "EmailAttachments", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Bytes = table.Column(type: "BLOB", nullable: false), - Filename = table.Column(type: "TEXT", nullable: false), - MimeType = table.Column(type: "TEXT", nullable: false), - Filesize = table.Column(type: "INTEGER", nullable: false), - Date = table.Column(type: "TEXT", nullable: false), - EmailId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_EmailAttachments", x => x.Id); - table.ForeignKey( - name: "FK_EmailAttachments_Emails_EmailId", - column: x => x.EmailId, - principalTable: "Emails", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_EmailAttachments_EmailId", - table: "EmailAttachments", - column: "EmailId"); - - migrationBuilder.CreateIndex( - name: "IX_Emails_Date", - table: "Emails", - column: "Date"); - - migrationBuilder.CreateIndex( - name: "IX_Emails_DateSystem", - table: "Emails", - column: "DateSystem"); - - migrationBuilder.CreateIndex( - name: "IX_Emails_PushNotificationSent", - table: "Emails", - column: "PushNotificationSent"); - - migrationBuilder.CreateIndex( - name: "IX_Emails_ToLocal", - table: "Emails", - column: "ToLocal"); - - migrationBuilder.CreateIndex( - name: "IX_Emails_Visible", - table: "Emails", - column: "Visible"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "EmailAttachments"); - - migrationBuilder.DropTable( - name: "Emails"); - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240720211546_AddAdminUsersTable.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240720211546_AddAdminUsersTable.Designer.cs deleted file mode 100644 index c1dc3cb51..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240720211546_AddAdminUsersTable.Designer.cs +++ /dev/null @@ -1,484 +0,0 @@ -// -using System; -using AliasServerDb; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - [DbContext(typeof(AliasServerDbContextSqlite))] - [Migration("20240720211546_AddAdminUsersTable")] - partial class AddAdminUsersTable - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.6") - .HasAnnotation("Proxies:ChangeTracking", false) - .HasAnnotation("Proxies:CheckEquality", false) - .HasAnnotation("Proxies:LazyLoading", true); - - modelBuilder.Entity("AliasServerDb.AdminRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AdminUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("Salt") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.Property("Verifier") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("DeviceIdentifier") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("ExpireDate") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Value") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AliasVaultUserRefreshTokens"); - }); - - modelBuilder.Entity("AliasServerDb.Email", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("DateSystem") - .HasColumnType("TEXT"); - - b.Property("From") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageHtml") - .HasColumnType("TEXT"); - - b.Property("MessagePlain") - .HasColumnType("TEXT"); - - b.Property("MessagePreview") - .HasColumnType("TEXT"); - - b.Property("MessageSource") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("PushNotificationSent") - .HasColumnType("INTEGER"); - - b.Property("Subject") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("To") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Visible") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Date"); - - b.HasIndex("DateSystem"); - - b.HasIndex("PushNotificationSent"); - - b.HasIndex("ToLocal"); - - b.HasIndex("Visible"); - - b.ToTable("Emails"); - }); - - modelBuilder.Entity("AliasServerDb.EmailAttachment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Bytes") - .IsRequired() - .HasColumnType("BLOB"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("EmailId") - .HasColumnType("INTEGER"); - - b.Property("Filename") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Filesize") - .HasColumnType("INTEGER"); - - b.Property("MimeType") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("EmailId"); - - b.ToTable("EmailAttachments"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("VaultBlob") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Version") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Vaults"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("RoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("UserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.ToTable("UserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.ToTable("UserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("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.EmailAttachment", b => - { - b.HasOne("AliasServerDb.Email", "Email") - .WithMany("Attachments") - .HasForeignKey("EmailId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Email"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.Email", b => - { - b.Navigation("Attachments"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240720211546_AddAdminUsersTable.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240720211546_AddAdminUsersTable.cs deleted file mode 100644 index c08d2091b..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240720211546_AddAdminUsersTable.cs +++ /dev/null @@ -1,526 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - /// - public partial class AddAdminUsersTable : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_AspNetRoleClaims_AspNetRoles_RoleId", - table: "AspNetRoleClaims"); - - migrationBuilder.DropForeignKey( - name: "FK_AspNetUserClaims_AspNetUsers_UserId", - table: "AspNetUserClaims"); - - migrationBuilder.DropForeignKey( - name: "FK_AspNetUserLogins_AspNetUsers_UserId", - table: "AspNetUserLogins"); - - migrationBuilder.DropForeignKey( - name: "FK_AspNetUserRoles_AspNetRoles_RoleId", - table: "AspNetUserRoles"); - - migrationBuilder.DropForeignKey( - name: "FK_AspNetUserRoles_AspNetUsers_UserId", - table: "AspNetUserRoles"); - - migrationBuilder.DropForeignKey( - name: "FK_AspNetUserTokens_AspNetUsers_UserId", - table: "AspNetUserTokens"); - - migrationBuilder.DropForeignKey( - name: "FK_Vaults_AspNetUsers_UserId", - table: "Vaults"); - - migrationBuilder.DropTable( - name: "AspNetRoles"); - - migrationBuilder.DropTable( - name: "AspNetUserRefreshTokens"); - - migrationBuilder.DropPrimaryKey( - name: "PK_AspNetUserTokens", - table: "AspNetUserTokens"); - - migrationBuilder.DropPrimaryKey( - name: "PK_AspNetUsers", - table: "AspNetUsers"); - - migrationBuilder.DropIndex( - name: "EmailIndex", - table: "AspNetUsers"); - - migrationBuilder.DropIndex( - name: "UserNameIndex", - table: "AspNetUsers"); - - migrationBuilder.DropPrimaryKey( - name: "PK_AspNetUserRoles", - table: "AspNetUserRoles"); - - migrationBuilder.DropIndex( - name: "IX_AspNetUserRoles_RoleId", - table: "AspNetUserRoles"); - - migrationBuilder.DropPrimaryKey( - name: "PK_AspNetUserLogins", - table: "AspNetUserLogins"); - - migrationBuilder.DropIndex( - name: "IX_AspNetUserLogins_UserId", - table: "AspNetUserLogins"); - - migrationBuilder.DropPrimaryKey( - name: "PK_AspNetUserClaims", - table: "AspNetUserClaims"); - - migrationBuilder.DropIndex( - name: "IX_AspNetUserClaims_UserId", - table: "AspNetUserClaims"); - - migrationBuilder.DropPrimaryKey( - name: "PK_AspNetRoleClaims", - table: "AspNetRoleClaims"); - - migrationBuilder.DropIndex( - name: "IX_AspNetRoleClaims_RoleId", - table: "AspNetRoleClaims"); - - migrationBuilder.RenameTable( - name: "AspNetUserTokens", - newName: "UserTokens"); - - migrationBuilder.RenameTable( - name: "AspNetUsers", - newName: "AliasVaultUsers"); - - migrationBuilder.RenameTable( - name: "AspNetUserRoles", - newName: "UserRoles"); - - migrationBuilder.RenameTable( - name: "AspNetUserLogins", - newName: "UserLogins"); - - migrationBuilder.RenameTable( - name: "AspNetUserClaims", - newName: "UserClaims"); - - migrationBuilder.RenameTable( - name: "AspNetRoleClaims", - newName: "RoleClaims"); - - migrationBuilder.AlterColumn( - name: "UserId", - table: "UserLogins", - type: "TEXT", - nullable: true, - oldClrType: typeof(string), - oldType: "TEXT"); - - migrationBuilder.AlterColumn( - name: "UserId", - table: "UserClaims", - type: "TEXT", - nullable: true, - oldClrType: typeof(string), - oldType: "TEXT"); - - migrationBuilder.AlterColumn( - name: "RoleId", - table: "RoleClaims", - type: "TEXT", - nullable: true, - oldClrType: typeof(string), - oldType: "TEXT"); - - migrationBuilder.AddPrimaryKey( - name: "PK_UserTokens", - table: "UserTokens", - columns: new[] { "UserId", "LoginProvider", "Name" }); - - migrationBuilder.AddPrimaryKey( - name: "PK_AliasVaultUsers", - table: "AliasVaultUsers", - column: "Id"); - - migrationBuilder.AddPrimaryKey( - name: "PK_UserRoles", - table: "UserRoles", - columns: new[] { "UserId", "RoleId" }); - - migrationBuilder.AddPrimaryKey( - name: "PK_UserLogins", - table: "UserLogins", - columns: new[] { "LoginProvider", "ProviderKey" }); - - migrationBuilder.AddPrimaryKey( - name: "PK_UserClaims", - table: "UserClaims", - column: "Id"); - - migrationBuilder.AddPrimaryKey( - name: "PK_RoleClaims", - table: "RoleClaims", - column: "Id"); - - migrationBuilder.CreateTable( - name: "AdminRoles", - columns: table => new - { - Id = table.Column(type: "TEXT", nullable: false), - Name = table.Column(type: "TEXT", nullable: true), - NormalizedName = table.Column(type: "TEXT", nullable: true), - ConcurrencyStamp = table.Column(type: "TEXT", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AdminRoles", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AdminUsers", - columns: table => new - { - Id = table.Column(type: "TEXT", nullable: false), - UserName = table.Column(type: "TEXT", nullable: true), - NormalizedUserName = table.Column(type: "TEXT", nullable: true), - Email = table.Column(type: "TEXT", nullable: true), - NormalizedEmail = table.Column(type: "TEXT", nullable: true), - EmailConfirmed = table.Column(type: "INTEGER", nullable: false), - PasswordHash = table.Column(type: "TEXT", nullable: true), - SecurityStamp = table.Column(type: "TEXT", nullable: true), - ConcurrencyStamp = table.Column(type: "TEXT", nullable: true), - PhoneNumber = table.Column(type: "TEXT", nullable: true), - PhoneNumberConfirmed = table.Column(type: "INTEGER", nullable: false), - TwoFactorEnabled = table.Column(type: "INTEGER", nullable: false), - LockoutEnd = table.Column(type: "TEXT", nullable: true), - LockoutEnabled = table.Column(type: "INTEGER", nullable: false), - AccessFailedCount = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AdminUsers", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AliasVaultRoles", - columns: table => new - { - Id = table.Column(type: "TEXT", nullable: false), - Name = table.Column(type: "TEXT", nullable: true), - NormalizedName = table.Column(type: "TEXT", nullable: true), - ConcurrencyStamp = table.Column(type: "TEXT", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AliasVaultRoles", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AliasVaultUserRefreshTokens", - columns: table => new - { - Id = table.Column(type: "TEXT", nullable: false), - UserId = table.Column(type: "TEXT", maxLength: 255, nullable: false), - DeviceIdentifier = table.Column(type: "TEXT", maxLength: 255, nullable: false), - Value = table.Column(type: "TEXT", maxLength: 255, nullable: false), - ExpireDate = table.Column(type: "TEXT", maxLength: 255, nullable: false), - CreatedAt = table.Column(type: "TEXT", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AliasVaultUserRefreshTokens", x => x.Id); - table.ForeignKey( - name: "FK_AliasVaultUserRefreshTokens_AliasVaultUsers_UserId", - column: x => x.UserId, - principalTable: "AliasVaultUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_AliasVaultUserRefreshTokens_UserId", - table: "AliasVaultUserRefreshTokens", - column: "UserId"); - - migrationBuilder.AddForeignKey( - name: "FK_Vaults_AliasVaultUsers_UserId", - table: "Vaults", - column: "UserId", - principalTable: "AliasVaultUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Vaults_AliasVaultUsers_UserId", - table: "Vaults"); - - migrationBuilder.DropTable( - name: "AdminRoles"); - - migrationBuilder.DropTable( - name: "AdminUsers"); - - migrationBuilder.DropTable( - name: "AliasVaultRoles"); - - migrationBuilder.DropTable( - name: "AliasVaultUserRefreshTokens"); - - migrationBuilder.DropPrimaryKey( - name: "PK_UserTokens", - table: "UserTokens"); - - migrationBuilder.DropPrimaryKey( - name: "PK_UserRoles", - table: "UserRoles"); - - migrationBuilder.DropPrimaryKey( - name: "PK_UserLogins", - table: "UserLogins"); - - migrationBuilder.DropPrimaryKey( - name: "PK_UserClaims", - table: "UserClaims"); - - migrationBuilder.DropPrimaryKey( - name: "PK_RoleClaims", - table: "RoleClaims"); - - migrationBuilder.DropPrimaryKey( - name: "PK_AliasVaultUsers", - table: "AliasVaultUsers"); - - migrationBuilder.RenameTable( - name: "UserTokens", - newName: "AspNetUserTokens"); - - migrationBuilder.RenameTable( - name: "UserRoles", - newName: "AspNetUserRoles"); - - migrationBuilder.RenameTable( - name: "UserLogins", - newName: "AspNetUserLogins"); - - migrationBuilder.RenameTable( - name: "UserClaims", - newName: "AspNetUserClaims"); - - migrationBuilder.RenameTable( - name: "RoleClaims", - newName: "AspNetRoleClaims"); - - migrationBuilder.RenameTable( - name: "AliasVaultUsers", - newName: "AspNetUsers"); - - migrationBuilder.AlterColumn( - name: "UserId", - table: "AspNetUserLogins", - type: "TEXT", - nullable: false, - defaultValue: "", - oldClrType: typeof(string), - oldType: "TEXT", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "UserId", - table: "AspNetUserClaims", - type: "TEXT", - nullable: false, - defaultValue: "", - oldClrType: typeof(string), - oldType: "TEXT", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "RoleId", - table: "AspNetRoleClaims", - type: "TEXT", - nullable: false, - defaultValue: "", - oldClrType: typeof(string), - oldType: "TEXT", - oldNullable: true); - - migrationBuilder.AddPrimaryKey( - name: "PK_AspNetUserTokens", - table: "AspNetUserTokens", - columns: new[] { "UserId", "LoginProvider", "Name" }); - - migrationBuilder.AddPrimaryKey( - name: "PK_AspNetUserRoles", - table: "AspNetUserRoles", - columns: new[] { "UserId", "RoleId" }); - - migrationBuilder.AddPrimaryKey( - name: "PK_AspNetUserLogins", - table: "AspNetUserLogins", - columns: new[] { "LoginProvider", "ProviderKey" }); - - migrationBuilder.AddPrimaryKey( - name: "PK_AspNetUserClaims", - table: "AspNetUserClaims", - column: "Id"); - - migrationBuilder.AddPrimaryKey( - name: "PK_AspNetRoleClaims", - table: "AspNetRoleClaims", - column: "Id"); - - migrationBuilder.AddPrimaryKey( - name: "PK_AspNetUsers", - table: "AspNetUsers", - column: "Id"); - - migrationBuilder.CreateTable( - name: "AspNetRoles", - columns: table => new - { - Id = table.Column(type: "TEXT", nullable: false), - ConcurrencyStamp = table.Column(type: "TEXT", nullable: true), - Name = table.Column(type: "TEXT", maxLength: 256, nullable: true), - NormalizedName = table.Column(type: "TEXT", maxLength: 256, nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetRoles", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AspNetUserRefreshTokens", - columns: table => new - { - Id = table.Column(type: "TEXT", nullable: false), - UserId = table.Column(type: "TEXT", maxLength: 255, nullable: false), - CreatedAt = table.Column(type: "TEXT", nullable: false), - DeviceIdentifier = table.Column(type: "TEXT", maxLength: 255, nullable: false), - ExpireDate = table.Column(type: "TEXT", maxLength: 255, nullable: false), - Value = table.Column(type: "TEXT", maxLength: 255, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUserRefreshTokens", x => x.Id); - table.ForeignKey( - name: "FK_AspNetUserRefreshTokens_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_AspNetUserRoles_RoleId", - table: "AspNetUserRoles", - column: "RoleId"); - - migrationBuilder.CreateIndex( - name: "IX_AspNetUserLogins_UserId", - table: "AspNetUserLogins", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_AspNetUserClaims_UserId", - table: "AspNetUserClaims", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_AspNetRoleClaims_RoleId", - table: "AspNetRoleClaims", - column: "RoleId"); - - migrationBuilder.CreateIndex( - name: "EmailIndex", - table: "AspNetUsers", - column: "NormalizedEmail"); - - migrationBuilder.CreateIndex( - name: "UserNameIndex", - table: "AspNetUsers", - column: "NormalizedUserName", - unique: true); - - migrationBuilder.CreateIndex( - name: "RoleNameIndex", - table: "AspNetRoles", - column: "NormalizedName", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_AspNetUserRefreshTokens_UserId", - table: "AspNetUserRefreshTokens", - column: "UserId"); - - migrationBuilder.AddForeignKey( - name: "FK_AspNetRoleClaims_AspNetRoles_RoleId", - table: "AspNetRoleClaims", - column: "RoleId", - principalTable: "AspNetRoles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - migrationBuilder.AddForeignKey( - name: "FK_AspNetUserClaims_AspNetUsers_UserId", - table: "AspNetUserClaims", - column: "UserId", - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - migrationBuilder.AddForeignKey( - name: "FK_AspNetUserLogins_AspNetUsers_UserId", - table: "AspNetUserLogins", - column: "UserId", - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - migrationBuilder.AddForeignKey( - name: "FK_AspNetUserRoles_AspNetRoles_RoleId", - table: "AspNetUserRoles", - column: "RoleId", - principalTable: "AspNetRoles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - migrationBuilder.AddForeignKey( - name: "FK_AspNetUserRoles_AspNetUsers_UserId", - table: "AspNetUserRoles", - column: "UserId", - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - migrationBuilder.AddForeignKey( - name: "FK_AspNetUserTokens_AspNetUsers_UserId", - table: "AspNetUserTokens", - column: "UserId", - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - migrationBuilder.AddForeignKey( - name: "FK_Vaults_AspNetUsers_UserId", - table: "Vaults", - column: "UserId", - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240722144205_AddAdminUserPasswordSetDate.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240722144205_AddAdminUserPasswordSetDate.Designer.cs deleted file mode 100644 index d07bc3869..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240722144205_AddAdminUserPasswordSetDate.Designer.cs +++ /dev/null @@ -1,487 +0,0 @@ -// -using System; -using AliasServerDb; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - [DbContext(typeof(AliasServerDbContextSqlite))] - [Migration("20240722144205_AddAdminUserPasswordSetDate")] - partial class AddAdminUserPasswordSetDate - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.6") - .HasAnnotation("Proxies:ChangeTracking", false) - .HasAnnotation("Proxies:CheckEquality", false) - .HasAnnotation("Proxies:LazyLoading", true); - - modelBuilder.Entity("AliasServerDb.AdminRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AdminUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LastPasswordChanged") - .HasColumnType("TEXT"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("Salt") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.Property("Verifier") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("DeviceIdentifier") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("ExpireDate") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Value") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AliasVaultUserRefreshTokens"); - }); - - modelBuilder.Entity("AliasServerDb.Email", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("DateSystem") - .HasColumnType("TEXT"); - - b.Property("From") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageHtml") - .HasColumnType("TEXT"); - - b.Property("MessagePlain") - .HasColumnType("TEXT"); - - b.Property("MessagePreview") - .HasColumnType("TEXT"); - - b.Property("MessageSource") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("PushNotificationSent") - .HasColumnType("INTEGER"); - - b.Property("Subject") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("To") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Visible") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Date"); - - b.HasIndex("DateSystem"); - - b.HasIndex("PushNotificationSent"); - - b.HasIndex("ToLocal"); - - b.HasIndex("Visible"); - - b.ToTable("Emails"); - }); - - modelBuilder.Entity("AliasServerDb.EmailAttachment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Bytes") - .IsRequired() - .HasColumnType("BLOB"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("EmailId") - .HasColumnType("INTEGER"); - - b.Property("Filename") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Filesize") - .HasColumnType("INTEGER"); - - b.Property("MimeType") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("EmailId"); - - b.ToTable("EmailAttachments"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("VaultBlob") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Version") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Vaults"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("RoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("UserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.ToTable("UserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.ToTable("UserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("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.EmailAttachment", b => - { - b.HasOne("AliasServerDb.Email", "Email") - .WithMany("Attachments") - .HasForeignKey("EmailId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Email"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.Email", b => - { - b.Navigation("Attachments"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240722144205_AddAdminUserPasswordSetDate.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240722144205_AddAdminUserPasswordSetDate.cs deleted file mode 100644 index 3eee6f4aa..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240722144205_AddAdminUserPasswordSetDate.cs +++ /dev/null @@ -1,30 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - /// - public partial class AddAdminUserPasswordSetDate : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "LastPasswordChanged", - table: "AdminUsers", - type: "TEXT", - nullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "LastPasswordChanged", - table: "AdminUsers"); - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240723194939_CreateLogTable.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240723194939_CreateLogTable.Designer.cs deleted file mode 100644 index 253ff0896..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240723194939_CreateLogTable.Designer.cs +++ /dev/null @@ -1,536 +0,0 @@ -// -using System; -using AliasServerDb; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - [DbContext(typeof(AliasServerDbContextSqlite))] - [Migration("20240723194939_CreateLogTable")] - partial class CreateLogTable - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.6") - .HasAnnotation("Proxies:ChangeTracking", false) - .HasAnnotation("Proxies:CheckEquality", false) - .HasAnnotation("Proxies:LazyLoading", true); - - modelBuilder.Entity("AliasServerDb.AdminRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AdminUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LastPasswordChanged") - .HasColumnType("TEXT"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("Salt") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.Property("Verifier") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("DeviceIdentifier") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("ExpireDate") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Value") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AliasVaultUserRefreshTokens"); - }); - - modelBuilder.Entity("AliasServerDb.Email", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("DateSystem") - .HasColumnType("TEXT"); - - b.Property("From") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageHtml") - .HasColumnType("TEXT"); - - b.Property("MessagePlain") - .HasColumnType("TEXT"); - - b.Property("MessagePreview") - .HasColumnType("TEXT"); - - b.Property("MessageSource") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("PushNotificationSent") - .HasColumnType("INTEGER"); - - b.Property("Subject") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("To") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Visible") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Date"); - - b.HasIndex("DateSystem"); - - b.HasIndex("PushNotificationSent"); - - b.HasIndex("ToLocal"); - - b.HasIndex("Visible"); - - b.ToTable("Emails"); - }); - - modelBuilder.Entity("AliasServerDb.EmailAttachment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Bytes") - .IsRequired() - .HasColumnType("BLOB"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("EmailId") - .HasColumnType("INTEGER"); - - b.Property("Filename") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Filesize") - .HasColumnType("INTEGER"); - - b.Property("MimeType") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("EmailId"); - - b.ToTable("EmailAttachments"); - }); - - modelBuilder.Entity("AliasServerDb.Log", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Application") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Exception") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Level") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); - - b.Property("LogEvent") - .IsRequired() - .HasColumnType("TEXT") - .HasColumnName("LogEvent"); - - b.Property("Message") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageTemplate") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Properties") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TimeStamp") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Application"); - - b.HasIndex("TimeStamp"); - - b.ToTable("Logs", (string)null); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("VaultBlob") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Version") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Vaults"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("RoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("UserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.ToTable("UserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.ToTable("UserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("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.EmailAttachment", b => - { - b.HasOne("AliasServerDb.Email", "Email") - .WithMany("Attachments") - .HasForeignKey("EmailId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Email"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.Email", b => - { - b.Navigation("Attachments"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240723194939_CreateLogTable.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240723194939_CreateLogTable.cs deleted file mode 100644 index 35150732e..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240723194939_CreateLogTable.cs +++ /dev/null @@ -1,53 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - /// - public partial class CreateLogTable : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Logs", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Application = table.Column(type: "TEXT", maxLength: 50, nullable: false), - Message = table.Column(type: "TEXT", nullable: false), - MessageTemplate = table.Column(type: "TEXT", nullable: false), - Level = table.Column(type: "TEXT", maxLength: 128, nullable: false), - TimeStamp = table.Column(type: "TEXT", nullable: false), - Exception = table.Column(type: "TEXT", nullable: false), - Properties = table.Column(type: "TEXT", nullable: false), - LogEvent = table.Column(type: "TEXT", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Logs", x => x.Id); - }); - - migrationBuilder.CreateIndex( - name: "IX_Logs_Application", - table: "Logs", - column: "Application"); - - migrationBuilder.CreateIndex( - name: "IX_Logs_TimeStamp", - table: "Logs", - column: "TimeStamp"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "Logs"); - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240725202058_WorkerStatusTable.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240725202058_WorkerStatusTable.Designer.cs deleted file mode 100644 index e8f7bd698..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240725202058_WorkerStatusTable.Designer.cs +++ /dev/null @@ -1,565 +0,0 @@ -// -using System; -using AliasServerDb; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - [DbContext(typeof(AliasServerDbContextSqlite))] - [Migration("20240725202058_WorkerStatusTable")] - partial class WorkerStatusTable - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.7") - .HasAnnotation("Proxies:ChangeTracking", false) - .HasAnnotation("Proxies:CheckEquality", false) - .HasAnnotation("Proxies:LazyLoading", true); - - modelBuilder.Entity("AliasServerDb.AdminRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AdminUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LastPasswordChanged") - .HasColumnType("TEXT"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("Salt") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.Property("Verifier") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("DeviceIdentifier") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("ExpireDate") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Value") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AliasVaultUserRefreshTokens"); - }); - - modelBuilder.Entity("AliasServerDb.Email", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("DateSystem") - .HasColumnType("TEXT"); - - b.Property("From") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageHtml") - .HasColumnType("TEXT"); - - b.Property("MessagePlain") - .HasColumnType("TEXT"); - - b.Property("MessagePreview") - .HasColumnType("TEXT"); - - b.Property("MessageSource") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("PushNotificationSent") - .HasColumnType("INTEGER"); - - b.Property("Subject") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("To") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Visible") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Date"); - - b.HasIndex("DateSystem"); - - b.HasIndex("PushNotificationSent"); - - b.HasIndex("ToLocal"); - - b.HasIndex("Visible"); - - b.ToTable("Emails"); - }); - - modelBuilder.Entity("AliasServerDb.EmailAttachment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Bytes") - .IsRequired() - .HasColumnType("BLOB"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("EmailId") - .HasColumnType("INTEGER"); - - b.Property("Filename") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Filesize") - .HasColumnType("INTEGER"); - - b.Property("MimeType") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("EmailId"); - - b.ToTable("EmailAttachments"); - }); - - modelBuilder.Entity("AliasServerDb.Log", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Application") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Exception") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Level") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); - - b.Property("LogEvent") - .IsRequired() - .HasColumnType("TEXT") - .HasColumnName("LogEvent"); - - b.Property("Message") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageTemplate") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Properties") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TimeStamp") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Application"); - - b.HasIndex("TimeStamp"); - - b.ToTable("Logs", (string)null); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("VaultBlob") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Version") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Vaults"); - }); - - modelBuilder.Entity("AliasVault.WorkerStatus.WorkerServiceStatus", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CurrentStatus") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("DesiredStatus") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Heartbeat") - .HasColumnType("TEXT"); - - b.Property("ServiceName") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("varchar"); - - b.HasKey("Id"); - - b.ToTable("WorkerServiceStatuses"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("RoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("UserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.ToTable("UserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.ToTable("UserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("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.EmailAttachment", b => - { - b.HasOne("AliasServerDb.Email", "Email") - .WithMany("Attachments") - .HasForeignKey("EmailId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Email"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.Email", b => - { - b.Navigation("Attachments"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240725202058_WorkerStatusTable.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240725202058_WorkerStatusTable.cs deleted file mode 100644 index 12827ebaa..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240725202058_WorkerStatusTable.cs +++ /dev/null @@ -1,39 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - /// - public partial class WorkerStatusTable : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "WorkerServiceStatuses", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ServiceName = table.Column(type: "varchar", maxLength: 255, nullable: false), - CurrentStatus = table.Column(type: "TEXT", maxLength: 50, nullable: false), - DesiredStatus = table.Column(type: "TEXT", maxLength: 50, nullable: false), - Heartbeat = table.Column(type: "TEXT", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_WorkerServiceStatuses", x => x.Id); - }); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "WorkerServiceStatuses"); - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240728110837_AddMetadataColumns.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240728110837_AddMetadataColumns.Designer.cs deleted file mode 100644 index 9665b85d0..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240728110837_AddMetadataColumns.Designer.cs +++ /dev/null @@ -1,576 +0,0 @@ -// -using System; -using AliasServerDb; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - [DbContext(typeof(AliasServerDbContextSqlite))] - [Migration("20240728110837_AddMetadataColumns")] - partial class AddMetadataColumns - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.7") - .HasAnnotation("Proxies:ChangeTracking", false) - .HasAnnotation("Proxies:CheckEquality", false) - .HasAnnotation("Proxies:LazyLoading", true); - - modelBuilder.Entity("AliasServerDb.AdminRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AdminUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LastPasswordChanged") - .HasColumnType("TEXT"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("Salt") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.Property("Verifier") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("DeviceIdentifier") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("ExpireDate") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Value") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AliasVaultUserRefreshTokens"); - }); - - modelBuilder.Entity("AliasServerDb.Email", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("DateSystem") - .HasColumnType("TEXT"); - - b.Property("From") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageHtml") - .HasColumnType("TEXT"); - - b.Property("MessagePlain") - .HasColumnType("TEXT"); - - b.Property("MessagePreview") - .HasColumnType("TEXT"); - - b.Property("MessageSource") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("PushNotificationSent") - .HasColumnType("INTEGER"); - - b.Property("Subject") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("To") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Visible") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Date"); - - b.HasIndex("DateSystem"); - - b.HasIndex("PushNotificationSent"); - - b.HasIndex("ToLocal"); - - b.HasIndex("Visible"); - - b.ToTable("Emails"); - }); - - modelBuilder.Entity("AliasServerDb.EmailAttachment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Bytes") - .IsRequired() - .HasColumnType("BLOB"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("EmailId") - .HasColumnType("INTEGER"); - - b.Property("Filename") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Filesize") - .HasColumnType("INTEGER"); - - b.Property("MimeType") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("EmailId"); - - b.ToTable("EmailAttachments"); - }); - - modelBuilder.Entity("AliasServerDb.Log", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Application") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Exception") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Level") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); - - b.Property("LogEvent") - .IsRequired() - .HasColumnType("TEXT") - .HasColumnName("LogEvent"); - - b.Property("Message") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageTemplate") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Properties") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TimeStamp") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Application"); - - b.HasIndex("TimeStamp"); - - b.ToTable("Logs", (string)null); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("FileSize") - .HasColumnType("INTEGER"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("VaultBlob") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Version") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Vaults"); - }); - - modelBuilder.Entity("AliasVault.WorkerStatus.Database.WorkerServiceStatus", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CurrentStatus") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("DesiredStatus") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Heartbeat") - .HasColumnType("TEXT"); - - b.Property("ServiceName") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("varchar"); - - b.HasKey("Id"); - - b.ToTable("WorkerServiceStatuses"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("RoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("UserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.ToTable("UserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.ToTable("UserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("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.EmailAttachment", b => - { - b.HasOne("AliasServerDb.Email", "Email") - .WithMany("Attachments") - .HasForeignKey("EmailId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Email"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.Email", b => - { - b.Navigation("Attachments"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240728110837_AddMetadataColumns.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240728110837_AddMetadataColumns.cs deleted file mode 100644 index ce4f9346d..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240728110837_AddMetadataColumns.cs +++ /dev/null @@ -1,63 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - /// - public partial class AddMetadataColumns : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "FileSize", - table: "Vaults", - type: "INTEGER", - nullable: false, - defaultValue: 0); - - migrationBuilder.AddColumn( - name: "CreatedAt", - table: "AliasVaultUsers", - type: "TEXT", - nullable: false, - defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); - - migrationBuilder.AddColumn( - name: "UpdatedAt", - table: "AliasVaultUsers", - type: "TEXT", - nullable: false, - defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); - - // Update all existing users to have the CreatedAt and UpdatedAt set to "now". - if (migrationBuilder.IsSqlite()) - { - migrationBuilder.Sql("UPDATE AliasVaultUsers SET CreatedAt = datetime('now'), UpdatedAt = datetime('now')"); - } - else - { - migrationBuilder.Sql("UPDATE AliasVaultUsers SET CreatedAt = GETUTCDATE(), UpdatedAt = GETUTCDATE()"); - } - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "FileSize", - table: "Vaults"); - - migrationBuilder.DropColumn( - name: "CreatedAt", - table: "AliasVaultUsers"); - - migrationBuilder.DropColumn( - name: "UpdatedAt", - table: "AliasVaultUsers"); - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240729150925_AddEncryptionKeyTables.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240729150925_AddEncryptionKeyTables.Designer.cs deleted file mode 100644 index 150763bb0..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240729150925_AddEncryptionKeyTables.Designer.cs +++ /dev/null @@ -1,707 +0,0 @@ -// -using System; -using AliasServerDb; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - [DbContext(typeof(AliasServerDbContextSqlite))] - [Migration("20240729150925_AddEncryptionKeyTables")] - partial class AddEncryptionKeyTables - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.7") - .HasAnnotation("Proxies:ChangeTracking", false) - .HasAnnotation("Proxies:CheckEquality", false) - .HasAnnotation("Proxies:LazyLoading", true); - - modelBuilder.Entity("AliasServerDb.AdminRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AdminUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LastPasswordChanged") - .HasColumnType("TEXT"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("Salt") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.Property("Verifier") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("DeviceIdentifier") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("ExpireDate") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Value") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AliasVaultUserRefreshTokens"); - }); - - modelBuilder.Entity("AliasServerDb.Email", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("DateSystem") - .HasColumnType("TEXT"); - - b.Property("EncryptedSymmetricKey") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("From") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageHtml") - .HasColumnType("TEXT"); - - b.Property("MessagePlain") - .HasColumnType("TEXT"); - - b.Property("MessagePreview") - .HasColumnType("TEXT"); - - b.Property("MessageSource") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("PushNotificationSent") - .HasColumnType("INTEGER"); - - b.Property("Subject") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("To") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UserEncryptionKeyId") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Visible") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Date"); - - b.HasIndex("DateSystem"); - - b.HasIndex("PushNotificationSent"); - - b.HasIndex("ToLocal"); - - b.HasIndex("UserEncryptionKeyId"); - - b.HasIndex("Visible"); - - b.ToTable("Emails"); - }); - - modelBuilder.Entity("AliasServerDb.EmailAttachment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Bytes") - .IsRequired() - .HasColumnType("BLOB"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("EmailId") - .HasColumnType("INTEGER"); - - b.Property("Filename") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Filesize") - .HasColumnType("INTEGER"); - - b.Property("MimeType") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("EmailId"); - - b.ToTable("EmailAttachments"); - }); - - modelBuilder.Entity("AliasServerDb.Log", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Application") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Exception") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Level") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); - - b.Property("LogEvent") - .IsRequired() - .HasColumnType("TEXT") - .HasColumnName("LogEvent"); - - b.Property("Message") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageTemplate") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Properties") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TimeStamp") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Application"); - - b.HasIndex("TimeStamp"); - - b.ToTable("Logs", (string)null); - }); - - modelBuilder.Entity("AliasServerDb.UserEmailClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("Address") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("AddressDomain") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("AddressLocal") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Address") - .IsUnique(); - - b.HasIndex("UserId"); - - b.ToTable("UserEmailClaims"); - }); - - modelBuilder.Entity("AliasServerDb.UserEncryptionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("IsPrimary") - .HasColumnType("INTEGER"); - - b.Property("PublicKey") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserEncryptionKeys"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("FileSize") - .HasColumnType("INTEGER"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("VaultBlob") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Version") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Vaults"); - }); - - modelBuilder.Entity("AliasVault.WorkerStatus.Database.WorkerServiceStatus", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CurrentStatus") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("DesiredStatus") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Heartbeat") - .HasColumnType("TEXT"); - - b.Property("ServiceName") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("varchar"); - - b.HasKey("Id"); - - b.ToTable("WorkerServiceStatuses"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("RoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("UserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.ToTable("UserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.ToTable("UserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("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.NoAction) - .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.UserEmailClaim", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("EmailClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.UserEncryptionKey", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("EncryptionKeys") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("Vaults") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Navigation("EmailClaims"); - - b.Navigation("EncryptionKeys"); - - b.Navigation("Vaults"); - }); - - 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/SqliteMigrations/20240729150925_AddEncryptionKeyTables.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240729150925_AddEncryptionKeyTables.cs deleted file mode 100644 index b001f5552..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240729150925_AddEncryptionKeyTables.cs +++ /dev/null @@ -1,133 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - /// - public partial class AddEncryptionKeyTables : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - // Delete all records from the Email table as adding PKI will break the existing data. - migrationBuilder.Sql("DELETE FROM Emails"); - - migrationBuilder.AddColumn( - name: "EncryptedSymmetricKey", - table: "Emails", - type: "TEXT", - nullable: false, - defaultValue: ""); - - migrationBuilder.AddColumn( - name: "UserEncryptionKeyId", - table: "Emails", - type: "TEXT", - maxLength: 255, - nullable: false, - defaultValue: new Guid("00000000-0000-0000-0000-000000000000")); - - migrationBuilder.CreateTable( - name: "UserEmailClaims", - columns: table => new - { - Id = table.Column(type: "TEXT", nullable: false), - UserId = table.Column(type: "TEXT", maxLength: 255, nullable: false), - Address = table.Column(type: "TEXT", maxLength: 255, nullable: false), - AddressLocal = table.Column(type: "TEXT", maxLength: 255, nullable: false), - AddressDomain = table.Column(type: "TEXT", maxLength: 255, nullable: false), - CreatedAt = table.Column(type: "TEXT", nullable: false), - UpdatedAt = table.Column(type: "TEXT", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_UserEmailClaims", x => x.Id); - table.ForeignKey( - name: "FK_UserEmailClaims_AliasVaultUsers_UserId", - column: x => x.UserId, - principalTable: "AliasVaultUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "UserEncryptionKeys", - columns: table => new - { - Id = table.Column(type: "TEXT", nullable: false), - UserId = table.Column(type: "TEXT", maxLength: 255, nullable: false), - PublicKey = table.Column(type: "TEXT", maxLength: 2000, nullable: false), - IsPrimary = table.Column(type: "INTEGER", nullable: false), - CreatedAt = table.Column(type: "TEXT", nullable: false), - UpdatedAt = table.Column(type: "TEXT", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_UserEncryptionKeys", x => x.Id); - table.ForeignKey( - name: "FK_UserEncryptionKeys_AliasVaultUsers_UserId", - column: x => x.UserId, - principalTable: "AliasVaultUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_Emails_UserEncryptionKeyId", - table: "Emails", - column: "UserEncryptionKeyId"); - - migrationBuilder.CreateIndex( - name: "IX_UserEmailClaims_Address", - table: "UserEmailClaims", - column: "Address", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_UserEmailClaims_UserId", - table: "UserEmailClaims", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_UserEncryptionKeys_UserId", - table: "UserEncryptionKeys", - column: "UserId"); - - migrationBuilder.AddForeignKey( - name: "FK_Emails_UserEncryptionKeys_UserEncryptionKeyId", - table: "Emails", - column: "UserEncryptionKeyId", - principalTable: "UserEncryptionKeys", - principalColumn: "Id"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Emails_UserEncryptionKeys_UserEncryptionKeyId", - table: "Emails"); - - migrationBuilder.DropTable( - name: "UserEmailClaims"); - - migrationBuilder.DropTable( - name: "UserEncryptionKeys"); - - migrationBuilder.DropIndex( - name: "IX_Emails_UserEncryptionKeyId", - table: "Emails"); - - migrationBuilder.DropColumn( - name: "EncryptedSymmetricKey", - table: "Emails"); - - migrationBuilder.DropColumn( - name: "UserEncryptionKeyId", - table: "Emails"); - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240821164021_AddDataProtectionDatabaseTable.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240821164021_AddDataProtectionDatabaseTable.Designer.cs deleted file mode 100644 index af2e8f23f..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240821164021_AddDataProtectionDatabaseTable.Designer.cs +++ /dev/null @@ -1,724 +0,0 @@ -// -using System; -using AliasServerDb; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - [DbContext(typeof(AliasServerDbContextSqlite))] - [Migration("20240821164021_AddDataProtectionDatabaseTable")] - partial class AddDataProtectionDatabaseTable - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.8") - .HasAnnotation("Proxies:ChangeTracking", false) - .HasAnnotation("Proxies:CheckEquality", false) - .HasAnnotation("Proxies:LazyLoading", true); - - modelBuilder.Entity("AliasServerDb.AdminRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AdminUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LastPasswordChanged") - .HasColumnType("TEXT"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("Salt") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.Property("Verifier") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("DeviceIdentifier") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("ExpireDate") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Value") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AliasVaultUserRefreshTokens"); - }); - - modelBuilder.Entity("AliasServerDb.Email", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("DateSystem") - .HasColumnType("TEXT"); - - b.Property("EncryptedSymmetricKey") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("From") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageHtml") - .HasColumnType("TEXT"); - - b.Property("MessagePlain") - .HasColumnType("TEXT"); - - b.Property("MessagePreview") - .HasColumnType("TEXT"); - - b.Property("MessageSource") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("PushNotificationSent") - .HasColumnType("INTEGER"); - - b.Property("Subject") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("To") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UserEncryptionKeyId") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Visible") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Date"); - - b.HasIndex("DateSystem"); - - b.HasIndex("PushNotificationSent"); - - b.HasIndex("ToLocal"); - - b.HasIndex("UserEncryptionKeyId"); - - b.HasIndex("Visible"); - - b.ToTable("Emails"); - }); - - modelBuilder.Entity("AliasServerDb.EmailAttachment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Bytes") - .IsRequired() - .HasColumnType("BLOB"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("EmailId") - .HasColumnType("INTEGER"); - - b.Property("Filename") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Filesize") - .HasColumnType("INTEGER"); - - b.Property("MimeType") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("EmailId"); - - b.ToTable("EmailAttachments"); - }); - - modelBuilder.Entity("AliasServerDb.Log", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Application") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Exception") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Level") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); - - b.Property("LogEvent") - .IsRequired() - .HasColumnType("TEXT") - .HasColumnName("LogEvent"); - - b.Property("Message") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageTemplate") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Properties") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TimeStamp") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Application"); - - b.HasIndex("TimeStamp"); - - b.ToTable("Logs", (string)null); - }); - - modelBuilder.Entity("AliasServerDb.UserEmailClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("Address") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("AddressDomain") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("AddressLocal") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Address") - .IsUnique(); - - b.HasIndex("UserId"); - - b.ToTable("UserEmailClaims"); - }); - - modelBuilder.Entity("AliasServerDb.UserEncryptionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("IsPrimary") - .HasColumnType("INTEGER"); - - b.Property("PublicKey") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserEncryptionKeys"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("FileSize") - .HasColumnType("INTEGER"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("VaultBlob") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Version") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Vaults"); - }); - - modelBuilder.Entity("AliasVault.WorkerStatus.Database.WorkerServiceStatus", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CurrentStatus") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("DesiredStatus") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Heartbeat") - .HasColumnType("TEXT"); - - b.Property("ServiceName") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("varchar"); - - b.HasKey("Id"); - - b.ToTable("WorkerServiceStatuses"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("FriendlyName") - .HasColumnType("TEXT"); - - b.Property("Xml") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("DataProtectionKeys"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("RoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("UserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.ToTable("UserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.ToTable("UserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("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.NoAction) - .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.UserEmailClaim", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("EmailClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.UserEncryptionKey", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("EncryptionKeys") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("Vaults") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Navigation("EmailClaims"); - - b.Navigation("EncryptionKeys"); - - b.Navigation("Vaults"); - }); - - 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/SqliteMigrations/20240821164021_AddDataProtectionDatabaseTable.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240821164021_AddDataProtectionDatabaseTable.cs deleted file mode 100644 index 4ae5cd27e..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240821164021_AddDataProtectionDatabaseTable.cs +++ /dev/null @@ -1,36 +0,0 @@ -// -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - /// - public partial class AddDataProtectionDatabaseTable : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "DataProtectionKeys", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - FriendlyName = table.Column(type: "TEXT", nullable: true), - Xml = table.Column(type: "TEXT", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_DataProtectionKeys", x => x.Id); - }); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "DataProtectionKeys"); - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240821204113_UpdateLogTable.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240821204113_UpdateLogTable.Designer.cs deleted file mode 100644 index 8d6457e9b..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240821204113_UpdateLogTable.Designer.cs +++ /dev/null @@ -1,728 +0,0 @@ -// -using System; -using AliasServerDb; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - [DbContext(typeof(AliasServerDbContextSqlite))] - [Migration("20240821204113_UpdateLogTable")] - partial class UpdateLogTable - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.8") - .HasAnnotation("Proxies:ChangeTracking", false) - .HasAnnotation("Proxies:CheckEquality", false) - .HasAnnotation("Proxies:LazyLoading", true); - - modelBuilder.Entity("AliasServerDb.AdminRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AdminUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LastPasswordChanged") - .HasColumnType("TEXT"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("Salt") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.Property("Verifier") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("DeviceIdentifier") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("ExpireDate") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Value") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AliasVaultUserRefreshTokens"); - }); - - modelBuilder.Entity("AliasServerDb.Email", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("DateSystem") - .HasColumnType("TEXT"); - - b.Property("EncryptedSymmetricKey") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("From") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageHtml") - .HasColumnType("TEXT"); - - b.Property("MessagePlain") - .HasColumnType("TEXT"); - - b.Property("MessagePreview") - .HasColumnType("TEXT"); - - b.Property("MessageSource") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("PushNotificationSent") - .HasColumnType("INTEGER"); - - b.Property("Subject") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("To") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UserEncryptionKeyId") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Visible") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Date"); - - b.HasIndex("DateSystem"); - - b.HasIndex("PushNotificationSent"); - - b.HasIndex("ToLocal"); - - b.HasIndex("UserEncryptionKeyId"); - - b.HasIndex("Visible"); - - b.ToTable("Emails"); - }); - - modelBuilder.Entity("AliasServerDb.EmailAttachment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Bytes") - .IsRequired() - .HasColumnType("BLOB"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("EmailId") - .HasColumnType("INTEGER"); - - b.Property("Filename") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Filesize") - .HasColumnType("INTEGER"); - - b.Property("MimeType") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("EmailId"); - - b.ToTable("EmailAttachments"); - }); - - modelBuilder.Entity("AliasServerDb.Log", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Application") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Exception") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Level") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); - - b.Property("LogEvent") - .IsRequired() - .HasColumnType("TEXT") - .HasColumnName("LogEvent"); - - b.Property("Message") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageTemplate") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Properties") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("SourceContext") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TimeStamp") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Application"); - - b.HasIndex("TimeStamp"); - - b.ToTable("Logs", (string)null); - }); - - modelBuilder.Entity("AliasServerDb.UserEmailClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("Address") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("AddressDomain") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("AddressLocal") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Address") - .IsUnique(); - - b.HasIndex("UserId"); - - b.ToTable("UserEmailClaims"); - }); - - modelBuilder.Entity("AliasServerDb.UserEncryptionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("IsPrimary") - .HasColumnType("INTEGER"); - - b.Property("PublicKey") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserEncryptionKeys"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("FileSize") - .HasColumnType("INTEGER"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("VaultBlob") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Version") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Vaults"); - }); - - modelBuilder.Entity("AliasVault.WorkerStatus.Database.WorkerServiceStatus", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CurrentStatus") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("DesiredStatus") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Heartbeat") - .HasColumnType("TEXT"); - - b.Property("ServiceName") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("varchar"); - - b.HasKey("Id"); - - b.ToTable("WorkerServiceStatuses"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("FriendlyName") - .HasColumnType("TEXT"); - - b.Property("Xml") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("DataProtectionKeys"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("RoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("UserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.ToTable("UserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.ToTable("UserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("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.NoAction) - .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.UserEmailClaim", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("EmailClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.UserEncryptionKey", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("EncryptionKeys") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("Vaults") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Navigation("EmailClaims"); - - b.Navigation("EncryptionKeys"); - - b.Navigation("Vaults"); - }); - - 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/SqliteMigrations/20240821204113_UpdateLogTable.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240821204113_UpdateLogTable.cs deleted file mode 100644 index 52af9e2de..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240821204113_UpdateLogTable.cs +++ /dev/null @@ -1,30 +0,0 @@ -// -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - /// - public partial class UpdateLogTable : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "SourceContext", - table: "Logs", - type: "TEXT", - nullable: false, - defaultValue: ""); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "SourceContext", - table: "Logs"); - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240830190840_AddAuthLogTable.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240830190840_AddAuthLogTable.Designer.cs deleted file mode 100644 index 19ba838bd..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240830190840_AddAuthLogTable.Designer.cs +++ /dev/null @@ -1,803 +0,0 @@ -// -using System; -using AliasServerDb; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - [DbContext(typeof(AliasServerDbContextSqlite))] - [Migration("20240830190840_AddAuthLogTable")] - partial class AddAuthLogTable - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.8") - .HasAnnotation("Proxies:ChangeTracking", false) - .HasAnnotation("Proxies:CheckEquality", false) - .HasAnnotation("Proxies:LazyLoading", true); - - modelBuilder.Entity("AliasServerDb.AdminRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AdminUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LastPasswordChanged") - .HasColumnType("TEXT"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("Salt") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.Property("Verifier") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("DeviceIdentifier") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("ExpireDate") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Value") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AliasVaultUserRefreshTokens"); - }); - - modelBuilder.Entity("AliasServerDb.AuthLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AdditionalInfo") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Browser") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("Country") - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("DeviceType") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("EventType") - .HasColumnType("nvarchar(50)"); - - b.Property("FailureReason") - .HasColumnType("INTEGER"); - - b.Property("IpAddress") - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("IsSuccess") - .HasColumnType("INTEGER"); - - b.Property("IsSuspiciousActivity") - .HasColumnType("INTEGER"); - - b.Property("OperatingSystem") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("RequestPath") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("Timestamp") - .HasColumnType("TEXT"); - - b.Property("UserAgent") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - 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.Email", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("DateSystem") - .HasColumnType("TEXT"); - - b.Property("EncryptedSymmetricKey") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("From") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageHtml") - .HasColumnType("TEXT"); - - b.Property("MessagePlain") - .HasColumnType("TEXT"); - - b.Property("MessagePreview") - .HasColumnType("TEXT"); - - b.Property("MessageSource") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("PushNotificationSent") - .HasColumnType("INTEGER"); - - b.Property("Subject") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("To") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UserEncryptionKeyId") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Visible") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Date"); - - b.HasIndex("DateSystem"); - - b.HasIndex("PushNotificationSent"); - - b.HasIndex("ToLocal"); - - b.HasIndex("UserEncryptionKeyId"); - - b.HasIndex("Visible"); - - b.ToTable("Emails"); - }); - - modelBuilder.Entity("AliasServerDb.EmailAttachment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Bytes") - .IsRequired() - .HasColumnType("BLOB"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("EmailId") - .HasColumnType("INTEGER"); - - b.Property("Filename") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Filesize") - .HasColumnType("INTEGER"); - - b.Property("MimeType") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("EmailId"); - - b.ToTable("EmailAttachments"); - }); - - modelBuilder.Entity("AliasServerDb.Log", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Application") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Exception") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Level") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); - - b.Property("LogEvent") - .IsRequired() - .HasColumnType("TEXT") - .HasColumnName("LogEvent"); - - b.Property("Message") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageTemplate") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Properties") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("SourceContext") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TimeStamp") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Application"); - - b.HasIndex("TimeStamp"); - - b.ToTable("Logs", (string)null); - }); - - modelBuilder.Entity("AliasServerDb.UserEmailClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("Address") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("AddressDomain") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("AddressLocal") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Address") - .IsUnique(); - - b.HasIndex("UserId"); - - b.ToTable("UserEmailClaims"); - }); - - modelBuilder.Entity("AliasServerDb.UserEncryptionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("IsPrimary") - .HasColumnType("INTEGER"); - - b.Property("PublicKey") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserEncryptionKeys"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("FileSize") - .HasColumnType("INTEGER"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("VaultBlob") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Version") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Vaults"); - }); - - modelBuilder.Entity("AliasVault.WorkerStatus.Database.WorkerServiceStatus", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CurrentStatus") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("DesiredStatus") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Heartbeat") - .HasColumnType("TEXT"); - - b.Property("ServiceName") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("varchar"); - - b.HasKey("Id"); - - b.ToTable("WorkerServiceStatuses"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("FriendlyName") - .HasColumnType("TEXT"); - - b.Property("Xml") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("DataProtectionKeys"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("RoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("UserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.ToTable("UserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.ToTable("UserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("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.NoAction) - .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.UserEmailClaim", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("EmailClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.UserEncryptionKey", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("EncryptionKeys") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("Vaults") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Navigation("EmailClaims"); - - b.Navigation("EncryptionKeys"); - - b.Navigation("Vaults"); - }); - - 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/SqliteMigrations/20240830190840_AddAuthLogTable.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240830190840_AddAuthLogTable.cs deleted file mode 100644 index 53cfaa3dc..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240830190840_AddAuthLogTable.cs +++ /dev/null @@ -1,76 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - /// - public partial class AddAuthLogTable : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "AuthLogs", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Timestamp = table.Column(type: "TEXT", nullable: false), - Username = table.Column(type: "TEXT", maxLength: 255, nullable: false), - EventType = table.Column(type: "nvarchar(50)", nullable: false), - IsSuccess = table.Column(type: "INTEGER", nullable: false), - FailureReason = table.Column(type: "INTEGER", nullable: true), - IpAddress = table.Column(type: "TEXT", maxLength: 50, nullable: true), - UserAgent = table.Column(type: "TEXT", maxLength: 255, nullable: true), - DeviceType = table.Column(type: "TEXT", maxLength: 100, nullable: true), - OperatingSystem = table.Column(type: "TEXT", maxLength: 100, nullable: true), - Browser = table.Column(type: "TEXT", maxLength: 100, nullable: true), - Country = table.Column(type: "TEXT", maxLength: 50, nullable: true), - AdditionalInfo = table.Column(type: "TEXT", maxLength: 255, nullable: true), - RequestPath = table.Column(type: "TEXT", maxLength: 100, nullable: true), - IsSuspiciousActivity = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AuthLogs", x => x.Id); - }); - - migrationBuilder.CreateIndex( - name: "IX_EventType", - table: "AuthLogs", - column: "EventType"); - - migrationBuilder.CreateIndex( - name: "IX_IpAddress", - table: "AuthLogs", - column: "IpAddress"); - - migrationBuilder.CreateIndex( - name: "IX_Timestamp", - table: "AuthLogs", - column: "Timestamp"); - - migrationBuilder.CreateIndex( - name: "IX_Username_IsSuccess_Timestamp", - table: "AuthLogs", - columns: new[] { "Username", "IsSuccess", "Timestamp" }, - descending: new[] { false, false, true }); - - migrationBuilder.CreateIndex( - name: "IX_Username_Timestamp", - table: "AuthLogs", - columns: new[] { "Username", "Timestamp" }, - descending: new[] { false, true }); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "AuthLogs"); - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240902134755_MoveSrpColsToVaultTable.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240902134755_MoveSrpColsToVaultTable.Designer.cs deleted file mode 100644 index a68926d5c..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240902134755_MoveSrpColsToVaultTable.Designer.cs +++ /dev/null @@ -1,813 +0,0 @@ -// -using System; -using AliasServerDb; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - [DbContext(typeof(AliasServerDbContextSqlite))] - [Migration("20240902134755_MoveSrpColsToVaultTable")] - partial class MoveSrpColsToVaultTable - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.8") - .HasAnnotation("Proxies:ChangeTracking", false) - .HasAnnotation("Proxies:CheckEquality", false) - .HasAnnotation("Proxies:LazyLoading", true); - - modelBuilder.Entity("AliasServerDb.AdminRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AdminUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LastPasswordChanged") - .HasColumnType("TEXT"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("Salt") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.Property("Verifier") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("DeviceIdentifier") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("ExpireDate") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Value") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AliasVaultUserRefreshTokens"); - }); - - modelBuilder.Entity("AliasServerDb.AuthLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AdditionalInfo") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Browser") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("Country") - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("DeviceType") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("EventType") - .HasColumnType("nvarchar(50)"); - - b.Property("FailureReason") - .HasColumnType("INTEGER"); - - b.Property("IpAddress") - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("IsSuccess") - .HasColumnType("INTEGER"); - - b.Property("IsSuspiciousActivity") - .HasColumnType("INTEGER"); - - b.Property("OperatingSystem") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("RequestPath") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("Timestamp") - .HasColumnType("TEXT"); - - b.Property("UserAgent") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - 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.Email", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("DateSystem") - .HasColumnType("TEXT"); - - b.Property("EncryptedSymmetricKey") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("From") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageHtml") - .HasColumnType("TEXT"); - - b.Property("MessagePlain") - .HasColumnType("TEXT"); - - b.Property("MessagePreview") - .HasColumnType("TEXT"); - - b.Property("MessageSource") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("PushNotificationSent") - .HasColumnType("INTEGER"); - - b.Property("Subject") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("To") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UserEncryptionKeyId") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Visible") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Date"); - - b.HasIndex("DateSystem"); - - b.HasIndex("PushNotificationSent"); - - b.HasIndex("ToLocal"); - - b.HasIndex("UserEncryptionKeyId"); - - b.HasIndex("Visible"); - - b.ToTable("Emails"); - }); - - modelBuilder.Entity("AliasServerDb.EmailAttachment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Bytes") - .IsRequired() - .HasColumnType("BLOB"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("EmailId") - .HasColumnType("INTEGER"); - - b.Property("Filename") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Filesize") - .HasColumnType("INTEGER"); - - b.Property("MimeType") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("EmailId"); - - b.ToTable("EmailAttachments"); - }); - - modelBuilder.Entity("AliasServerDb.Log", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Application") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Exception") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Level") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); - - b.Property("LogEvent") - .IsRequired() - .HasColumnType("TEXT") - .HasColumnName("LogEvent"); - - b.Property("Message") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageTemplate") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Properties") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("SourceContext") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TimeStamp") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Application"); - - b.HasIndex("TimeStamp"); - - b.ToTable("Logs", (string)null); - }); - - modelBuilder.Entity("AliasServerDb.UserEmailClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("Address") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("AddressDomain") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("AddressLocal") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Address") - .IsUnique(); - - b.HasIndex("UserId"); - - b.ToTable("UserEmailClaims"); - }); - - modelBuilder.Entity("AliasServerDb.UserEncryptionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("IsPrimary") - .HasColumnType("INTEGER"); - - b.Property("PublicKey") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserEncryptionKeys"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("FileSize") - .HasColumnType("INTEGER"); - - b.Property("Salt") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("VaultBlob") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Verifier") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("TEXT"); - - b.Property("Version") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Vaults"); - }); - - modelBuilder.Entity("AliasVault.WorkerStatus.Database.WorkerServiceStatus", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CurrentStatus") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("DesiredStatus") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Heartbeat") - .HasColumnType("TEXT"); - - b.Property("ServiceName") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("varchar"); - - b.HasKey("Id"); - - b.ToTable("WorkerServiceStatuses"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("FriendlyName") - .HasColumnType("TEXT"); - - b.Property("Xml") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("DataProtectionKeys"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("RoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("UserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.ToTable("UserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.ToTable("UserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("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.NoAction) - .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.UserEmailClaim", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("EmailClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.UserEncryptionKey", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("EncryptionKeys") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("Vaults") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Navigation("EmailClaims"); - - b.Navigation("EncryptionKeys"); - - b.Navigation("Vaults"); - }); - - 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/SqliteMigrations/20240902134755_MoveSrpColsToVaultTable.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240902134755_MoveSrpColsToVaultTable.cs deleted file mode 100644 index 4c5703a1b..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240902134755_MoveSrpColsToVaultTable.cs +++ /dev/null @@ -1,66 +0,0 @@ -// -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - /// - public partial class MoveSrpColsToVaultTable : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "Salt", - table: "Vaults", - type: "TEXT", - maxLength: 100, - nullable: false, - defaultValue: ""); - - migrationBuilder.AddColumn( - name: "Verifier", - table: "Vaults", - type: "TEXT", - maxLength: 1000, - nullable: false, - defaultValue: ""); - - // Transfer data from AliasVaultUsers to Vaults - migrationBuilder.Sql(@" - UPDATE Vaults - SET Salt = (SELECT Salt FROM AliasVaultUsers WHERE AliasVaultUsers.Id = Vaults.UserId), - Verifier = (SELECT Verifier FROM AliasVaultUsers WHERE AliasVaultUsers.Id = Vaults.UserId) - WHERE EXISTS (SELECT 1 FROM AliasVaultUsers WHERE AliasVaultUsers.Id = Vaults.UserId); - "); - - // Create new vault entries for users without existing vaults - migrationBuilder.Sql(@" - INSERT INTO Vaults (UserId, VaultBlob, Version, Salt, Verifier, CreatedAt, UpdatedAt) - SELECT - Id, - '', - '0.0.0', - Salt, - Verifier, - DATETIME('now'), - DATETIME('now') - FROM AliasVaultUsers - WHERE Id NOT IN (SELECT DISTINCT UserId FROM Vaults); - "); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Salt", - table: "Vaults"); - - migrationBuilder.DropColumn( - name: "Verifier", - table: "Vaults"); - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240902172644_RemoveSrpColsFromUserTable.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240902172644_RemoveSrpColsFromUserTable.Designer.cs deleted file mode 100644 index 396033160..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240902172644_RemoveSrpColsFromUserTable.Designer.cs +++ /dev/null @@ -1,806 +0,0 @@ -// -using System; -using AliasServerDb; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - [DbContext(typeof(AliasServerDbContextSqlite))] - [Migration("20240902172644_RemoveSrpColsFromUserTable")] - partial class RemoveSrpColsFromUserTable - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.8") - .HasAnnotation("Proxies:ChangeTracking", false) - .HasAnnotation("Proxies:CheckEquality", false) - .HasAnnotation("Proxies:LazyLoading", true); - - modelBuilder.Entity("AliasServerDb.AdminRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AdminUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LastPasswordChanged") - .HasColumnType("TEXT"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordChangedAt") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("DeviceIdentifier") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("ExpireDate") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Value") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AliasVaultUserRefreshTokens"); - }); - - modelBuilder.Entity("AliasServerDb.AuthLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AdditionalInfo") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Browser") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("Country") - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("DeviceType") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("EventType") - .HasColumnType("nvarchar(50)"); - - b.Property("FailureReason") - .HasColumnType("INTEGER"); - - b.Property("IpAddress") - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("IsSuccess") - .HasColumnType("INTEGER"); - - b.Property("IsSuspiciousActivity") - .HasColumnType("INTEGER"); - - b.Property("OperatingSystem") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("RequestPath") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("Timestamp") - .HasColumnType("TEXT"); - - b.Property("UserAgent") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - 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.Email", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("DateSystem") - .HasColumnType("TEXT"); - - b.Property("EncryptedSymmetricKey") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("From") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageHtml") - .HasColumnType("TEXT"); - - b.Property("MessagePlain") - .HasColumnType("TEXT"); - - b.Property("MessagePreview") - .HasColumnType("TEXT"); - - b.Property("MessageSource") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("PushNotificationSent") - .HasColumnType("INTEGER"); - - b.Property("Subject") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("To") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UserEncryptionKeyId") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Visible") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Date"); - - b.HasIndex("DateSystem"); - - b.HasIndex("PushNotificationSent"); - - b.HasIndex("ToLocal"); - - b.HasIndex("UserEncryptionKeyId"); - - b.HasIndex("Visible"); - - b.ToTable("Emails"); - }); - - modelBuilder.Entity("AliasServerDb.EmailAttachment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Bytes") - .IsRequired() - .HasColumnType("BLOB"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("EmailId") - .HasColumnType("INTEGER"); - - b.Property("Filename") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Filesize") - .HasColumnType("INTEGER"); - - b.Property("MimeType") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("EmailId"); - - b.ToTable("EmailAttachments"); - }); - - modelBuilder.Entity("AliasServerDb.Log", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Application") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Exception") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Level") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); - - b.Property("LogEvent") - .IsRequired() - .HasColumnType("TEXT") - .HasColumnName("LogEvent"); - - b.Property("Message") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageTemplate") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Properties") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("SourceContext") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TimeStamp") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Application"); - - b.HasIndex("TimeStamp"); - - b.ToTable("Logs", (string)null); - }); - - modelBuilder.Entity("AliasServerDb.UserEmailClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("Address") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("AddressDomain") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("AddressLocal") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Address") - .IsUnique(); - - b.HasIndex("UserId"); - - b.ToTable("UserEmailClaims"); - }); - - modelBuilder.Entity("AliasServerDb.UserEncryptionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("IsPrimary") - .HasColumnType("INTEGER"); - - b.Property("PublicKey") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserEncryptionKeys"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("FileSize") - .HasColumnType("INTEGER"); - - b.Property("Salt") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("VaultBlob") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Verifier") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("TEXT"); - - b.Property("Version") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Vaults"); - }); - - modelBuilder.Entity("AliasVault.WorkerStatus.Database.WorkerServiceStatus", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CurrentStatus") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("DesiredStatus") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Heartbeat") - .HasColumnType("TEXT"); - - b.Property("ServiceName") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("varchar"); - - b.HasKey("Id"); - - b.ToTable("WorkerServiceStatuses"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("FriendlyName") - .HasColumnType("TEXT"); - - b.Property("Xml") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("DataProtectionKeys"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("RoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("UserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.ToTable("UserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.ToTable("UserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("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.NoAction) - .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.UserEmailClaim", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("EmailClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.UserEncryptionKey", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("EncryptionKeys") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("Vaults") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Navigation("EmailClaims"); - - b.Navigation("EncryptionKeys"); - - b.Navigation("Vaults"); - }); - - 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/SqliteMigrations/20240902172644_RemoveSrpColsFromUserTable.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240902172644_RemoveSrpColsFromUserTable.cs deleted file mode 100644 index 0096eed69..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240902172644_RemoveSrpColsFromUserTable.cs +++ /dev/null @@ -1,55 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - /// - public partial class RemoveSrpColsFromUserTable : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Salt", - table: "AliasVaultUsers"); - - migrationBuilder.DropColumn( - name: "Verifier", - table: "AliasVaultUsers"); - - migrationBuilder.AddColumn( - name: "PasswordChangedAt", - table: "AliasVaultUsers", - type: "TEXT", - nullable: false, - defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "PasswordChangedAt", - table: "AliasVaultUsers"); - - migrationBuilder.AddColumn( - name: "Salt", - table: "AliasVaultUsers", - type: "TEXT", - maxLength: 100, - nullable: false, - defaultValue: ""); - - migrationBuilder.AddColumn( - name: "Verifier", - table: "AliasVaultUsers", - type: "TEXT", - maxLength: 1000, - nullable: false, - defaultValue: ""); - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240906092833_AddVaultStatisticsColumns.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240906092833_AddVaultStatisticsColumns.Designer.cs deleted file mode 100644 index 554a81c63..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240906092833_AddVaultStatisticsColumns.Designer.cs +++ /dev/null @@ -1,812 +0,0 @@ -// -using System; -using AliasServerDb; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - [DbContext(typeof(AliasServerDbContextSqlite))] - [Migration("20240906092833_AddVaultStatisticsColumns")] - partial class AddVaultStatisticsColumns - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.8") - .HasAnnotation("Proxies:ChangeTracking", false) - .HasAnnotation("Proxies:CheckEquality", false) - .HasAnnotation("Proxies:LazyLoading", true); - - modelBuilder.Entity("AliasServerDb.AdminRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AdminUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LastPasswordChanged") - .HasColumnType("TEXT"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordChangedAt") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("DeviceIdentifier") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("ExpireDate") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Value") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AliasVaultUserRefreshTokens"); - }); - - modelBuilder.Entity("AliasServerDb.AuthLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AdditionalInfo") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Browser") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("Country") - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("DeviceType") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("EventType") - .HasColumnType("nvarchar(50)"); - - b.Property("FailureReason") - .HasColumnType("INTEGER"); - - b.Property("IpAddress") - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("IsSuccess") - .HasColumnType("INTEGER"); - - b.Property("IsSuspiciousActivity") - .HasColumnType("INTEGER"); - - b.Property("OperatingSystem") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("RequestPath") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("Timestamp") - .HasColumnType("TEXT"); - - b.Property("UserAgent") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - 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.Email", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("DateSystem") - .HasColumnType("TEXT"); - - b.Property("EncryptedSymmetricKey") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("From") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageHtml") - .HasColumnType("TEXT"); - - b.Property("MessagePlain") - .HasColumnType("TEXT"); - - b.Property("MessagePreview") - .HasColumnType("TEXT"); - - b.Property("MessageSource") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("PushNotificationSent") - .HasColumnType("INTEGER"); - - b.Property("Subject") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("To") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UserEncryptionKeyId") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Visible") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Date"); - - b.HasIndex("DateSystem"); - - b.HasIndex("PushNotificationSent"); - - b.HasIndex("ToLocal"); - - b.HasIndex("UserEncryptionKeyId"); - - b.HasIndex("Visible"); - - b.ToTable("Emails"); - }); - - modelBuilder.Entity("AliasServerDb.EmailAttachment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Bytes") - .IsRequired() - .HasColumnType("BLOB"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("EmailId") - .HasColumnType("INTEGER"); - - b.Property("Filename") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Filesize") - .HasColumnType("INTEGER"); - - b.Property("MimeType") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("EmailId"); - - b.ToTable("EmailAttachments"); - }); - - modelBuilder.Entity("AliasServerDb.Log", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Application") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Exception") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Level") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); - - b.Property("LogEvent") - .IsRequired() - .HasColumnType("TEXT") - .HasColumnName("LogEvent"); - - b.Property("Message") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageTemplate") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Properties") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("SourceContext") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TimeStamp") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Application"); - - b.HasIndex("TimeStamp"); - - b.ToTable("Logs", (string)null); - }); - - modelBuilder.Entity("AliasServerDb.UserEmailClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("Address") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("AddressDomain") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("AddressLocal") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Address") - .IsUnique(); - - b.HasIndex("UserId"); - - b.ToTable("UserEmailClaims"); - }); - - modelBuilder.Entity("AliasServerDb.UserEncryptionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("IsPrimary") - .HasColumnType("INTEGER"); - - b.Property("PublicKey") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserEncryptionKeys"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("CredentialsCount") - .HasColumnType("INTEGER"); - - b.Property("EmailClaimsCount") - .HasColumnType("INTEGER"); - - b.Property("FileSize") - .HasColumnType("INTEGER"); - - b.Property("Salt") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("VaultBlob") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Verifier") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("TEXT"); - - b.Property("Version") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Vaults"); - }); - - modelBuilder.Entity("AliasVault.WorkerStatus.Database.WorkerServiceStatus", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CurrentStatus") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("DesiredStatus") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Heartbeat") - .HasColumnType("TEXT"); - - b.Property("ServiceName") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("varchar"); - - b.HasKey("Id"); - - b.ToTable("WorkerServiceStatuses"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("FriendlyName") - .HasColumnType("TEXT"); - - b.Property("Xml") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("DataProtectionKeys"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("RoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("UserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.ToTable("UserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.ToTable("UserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("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.NoAction) - .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.UserEmailClaim", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("EmailClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.UserEncryptionKey", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("EncryptionKeys") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("Vaults") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Navigation("EmailClaims"); - - b.Navigation("EncryptionKeys"); - - b.Navigation("Vaults"); - }); - - 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/SqliteMigrations/20240906092833_AddVaultStatisticsColumns.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240906092833_AddVaultStatisticsColumns.cs deleted file mode 100644 index 61ac12095..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240906092833_AddVaultStatisticsColumns.cs +++ /dev/null @@ -1,41 +0,0 @@ -// -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - /// - public partial class AddVaultStatisticsColumns : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "CredentialsCount", - table: "Vaults", - type: "INTEGER", - nullable: false, - defaultValue: 0); - - migrationBuilder.AddColumn( - name: "EmailClaimsCount", - table: "Vaults", - type: "INTEGER", - nullable: false, - defaultValue: 0); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "CredentialsCount", - table: "Vaults"); - - migrationBuilder.DropColumn( - name: "EmailClaimsCount", - table: "Vaults"); - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240911174159_AddVaultEncryptionSettings.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240911174159_AddVaultEncryptionSettings.Designer.cs deleted file mode 100644 index 87895af1d..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240911174159_AddVaultEncryptionSettings.Designer.cs +++ /dev/null @@ -1,820 +0,0 @@ -// -using System; -using AliasServerDb; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - [DbContext(typeof(AliasServerDbContextSqlite))] - [Migration("20240911174159_AddVaultEncryptionSettings")] - partial class AddVaultEncryptionSettings - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.8") - .HasAnnotation("Proxies:ChangeTracking", false) - .HasAnnotation("Proxies:CheckEquality", false) - .HasAnnotation("Proxies:LazyLoading", true); - - modelBuilder.Entity("AliasServerDb.AdminRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AdminUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LastPasswordChanged") - .HasColumnType("TEXT"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordChangedAt") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("DeviceIdentifier") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("ExpireDate") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Value") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AliasVaultUserRefreshTokens"); - }); - - modelBuilder.Entity("AliasServerDb.AuthLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AdditionalInfo") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Browser") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("Country") - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("DeviceType") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("EventType") - .HasColumnType("nvarchar(50)"); - - b.Property("FailureReason") - .HasColumnType("INTEGER"); - - b.Property("IpAddress") - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("IsSuccess") - .HasColumnType("INTEGER"); - - b.Property("IsSuspiciousActivity") - .HasColumnType("INTEGER"); - - b.Property("OperatingSystem") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("RequestPath") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("Timestamp") - .HasColumnType("TEXT"); - - b.Property("UserAgent") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - 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.Email", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("DateSystem") - .HasColumnType("TEXT"); - - b.Property("EncryptedSymmetricKey") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("From") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageHtml") - .HasColumnType("TEXT"); - - b.Property("MessagePlain") - .HasColumnType("TEXT"); - - b.Property("MessagePreview") - .HasColumnType("TEXT"); - - b.Property("MessageSource") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("PushNotificationSent") - .HasColumnType("INTEGER"); - - b.Property("Subject") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("To") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UserEncryptionKeyId") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Visible") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Date"); - - b.HasIndex("DateSystem"); - - b.HasIndex("PushNotificationSent"); - - b.HasIndex("ToLocal"); - - b.HasIndex("UserEncryptionKeyId"); - - b.HasIndex("Visible"); - - b.ToTable("Emails"); - }); - - modelBuilder.Entity("AliasServerDb.EmailAttachment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Bytes") - .IsRequired() - .HasColumnType("BLOB"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("EmailId") - .HasColumnType("INTEGER"); - - b.Property("Filename") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Filesize") - .HasColumnType("INTEGER"); - - b.Property("MimeType") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("EmailId"); - - b.ToTable("EmailAttachments"); - }); - - modelBuilder.Entity("AliasServerDb.Log", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Application") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Exception") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Level") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); - - b.Property("LogEvent") - .IsRequired() - .HasColumnType("TEXT") - .HasColumnName("LogEvent"); - - b.Property("Message") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageTemplate") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Properties") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("SourceContext") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TimeStamp") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Application"); - - b.HasIndex("TimeStamp"); - - b.ToTable("Logs", (string)null); - }); - - modelBuilder.Entity("AliasServerDb.UserEmailClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("Address") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("AddressDomain") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("AddressLocal") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Address") - .IsUnique(); - - b.HasIndex("UserId"); - - b.ToTable("UserEmailClaims"); - }); - - modelBuilder.Entity("AliasServerDb.UserEncryptionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("IsPrimary") - .HasColumnType("INTEGER"); - - b.Property("PublicKey") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserEncryptionKeys"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("CredentialsCount") - .HasColumnType("INTEGER"); - - b.Property("EmailClaimsCount") - .HasColumnType("INTEGER"); - - b.Property("EncryptionSettings") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("EncryptionType") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FileSize") - .HasColumnType("INTEGER"); - - b.Property("Salt") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("VaultBlob") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Verifier") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("TEXT"); - - b.Property("Version") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Vaults"); - }); - - modelBuilder.Entity("AliasVault.WorkerStatus.Database.WorkerServiceStatus", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CurrentStatus") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("DesiredStatus") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Heartbeat") - .HasColumnType("TEXT"); - - b.Property("ServiceName") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("varchar"); - - b.HasKey("Id"); - - b.ToTable("WorkerServiceStatuses"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("FriendlyName") - .HasColumnType("TEXT"); - - b.Property("Xml") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("DataProtectionKeys"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("RoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("UserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.ToTable("UserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.ToTable("UserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("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.NoAction) - .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.UserEmailClaim", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("EmailClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.UserEncryptionKey", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("EncryptionKeys") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("Vaults") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Navigation("EmailClaims"); - - b.Navigation("EncryptionKeys"); - - b.Navigation("Vaults"); - }); - - 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/SqliteMigrations/20240911174159_AddVaultEncryptionSettings.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240911174159_AddVaultEncryptionSettings.cs deleted file mode 100644 index ba8ffd5fb..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240911174159_AddVaultEncryptionSettings.cs +++ /dev/null @@ -1,48 +0,0 @@ -// -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - /// - public partial class AddVaultEncryptionSettings : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "EncryptionSettings", - table: "Vaults", - type: "TEXT", - nullable: false, - defaultValue: ""); - - migrationBuilder.AddColumn( - name: "EncryptionType", - table: "Vaults", - type: "TEXT", - nullable: false, - defaultValue: ""); - - // Set default values for existing records. - migrationBuilder.Sql(@" - UPDATE Vaults - SET EncryptionType = 'Argon2Id', - EncryptionSettings = '{""DegreeOfParallelism"":4,""MemorySize"":8192,""Iterations"":1}' - WHERE EncryptionType = ''"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "EncryptionSettings", - table: "Vaults"); - - migrationBuilder.DropColumn( - name: "EncryptionType", - table: "Vaults"); - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240914150600_AddRefreshTokenIpAddress.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240914150600_AddRefreshTokenIpAddress.Designer.cs deleted file mode 100644 index 2828e4bf8..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240914150600_AddRefreshTokenIpAddress.Designer.cs +++ /dev/null @@ -1,828 +0,0 @@ -// -using System; -using AliasServerDb; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - [DbContext(typeof(AliasServerDbContextSqlite))] - [Migration("20240914150600_AddRefreshTokenIpAddress")] - partial class AddRefreshTokenIpAddress - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.8") - .HasAnnotation("Proxies:ChangeTracking", false) - .HasAnnotation("Proxies:CheckEquality", false) - .HasAnnotation("Proxies:LazyLoading", true); - - modelBuilder.Entity("AliasServerDb.AdminRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AdminUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LastPasswordChanged") - .HasColumnType("TEXT"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordChangedAt") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("DeviceIdentifier") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("ExpireDate") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("IpAddress") - .HasMaxLength(45) - .HasColumnType("TEXT"); - - b.Property("PreviousTokenValue") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Value") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AliasVaultUserRefreshTokens"); - }); - - modelBuilder.Entity("AliasServerDb.AuthLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AdditionalInfo") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Browser") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("Country") - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("DeviceType") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("EventType") - .HasColumnType("nvarchar(50)"); - - b.Property("FailureReason") - .HasColumnType("INTEGER"); - - b.Property("IpAddress") - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("IsSuccess") - .HasColumnType("INTEGER"); - - b.Property("IsSuspiciousActivity") - .HasColumnType("INTEGER"); - - b.Property("OperatingSystem") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("RequestPath") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("Timestamp") - .HasColumnType("TEXT"); - - b.Property("UserAgent") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - 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.Email", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("DateSystem") - .HasColumnType("TEXT"); - - b.Property("EncryptedSymmetricKey") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("From") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageHtml") - .HasColumnType("TEXT"); - - b.Property("MessagePlain") - .HasColumnType("TEXT"); - - b.Property("MessagePreview") - .HasColumnType("TEXT"); - - b.Property("MessageSource") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("PushNotificationSent") - .HasColumnType("INTEGER"); - - b.Property("Subject") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("To") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UserEncryptionKeyId") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Visible") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Date"); - - b.HasIndex("DateSystem"); - - b.HasIndex("PushNotificationSent"); - - b.HasIndex("ToLocal"); - - b.HasIndex("UserEncryptionKeyId"); - - b.HasIndex("Visible"); - - b.ToTable("Emails"); - }); - - modelBuilder.Entity("AliasServerDb.EmailAttachment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Bytes") - .IsRequired() - .HasColumnType("BLOB"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("EmailId") - .HasColumnType("INTEGER"); - - b.Property("Filename") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Filesize") - .HasColumnType("INTEGER"); - - b.Property("MimeType") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("EmailId"); - - b.ToTable("EmailAttachments"); - }); - - modelBuilder.Entity("AliasServerDb.Log", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Application") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Exception") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Level") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); - - b.Property("LogEvent") - .IsRequired() - .HasColumnType("TEXT") - .HasColumnName("LogEvent"); - - b.Property("Message") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageTemplate") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Properties") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("SourceContext") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TimeStamp") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Application"); - - b.HasIndex("TimeStamp"); - - b.ToTable("Logs", (string)null); - }); - - modelBuilder.Entity("AliasServerDb.UserEmailClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("Address") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("AddressDomain") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("AddressLocal") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Address") - .IsUnique(); - - b.HasIndex("UserId"); - - b.ToTable("UserEmailClaims"); - }); - - modelBuilder.Entity("AliasServerDb.UserEncryptionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("IsPrimary") - .HasColumnType("INTEGER"); - - b.Property("PublicKey") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserEncryptionKeys"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("CredentialsCount") - .HasColumnType("INTEGER"); - - b.Property("EmailClaimsCount") - .HasColumnType("INTEGER"); - - b.Property("EncryptionSettings") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("EncryptionType") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FileSize") - .HasColumnType("INTEGER"); - - b.Property("Salt") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("VaultBlob") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Verifier") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("TEXT"); - - b.Property("Version") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Vaults"); - }); - - modelBuilder.Entity("AliasVault.WorkerStatus.Database.WorkerServiceStatus", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CurrentStatus") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("DesiredStatus") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Heartbeat") - .HasColumnType("TEXT"); - - b.Property("ServiceName") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("varchar"); - - b.HasKey("Id"); - - b.ToTable("WorkerServiceStatuses"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("FriendlyName") - .HasColumnType("TEXT"); - - b.Property("Xml") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("DataProtectionKeys"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("RoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("UserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.ToTable("UserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.ToTable("UserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("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.NoAction) - .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.UserEmailClaim", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("EmailClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.UserEncryptionKey", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("EncryptionKeys") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("Vaults") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Navigation("EmailClaims"); - - b.Navigation("EncryptionKeys"); - - b.Navigation("Vaults"); - }); - - 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/SqliteMigrations/20240914150600_AddRefreshTokenIpAddress.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240914150600_AddRefreshTokenIpAddress.cs deleted file mode 100644 index cde088080..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240914150600_AddRefreshTokenIpAddress.cs +++ /dev/null @@ -1,41 +0,0 @@ -// -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - /// - public partial class AddRefreshTokenIpAddress : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "IpAddress", - table: "AliasVaultUserRefreshTokens", - type: "TEXT", - maxLength: 45, - nullable: true); - - migrationBuilder.AddColumn( - name: "PreviousTokenValue", - table: "AliasVaultUserRefreshTokens", - type: "TEXT", - maxLength: 255, - nullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "IpAddress", - table: "AliasVaultUserRefreshTokens"); - - migrationBuilder.DropColumn( - name: "PreviousTokenValue", - table: "AliasVaultUserRefreshTokens"); - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240916110323_AddVaultRevisionNumber.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240916110323_AddVaultRevisionNumber.Designer.cs deleted file mode 100644 index 0f0654bb0..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240916110323_AddVaultRevisionNumber.Designer.cs +++ /dev/null @@ -1,831 +0,0 @@ -// -using System; -using AliasServerDb; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - [DbContext(typeof(AliasServerDbContextSqlite))] - [Migration("20240916110323_AddVaultRevisionNumber")] - partial class AddVaultRevisionNumber - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.8") - .HasAnnotation("Proxies:ChangeTracking", false) - .HasAnnotation("Proxies:CheckEquality", false) - .HasAnnotation("Proxies:LazyLoading", true); - - modelBuilder.Entity("AliasServerDb.AdminRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AdminUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LastPasswordChanged") - .HasColumnType("TEXT"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordChangedAt") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("DeviceIdentifier") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("ExpireDate") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("IpAddress") - .HasMaxLength(45) - .HasColumnType("TEXT"); - - b.Property("PreviousTokenValue") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Value") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AliasVaultUserRefreshTokens"); - }); - - modelBuilder.Entity("AliasServerDb.AuthLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AdditionalInfo") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Browser") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("Country") - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("DeviceType") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("EventType") - .HasColumnType("nvarchar(50)"); - - b.Property("FailureReason") - .HasColumnType("INTEGER"); - - b.Property("IpAddress") - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("IsSuccess") - .HasColumnType("INTEGER"); - - b.Property("IsSuspiciousActivity") - .HasColumnType("INTEGER"); - - b.Property("OperatingSystem") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("RequestPath") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("Timestamp") - .HasColumnType("TEXT"); - - b.Property("UserAgent") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - 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.Email", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("DateSystem") - .HasColumnType("TEXT"); - - b.Property("EncryptedSymmetricKey") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("From") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageHtml") - .HasColumnType("TEXT"); - - b.Property("MessagePlain") - .HasColumnType("TEXT"); - - b.Property("MessagePreview") - .HasColumnType("TEXT"); - - b.Property("MessageSource") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("PushNotificationSent") - .HasColumnType("INTEGER"); - - b.Property("Subject") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("To") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UserEncryptionKeyId") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Visible") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Date"); - - b.HasIndex("DateSystem"); - - b.HasIndex("PushNotificationSent"); - - b.HasIndex("ToLocal"); - - b.HasIndex("UserEncryptionKeyId"); - - b.HasIndex("Visible"); - - b.ToTable("Emails"); - }); - - modelBuilder.Entity("AliasServerDb.EmailAttachment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Bytes") - .IsRequired() - .HasColumnType("BLOB"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("EmailId") - .HasColumnType("INTEGER"); - - b.Property("Filename") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Filesize") - .HasColumnType("INTEGER"); - - b.Property("MimeType") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("EmailId"); - - b.ToTable("EmailAttachments"); - }); - - modelBuilder.Entity("AliasServerDb.Log", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Application") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Exception") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Level") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); - - b.Property("LogEvent") - .IsRequired() - .HasColumnType("TEXT") - .HasColumnName("LogEvent"); - - b.Property("Message") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageTemplate") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Properties") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("SourceContext") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TimeStamp") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Application"); - - b.HasIndex("TimeStamp"); - - b.ToTable("Logs", (string)null); - }); - - modelBuilder.Entity("AliasServerDb.UserEmailClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("Address") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("AddressDomain") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("AddressLocal") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Address") - .IsUnique(); - - b.HasIndex("UserId"); - - b.ToTable("UserEmailClaims"); - }); - - modelBuilder.Entity("AliasServerDb.UserEncryptionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("IsPrimary") - .HasColumnType("INTEGER"); - - b.Property("PublicKey") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserEncryptionKeys"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("CredentialsCount") - .HasColumnType("INTEGER"); - - b.Property("EmailClaimsCount") - .HasColumnType("INTEGER"); - - b.Property("EncryptionSettings") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("EncryptionType") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FileSize") - .HasColumnType("INTEGER"); - - b.Property("RevisionNumber") - .HasColumnType("INTEGER"); - - b.Property("Salt") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("VaultBlob") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Verifier") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("TEXT"); - - b.Property("Version") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Vaults"); - }); - - modelBuilder.Entity("AliasVault.WorkerStatus.Database.WorkerServiceStatus", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CurrentStatus") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("DesiredStatus") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Heartbeat") - .HasColumnType("TEXT"); - - b.Property("ServiceName") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("varchar"); - - b.HasKey("Id"); - - b.ToTable("WorkerServiceStatuses"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("FriendlyName") - .HasColumnType("TEXT"); - - b.Property("Xml") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("DataProtectionKeys"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("RoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("UserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.ToTable("UserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.ToTable("UserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("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.NoAction) - .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.UserEmailClaim", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("EmailClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.UserEncryptionKey", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("EncryptionKeys") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("Vaults") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Navigation("EmailClaims"); - - b.Navigation("EncryptionKeys"); - - b.Navigation("Vaults"); - }); - - 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/SqliteMigrations/20240916110323_AddVaultRevisionNumber.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240916110323_AddVaultRevisionNumber.cs deleted file mode 100644 index d735e5507..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240916110323_AddVaultRevisionNumber.cs +++ /dev/null @@ -1,30 +0,0 @@ -// -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - /// - public partial class AddVaultRevisionNumber : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "RevisionNumber", - table: "Vaults", - type: "INTEGER", - nullable: false, - defaultValue: 0L); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "RevisionNumber", - table: "Vaults"); - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240917210632_SetDefaultRevisionNumber.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240917210632_SetDefaultRevisionNumber.Designer.cs deleted file mode 100644 index 51e38b331..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240917210632_SetDefaultRevisionNumber.Designer.cs +++ /dev/null @@ -1,831 +0,0 @@ -// -using System; -using AliasServerDb; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - [DbContext(typeof(AliasServerDbContextSqlite))] - [Migration("20240917210632_SetDefaultRevisionNumber")] - partial class SetDefaultRevisionNumber - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.8") - .HasAnnotation("Proxies:ChangeTracking", false) - .HasAnnotation("Proxies:CheckEquality", false) - .HasAnnotation("Proxies:LazyLoading", true); - - modelBuilder.Entity("AliasServerDb.AdminRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AdminUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LastPasswordChanged") - .HasColumnType("TEXT"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordChangedAt") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("DeviceIdentifier") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("ExpireDate") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("IpAddress") - .HasMaxLength(45) - .HasColumnType("TEXT"); - - b.Property("PreviousTokenValue") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Value") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AliasVaultUserRefreshTokens"); - }); - - modelBuilder.Entity("AliasServerDb.AuthLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AdditionalInfo") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Browser") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("Country") - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("DeviceType") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("EventType") - .HasColumnType("nvarchar(50)"); - - b.Property("FailureReason") - .HasColumnType("INTEGER"); - - b.Property("IpAddress") - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("IsSuccess") - .HasColumnType("INTEGER"); - - b.Property("IsSuspiciousActivity") - .HasColumnType("INTEGER"); - - b.Property("OperatingSystem") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("RequestPath") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("Timestamp") - .HasColumnType("TEXT"); - - b.Property("UserAgent") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - 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.Email", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("DateSystem") - .HasColumnType("TEXT"); - - b.Property("EncryptedSymmetricKey") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("From") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageHtml") - .HasColumnType("TEXT"); - - b.Property("MessagePlain") - .HasColumnType("TEXT"); - - b.Property("MessagePreview") - .HasColumnType("TEXT"); - - b.Property("MessageSource") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("PushNotificationSent") - .HasColumnType("INTEGER"); - - b.Property("Subject") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("To") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UserEncryptionKeyId") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Visible") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Date"); - - b.HasIndex("DateSystem"); - - b.HasIndex("PushNotificationSent"); - - b.HasIndex("ToLocal"); - - b.HasIndex("UserEncryptionKeyId"); - - b.HasIndex("Visible"); - - b.ToTable("Emails"); - }); - - modelBuilder.Entity("AliasServerDb.EmailAttachment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Bytes") - .IsRequired() - .HasColumnType("BLOB"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("EmailId") - .HasColumnType("INTEGER"); - - b.Property("Filename") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Filesize") - .HasColumnType("INTEGER"); - - b.Property("MimeType") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("EmailId"); - - b.ToTable("EmailAttachments"); - }); - - modelBuilder.Entity("AliasServerDb.Log", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Application") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Exception") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Level") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); - - b.Property("LogEvent") - .IsRequired() - .HasColumnType("TEXT") - .HasColumnName("LogEvent"); - - b.Property("Message") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageTemplate") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Properties") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("SourceContext") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TimeStamp") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Application"); - - b.HasIndex("TimeStamp"); - - b.ToTable("Logs", (string)null); - }); - - modelBuilder.Entity("AliasServerDb.UserEmailClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("Address") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("AddressDomain") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("AddressLocal") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Address") - .IsUnique(); - - b.HasIndex("UserId"); - - b.ToTable("UserEmailClaims"); - }); - - modelBuilder.Entity("AliasServerDb.UserEncryptionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("IsPrimary") - .HasColumnType("INTEGER"); - - b.Property("PublicKey") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserEncryptionKeys"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("CredentialsCount") - .HasColumnType("INTEGER"); - - b.Property("EmailClaimsCount") - .HasColumnType("INTEGER"); - - b.Property("EncryptionSettings") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("EncryptionType") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FileSize") - .HasColumnType("INTEGER"); - - b.Property("RevisionNumber") - .HasColumnType("INTEGER"); - - b.Property("Salt") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("VaultBlob") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Verifier") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("TEXT"); - - b.Property("Version") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Vaults"); - }); - - modelBuilder.Entity("AliasVault.WorkerStatus.Database.WorkerServiceStatus", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CurrentStatus") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("DesiredStatus") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Heartbeat") - .HasColumnType("TEXT"); - - b.Property("ServiceName") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("varchar"); - - b.HasKey("Id"); - - b.ToTable("WorkerServiceStatuses"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("FriendlyName") - .HasColumnType("TEXT"); - - b.Property("Xml") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("DataProtectionKeys"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("RoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("UserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.ToTable("UserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.ToTable("UserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("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.NoAction) - .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.UserEmailClaim", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("EmailClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.UserEncryptionKey", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("EncryptionKeys") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("Vaults") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Navigation("EmailClaims"); - - b.Navigation("EncryptionKeys"); - - b.Navigation("Vaults"); - }); - - 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/SqliteMigrations/20240917210632_SetDefaultRevisionNumber.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240917210632_SetDefaultRevisionNumber.cs deleted file mode 100644 index 4e7b03707..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20240917210632_SetDefaultRevisionNumber.cs +++ /dev/null @@ -1,40 +0,0 @@ -// -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - /// - /// Migration to set default revision numbers for vaults. - /// - public partial class SetDefaultRevisionNumber : Migration - { - /// - /// Applies the migration, setting incremental revision numbers for each user's vaults. - /// - /// The migration builder. - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.Sql(@" - UPDATE Vaults - SET RevisionNumber = ( - SELECT COUNT(*) - FROM Vaults AS v2 - WHERE v2.UserId = Vaults.UserId - AND (v2.UpdatedAt < Vaults.UpdatedAt - OR (v2.UpdatedAt = Vaults.UpdatedAt AND v2.Id <= Vaults.Id)) - ) - 1; - "); - } - - /// - /// Reverts the migration by setting all RevisionNumber values to 0. - /// - /// The migration builder. - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.Sql("UPDATE Vaults SET RevisionNumber = 0;"); - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20241007153012_DatetimeOffsetToDateTime.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20241007153012_DatetimeOffsetToDateTime.Designer.cs deleted file mode 100644 index 1ff68d656..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20241007153012_DatetimeOffsetToDateTime.Designer.cs +++ /dev/null @@ -1,831 +0,0 @@ -// -using System; -using AliasServerDb; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - [DbContext(typeof(AliasServerDbContextSqlite))] - [Migration("20241007153012_DatetimeOffsetToDateTime")] - partial class DatetimeOffsetToDateTime - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.8") - .HasAnnotation("Proxies:ChangeTracking", false) - .HasAnnotation("Proxies:CheckEquality", false) - .HasAnnotation("Proxies:LazyLoading", true); - - modelBuilder.Entity("AliasServerDb.AdminRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AdminUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LastPasswordChanged") - .HasColumnType("TEXT"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordChangedAt") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("DeviceIdentifier") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("ExpireDate") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("IpAddress") - .HasMaxLength(45) - .HasColumnType("TEXT"); - - b.Property("PreviousTokenValue") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Value") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AliasVaultUserRefreshTokens"); - }); - - modelBuilder.Entity("AliasServerDb.AuthLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AdditionalInfo") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Browser") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("Country") - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("DeviceType") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("EventType") - .HasColumnType("nvarchar(50)"); - - b.Property("FailureReason") - .HasColumnType("INTEGER"); - - b.Property("IpAddress") - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("IsSuccess") - .HasColumnType("INTEGER"); - - b.Property("IsSuspiciousActivity") - .HasColumnType("INTEGER"); - - b.Property("OperatingSystem") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("RequestPath") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("Timestamp") - .HasColumnType("TEXT"); - - b.Property("UserAgent") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - 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.Email", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("DateSystem") - .HasColumnType("TEXT"); - - b.Property("EncryptedSymmetricKey") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("From") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageHtml") - .HasColumnType("TEXT"); - - b.Property("MessagePlain") - .HasColumnType("TEXT"); - - b.Property("MessagePreview") - .HasColumnType("TEXT"); - - b.Property("MessageSource") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("PushNotificationSent") - .HasColumnType("INTEGER"); - - b.Property("Subject") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("To") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UserEncryptionKeyId") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Visible") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Date"); - - b.HasIndex("DateSystem"); - - b.HasIndex("PushNotificationSent"); - - b.HasIndex("ToLocal"); - - b.HasIndex("UserEncryptionKeyId"); - - b.HasIndex("Visible"); - - b.ToTable("Emails"); - }); - - modelBuilder.Entity("AliasServerDb.EmailAttachment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Bytes") - .IsRequired() - .HasColumnType("BLOB"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("EmailId") - .HasColumnType("INTEGER"); - - b.Property("Filename") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Filesize") - .HasColumnType("INTEGER"); - - b.Property("MimeType") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("EmailId"); - - b.ToTable("EmailAttachments"); - }); - - modelBuilder.Entity("AliasServerDb.Log", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Application") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Exception") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Level") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); - - b.Property("LogEvent") - .IsRequired() - .HasColumnType("TEXT") - .HasColumnName("LogEvent"); - - b.Property("Message") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageTemplate") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Properties") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("SourceContext") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TimeStamp") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Application"); - - b.HasIndex("TimeStamp"); - - b.ToTable("Logs", (string)null); - }); - - modelBuilder.Entity("AliasServerDb.UserEmailClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("Address") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("AddressDomain") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("AddressLocal") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Address") - .IsUnique(); - - b.HasIndex("UserId"); - - b.ToTable("UserEmailClaims"); - }); - - modelBuilder.Entity("AliasServerDb.UserEncryptionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("IsPrimary") - .HasColumnType("INTEGER"); - - b.Property("PublicKey") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserEncryptionKeys"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("CredentialsCount") - .HasColumnType("INTEGER"); - - b.Property("EmailClaimsCount") - .HasColumnType("INTEGER"); - - b.Property("EncryptionSettings") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("EncryptionType") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FileSize") - .HasColumnType("INTEGER"); - - b.Property("RevisionNumber") - .HasColumnType("INTEGER"); - - b.Property("Salt") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("VaultBlob") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Verifier") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("TEXT"); - - b.Property("Version") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Vaults"); - }); - - modelBuilder.Entity("AliasVault.WorkerStatus.Database.WorkerServiceStatus", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CurrentStatus") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("DesiredStatus") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Heartbeat") - .HasColumnType("TEXT"); - - b.Property("ServiceName") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("varchar"); - - b.HasKey("Id"); - - b.ToTable("WorkerServiceStatuses"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("FriendlyName") - .HasColumnType("TEXT"); - - b.Property("Xml") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("DataProtectionKeys"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("RoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("UserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.ToTable("UserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.ToTable("UserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("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.NoAction) - .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.UserEmailClaim", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("EmailClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.UserEncryptionKey", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("EncryptionKeys") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("Vaults") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Navigation("EmailClaims"); - - b.Navigation("EncryptionKeys"); - - b.Navigation("Vaults"); - }); - - 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/SqliteMigrations/20241007153012_DatetimeOffsetToDateTime.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20241007153012_DatetimeOffsetToDateTime.cs deleted file mode 100644 index b996dc511..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20241007153012_DatetimeOffsetToDateTime.cs +++ /dev/null @@ -1,23 +0,0 @@ -// -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - /// - public partial class DatetimeOffsetToDateTime : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20241107205118_PreserveEmailClaimsForDeletedUsers.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20241107205118_PreserveEmailClaimsForDeletedUsers.Designer.cs deleted file mode 100644 index 14082f61f..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20241107205118_PreserveEmailClaimsForDeletedUsers.Designer.cs +++ /dev/null @@ -1,828 +0,0 @@ -// -using System; -using AliasServerDb; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - [DbContext(typeof(AliasServerDbContextSqlite))] - [Migration("20241107105118_PreserveEmailClaimsForDeletedUsers")] - partial class PreserveEmailClaimsForDeletedUsers - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.10") - .HasAnnotation("Proxies:ChangeTracking", false) - .HasAnnotation("Proxies:CheckEquality", false) - .HasAnnotation("Proxies:LazyLoading", true); - - modelBuilder.Entity("AliasServerDb.AdminRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AdminUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LastPasswordChanged") - .HasColumnType("TEXT"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordChangedAt") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("DeviceIdentifier") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("ExpireDate") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("IpAddress") - .HasMaxLength(45) - .HasColumnType("TEXT"); - - b.Property("PreviousTokenValue") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Value") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AliasVaultUserRefreshTokens"); - }); - - modelBuilder.Entity("AliasServerDb.AuthLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AdditionalInfo") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Browser") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("Country") - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("DeviceType") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("EventType") - .HasColumnType("nvarchar(50)"); - - b.Property("FailureReason") - .HasColumnType("INTEGER"); - - b.Property("IpAddress") - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("IsSuccess") - .HasColumnType("INTEGER"); - - b.Property("IsSuspiciousActivity") - .HasColumnType("INTEGER"); - - b.Property("OperatingSystem") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("RequestPath") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("Timestamp") - .HasColumnType("TEXT"); - - b.Property("UserAgent") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - 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.Email", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("DateSystem") - .HasColumnType("TEXT"); - - b.Property("EncryptedSymmetricKey") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("From") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageHtml") - .HasColumnType("TEXT"); - - b.Property("MessagePlain") - .HasColumnType("TEXT"); - - b.Property("MessagePreview") - .HasColumnType("TEXT"); - - b.Property("MessageSource") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("PushNotificationSent") - .HasColumnType("INTEGER"); - - b.Property("Subject") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("To") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UserEncryptionKeyId") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Visible") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Date"); - - b.HasIndex("DateSystem"); - - b.HasIndex("PushNotificationSent"); - - b.HasIndex("ToLocal"); - - b.HasIndex("UserEncryptionKeyId"); - - b.HasIndex("Visible"); - - b.ToTable("Emails"); - }); - - modelBuilder.Entity("AliasServerDb.EmailAttachment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Bytes") - .IsRequired() - .HasColumnType("BLOB"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("EmailId") - .HasColumnType("INTEGER"); - - b.Property("Filename") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Filesize") - .HasColumnType("INTEGER"); - - b.Property("MimeType") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("EmailId"); - - b.ToTable("EmailAttachments"); - }); - - modelBuilder.Entity("AliasServerDb.Log", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Application") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Exception") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Level") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); - - b.Property("LogEvent") - .IsRequired() - .HasColumnType("TEXT") - .HasColumnName("LogEvent"); - - b.Property("Message") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageTemplate") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Properties") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("SourceContext") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TimeStamp") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Application"); - - b.HasIndex("TimeStamp"); - - b.ToTable("Logs", (string)null); - }); - - modelBuilder.Entity("AliasServerDb.UserEmailClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("Address") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("AddressDomain") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("AddressLocal") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Address") - .IsUnique(); - - b.HasIndex("UserId"); - - b.ToTable("UserEmailClaims"); - }); - - modelBuilder.Entity("AliasServerDb.UserEncryptionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("IsPrimary") - .HasColumnType("INTEGER"); - - b.Property("PublicKey") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserEncryptionKeys"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("CredentialsCount") - .HasColumnType("INTEGER"); - - b.Property("EmailClaimsCount") - .HasColumnType("INTEGER"); - - b.Property("EncryptionSettings") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("EncryptionType") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FileSize") - .HasColumnType("INTEGER"); - - b.Property("RevisionNumber") - .HasColumnType("INTEGER"); - - b.Property("Salt") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("VaultBlob") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Verifier") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("TEXT"); - - b.Property("Version") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Vaults"); - }); - - modelBuilder.Entity("AliasVault.WorkerStatus.Database.WorkerServiceStatus", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CurrentStatus") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("DesiredStatus") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Heartbeat") - .HasColumnType("TEXT"); - - b.Property("ServiceName") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("varchar"); - - b.HasKey("Id"); - - b.ToTable("WorkerServiceStatuses"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("FriendlyName") - .HasColumnType("TEXT"); - - b.Property("Xml") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("DataProtectionKeys"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("RoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("UserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.ToTable("UserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.ToTable("UserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("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.UserEmailClaim", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("EmailClaims") - .HasForeignKey("UserId"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.UserEncryptionKey", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("EncryptionKeys") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("Vaults") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Navigation("EmailClaims"); - - b.Navigation("EncryptionKeys"); - - b.Navigation("Vaults"); - }); - - 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/SqliteMigrations/20241107205118_PreserveEmailClaimsForDeletedUsers.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20241107205118_PreserveEmailClaimsForDeletedUsers.cs deleted file mode 100644 index 43f1bb02e..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20241107205118_PreserveEmailClaimsForDeletedUsers.cs +++ /dev/null @@ -1,87 +0,0 @@ -// -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - /// - public partial class PreserveEmailClaimsForDeletedUsers : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Emails_UserEncryptionKeys_UserEncryptionKeyId", - table: "Emails"); - - migrationBuilder.DropForeignKey( - name: "FK_UserEmailClaims_AliasVaultUsers_UserId", - table: "UserEmailClaims"); - - migrationBuilder.AlterColumn( - name: "UserId", - table: "UserEmailClaims", - type: "TEXT", - maxLength: 255, - nullable: true, - oldClrType: typeof(string), - oldType: "TEXT", - oldMaxLength: 255); - - migrationBuilder.AddForeignKey( - name: "FK_Emails_UserEncryptionKeys_UserEncryptionKeyId", - table: "Emails", - column: "UserEncryptionKeyId", - principalTable: "UserEncryptionKeys", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - migrationBuilder.AddForeignKey( - name: "FK_UserEmailClaims_AliasVaultUsers_UserId", - table: "UserEmailClaims", - column: "UserId", - principalTable: "AliasVaultUsers", - principalColumn: "Id"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Emails_UserEncryptionKeys_UserEncryptionKeyId", - table: "Emails"); - - migrationBuilder.DropForeignKey( - name: "FK_UserEmailClaims_AliasVaultUsers_UserId", - table: "UserEmailClaims"); - - migrationBuilder.AlterColumn( - name: "UserId", - table: "UserEmailClaims", - type: "TEXT", - maxLength: 255, - nullable: false, - defaultValue: "", - oldClrType: typeof(string), - oldType: "TEXT", - oldMaxLength: 255, - oldNullable: true); - - migrationBuilder.AddForeignKey( - name: "FK_Emails_UserEncryptionKeys_UserEncryptionKeyId", - table: "Emails", - column: "UserEncryptionKeyId", - principalTable: "UserEncryptionKeys", - principalColumn: "Id"); - - migrationBuilder.AddForeignKey( - name: "FK_UserEmailClaims_AliasVaultUsers_UserId", - table: "UserEmailClaims", - column: "UserId", - principalTable: "AliasVaultUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20241204121218_AddServerSettingsTable.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20241204121218_AddServerSettingsTable.Designer.cs deleted file mode 100644 index c5a0ead3e..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20241204121218_AddServerSettingsTable.Designer.cs +++ /dev/null @@ -1,848 +0,0 @@ -// -using System; -using AliasServerDb; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - [DbContext(typeof(AliasServerDbContextSqlite))] - [Migration("20241204121218_AddServerSettingsTable")] - partial class AddServerSettingsTable - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.0") - .HasAnnotation("Proxies:ChangeTracking", false) - .HasAnnotation("Proxies:CheckEquality", false) - .HasAnnotation("Proxies:LazyLoading", true); - - modelBuilder.Entity("AliasServerDb.AdminRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AdminUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LastPasswordChanged") - .HasColumnType("TEXT"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordChangedAt") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("DeviceIdentifier") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("ExpireDate") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("IpAddress") - .HasMaxLength(45) - .HasColumnType("TEXT"); - - b.Property("PreviousTokenValue") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Value") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AliasVaultUserRefreshTokens"); - }); - - modelBuilder.Entity("AliasServerDb.AuthLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AdditionalInfo") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Browser") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("Country") - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("DeviceType") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("EventType") - .HasColumnType("nvarchar(50)"); - - b.Property("FailureReason") - .HasColumnType("INTEGER"); - - b.Property("IpAddress") - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("IsSuccess") - .HasColumnType("INTEGER"); - - b.Property("IsSuspiciousActivity") - .HasColumnType("INTEGER"); - - b.Property("OperatingSystem") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("RequestPath") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("Timestamp") - .HasColumnType("TEXT"); - - b.Property("UserAgent") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - 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.Email", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("DateSystem") - .HasColumnType("TEXT"); - - b.Property("EncryptedSymmetricKey") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("From") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageHtml") - .HasColumnType("TEXT"); - - b.Property("MessagePlain") - .HasColumnType("TEXT"); - - b.Property("MessagePreview") - .HasColumnType("TEXT"); - - b.Property("MessageSource") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("PushNotificationSent") - .HasColumnType("INTEGER"); - - b.Property("Subject") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("To") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UserEncryptionKeyId") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Visible") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Date"); - - b.HasIndex("DateSystem"); - - b.HasIndex("PushNotificationSent"); - - b.HasIndex("ToLocal"); - - b.HasIndex("UserEncryptionKeyId"); - - b.HasIndex("Visible"); - - b.ToTable("Emails"); - }); - - modelBuilder.Entity("AliasServerDb.EmailAttachment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Bytes") - .IsRequired() - .HasColumnType("BLOB"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("EmailId") - .HasColumnType("INTEGER"); - - b.Property("Filename") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Filesize") - .HasColumnType("INTEGER"); - - b.Property("MimeType") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("EmailId"); - - b.ToTable("EmailAttachments"); - }); - - modelBuilder.Entity("AliasServerDb.Log", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Application") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Exception") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Level") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); - - b.Property("LogEvent") - .IsRequired() - .HasColumnType("TEXT") - .HasColumnName("LogEvent"); - - b.Property("Message") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageTemplate") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Properties") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("SourceContext") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TimeStamp") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Application"); - - b.HasIndex("TimeStamp"); - - b.ToTable("Logs", (string)null); - }); - - modelBuilder.Entity("AliasServerDb.ServerSetting", b => - { - b.Property("Key") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("Key"); - - b.ToTable("ServerSettings"); - }); - - modelBuilder.Entity("AliasServerDb.UserEmailClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("Address") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("AddressDomain") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("AddressLocal") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Address") - .IsUnique(); - - b.HasIndex("UserId"); - - b.ToTable("UserEmailClaims"); - }); - - modelBuilder.Entity("AliasServerDb.UserEncryptionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("IsPrimary") - .HasColumnType("INTEGER"); - - b.Property("PublicKey") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserEncryptionKeys"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("CredentialsCount") - .HasColumnType("INTEGER"); - - b.Property("EmailClaimsCount") - .HasColumnType("INTEGER"); - - b.Property("EncryptionSettings") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("EncryptionType") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FileSize") - .HasColumnType("INTEGER"); - - b.Property("RevisionNumber") - .HasColumnType("INTEGER"); - - b.Property("Salt") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("VaultBlob") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Verifier") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("TEXT"); - - b.Property("Version") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Vaults"); - }); - - modelBuilder.Entity("AliasVault.WorkerStatus.Database.WorkerServiceStatus", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CurrentStatus") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("DesiredStatus") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Heartbeat") - .HasColumnType("TEXT"); - - b.Property("ServiceName") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("varchar"); - - b.HasKey("Id"); - - b.ToTable("WorkerServiceStatuses"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("FriendlyName") - .HasColumnType("TEXT"); - - b.Property("Xml") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("DataProtectionKeys"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("RoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("UserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.ToTable("UserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.ToTable("UserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("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.UserEmailClaim", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("EmailClaims") - .HasForeignKey("UserId"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.UserEncryptionKey", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("EncryptionKeys") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("Vaults") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Navigation("EmailClaims"); - - b.Navigation("EncryptionKeys"); - - b.Navigation("Vaults"); - }); - - 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/SqliteMigrations/20241204121218_AddServerSettingsTable.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20241204121218_AddServerSettingsTable.cs deleted file mode 100644 index 48b8fd347..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20241204121218_AddServerSettingsTable.cs +++ /dev/null @@ -1,37 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - /// - public partial class AddServerSettingsTable : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "ServerSettings", - columns: table => new - { - Key = table.Column(type: "TEXT", maxLength: 255, nullable: false), - Value = table.Column(type: "TEXT", nullable: true), - CreatedAt = table.Column(type: "TEXT", nullable: false), - UpdatedAt = table.Column(type: "TEXT", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ServerSettings", x => x.Key); - }); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "ServerSettings"); - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20241215131807_AddTaskRunnerJobTable.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20241215131807_AddTaskRunnerJobTable.Designer.cs deleted file mode 100644 index f466f8987..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20241215131807_AddTaskRunnerJobTable.Designer.cs +++ /dev/null @@ -1,881 +0,0 @@ -// -using System; -using AliasServerDb; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - [DbContext(typeof(AliasServerDbContextSqlite))] - [Migration("20241215131807_AddTaskRunnerJobTable")] - partial class AddTaskRunnerJobTable - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.0") - .HasAnnotation("Proxies:ChangeTracking", false) - .HasAnnotation("Proxies:CheckEquality", false) - .HasAnnotation("Proxies:LazyLoading", true); - - modelBuilder.Entity("AliasServerDb.AdminRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AdminUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LastPasswordChanged") - .HasColumnType("TEXT"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordChangedAt") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("DeviceIdentifier") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("ExpireDate") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("IpAddress") - .HasMaxLength(45) - .HasColumnType("TEXT"); - - b.Property("PreviousTokenValue") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Value") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AliasVaultUserRefreshTokens"); - }); - - modelBuilder.Entity("AliasServerDb.AuthLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AdditionalInfo") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Browser") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("Country") - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("DeviceType") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("EventType") - .HasColumnType("nvarchar(50)"); - - b.Property("FailureReason") - .HasColumnType("INTEGER"); - - b.Property("IpAddress") - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("IsSuccess") - .HasColumnType("INTEGER"); - - b.Property("IsSuspiciousActivity") - .HasColumnType("INTEGER"); - - b.Property("OperatingSystem") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("RequestPath") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("Timestamp") - .HasColumnType("TEXT"); - - b.Property("UserAgent") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - 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.Email", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("DateSystem") - .HasColumnType("TEXT"); - - b.Property("EncryptedSymmetricKey") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("From") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageHtml") - .HasColumnType("TEXT"); - - b.Property("MessagePlain") - .HasColumnType("TEXT"); - - b.Property("MessagePreview") - .HasColumnType("TEXT"); - - b.Property("MessageSource") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("PushNotificationSent") - .HasColumnType("INTEGER"); - - b.Property("Subject") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("To") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UserEncryptionKeyId") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Visible") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Date"); - - b.HasIndex("DateSystem"); - - b.HasIndex("PushNotificationSent"); - - b.HasIndex("ToLocal"); - - b.HasIndex("UserEncryptionKeyId"); - - b.HasIndex("Visible"); - - b.ToTable("Emails"); - }); - - modelBuilder.Entity("AliasServerDb.EmailAttachment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Bytes") - .IsRequired() - .HasColumnType("BLOB"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("EmailId") - .HasColumnType("INTEGER"); - - b.Property("Filename") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Filesize") - .HasColumnType("INTEGER"); - - b.Property("MimeType") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("EmailId"); - - b.ToTable("EmailAttachments"); - }); - - modelBuilder.Entity("AliasServerDb.Log", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Application") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Exception") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Level") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); - - b.Property("LogEvent") - .IsRequired() - .HasColumnType("TEXT") - .HasColumnName("LogEvent"); - - b.Property("Message") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageTemplate") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Properties") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("SourceContext") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TimeStamp") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Application"); - - b.HasIndex("TimeStamp"); - - b.ToTable("Logs", (string)null); - }); - - modelBuilder.Entity("AliasServerDb.ServerSetting", b => - { - b.Property("Key") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("Key"); - - b.ToTable("ServerSettings"); - }); - - modelBuilder.Entity("AliasServerDb.TaskRunnerJob", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("EndTime") - .HasColumnType("TEXT"); - - b.Property("ErrorMessage") - .HasColumnType("TEXT"); - - b.Property("IsOnDemand") - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("RunDate") - .HasColumnType("TEXT"); - - b.Property("StartTime") - .HasColumnType("TEXT"); - - b.Property("Status") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.ToTable("TaskRunnerJobs"); - }); - - modelBuilder.Entity("AliasServerDb.UserEmailClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("Address") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("AddressDomain") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("AddressLocal") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Address") - .IsUnique(); - - b.HasIndex("UserId"); - - b.ToTable("UserEmailClaims"); - }); - - modelBuilder.Entity("AliasServerDb.UserEncryptionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("IsPrimary") - .HasColumnType("INTEGER"); - - b.Property("PublicKey") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserEncryptionKeys"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("CredentialsCount") - .HasColumnType("INTEGER"); - - b.Property("EmailClaimsCount") - .HasColumnType("INTEGER"); - - b.Property("EncryptionSettings") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("EncryptionType") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FileSize") - .HasColumnType("INTEGER"); - - b.Property("RevisionNumber") - .HasColumnType("INTEGER"); - - b.Property("Salt") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("VaultBlob") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Verifier") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("TEXT"); - - b.Property("Version") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Vaults"); - }); - - modelBuilder.Entity("AliasVault.WorkerStatus.Database.WorkerServiceStatus", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CurrentStatus") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("DesiredStatus") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Heartbeat") - .HasColumnType("TEXT"); - - b.Property("ServiceName") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("varchar"); - - b.HasKey("Id"); - - b.ToTable("WorkerServiceStatuses"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("FriendlyName") - .HasColumnType("TEXT"); - - b.Property("Xml") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("DataProtectionKeys"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("RoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("UserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.ToTable("UserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.ToTable("UserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("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.UserEmailClaim", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("EmailClaims") - .HasForeignKey("UserId"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.UserEncryptionKey", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("EncryptionKeys") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("Vaults") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Navigation("EmailClaims"); - - b.Navigation("EncryptionKeys"); - - b.Navigation("Vaults"); - }); - - 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/SqliteMigrations/20241215131807_AddTaskRunnerJobTable.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20241215131807_AddTaskRunnerJobTable.cs deleted file mode 100644 index 1d184fb7b..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20241215131807_AddTaskRunnerJobTable.cs +++ /dev/null @@ -1,42 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - /// - public partial class AddTaskRunnerJobTable : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "TaskRunnerJobs", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Name = table.Column(type: "TEXT", nullable: false), - RunDate = table.Column(type: "TEXT", nullable: false), - StartTime = table.Column(type: "TEXT", nullable: false), - EndTime = table.Column(type: "TEXT", nullable: true), - Status = table.Column(type: "INTEGER", nullable: false), - ErrorMessage = table.Column(type: "TEXT", nullable: true), - IsOnDemand = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_TaskRunnerJobs", x => x.Id); - }); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "TaskRunnerJobs"); - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20241220164855_AddUserBlockedStatus.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20241220164855_AddUserBlockedStatus.Designer.cs deleted file mode 100644 index 6fbcec5f0..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20241220164855_AddUserBlockedStatus.Designer.cs +++ /dev/null @@ -1,884 +0,0 @@ -// -using System; -using AliasServerDb; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - [DbContext(typeof(AliasServerDbContextSqlite))] - [Migration("20241220164855_AddUserBlockedStatus")] - partial class AddUserBlockedStatus - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.0") - .HasAnnotation("Proxies:ChangeTracking", false) - .HasAnnotation("Proxies:CheckEquality", false) - .HasAnnotation("Proxies:LazyLoading", true); - - modelBuilder.Entity("AliasServerDb.AdminRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AdminUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LastPasswordChanged") - .HasColumnType("TEXT"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("Blocked") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordChangedAt") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("DeviceIdentifier") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("ExpireDate") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("IpAddress") - .HasMaxLength(45) - .HasColumnType("TEXT"); - - b.Property("PreviousTokenValue") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Value") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AliasVaultUserRefreshTokens"); - }); - - modelBuilder.Entity("AliasServerDb.AuthLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AdditionalInfo") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Browser") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("Country") - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("DeviceType") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("EventType") - .HasColumnType("nvarchar(50)"); - - b.Property("FailureReason") - .HasColumnType("INTEGER"); - - b.Property("IpAddress") - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("IsSuccess") - .HasColumnType("INTEGER"); - - b.Property("IsSuspiciousActivity") - .HasColumnType("INTEGER"); - - b.Property("OperatingSystem") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("RequestPath") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("Timestamp") - .HasColumnType("TEXT"); - - b.Property("UserAgent") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - 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.Email", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("DateSystem") - .HasColumnType("TEXT"); - - b.Property("EncryptedSymmetricKey") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("From") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageHtml") - .HasColumnType("TEXT"); - - b.Property("MessagePlain") - .HasColumnType("TEXT"); - - b.Property("MessagePreview") - .HasColumnType("TEXT"); - - b.Property("MessageSource") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("PushNotificationSent") - .HasColumnType("INTEGER"); - - b.Property("Subject") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("To") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UserEncryptionKeyId") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Visible") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Date"); - - b.HasIndex("DateSystem"); - - b.HasIndex("PushNotificationSent"); - - b.HasIndex("ToLocal"); - - b.HasIndex("UserEncryptionKeyId"); - - b.HasIndex("Visible"); - - b.ToTable("Emails"); - }); - - modelBuilder.Entity("AliasServerDb.EmailAttachment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Bytes") - .IsRequired() - .HasColumnType("BLOB"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("EmailId") - .HasColumnType("INTEGER"); - - b.Property("Filename") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Filesize") - .HasColumnType("INTEGER"); - - b.Property("MimeType") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("EmailId"); - - b.ToTable("EmailAttachments"); - }); - - modelBuilder.Entity("AliasServerDb.Log", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Application") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Exception") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Level") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); - - b.Property("LogEvent") - .IsRequired() - .HasColumnType("TEXT") - .HasColumnName("LogEvent"); - - b.Property("Message") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageTemplate") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Properties") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("SourceContext") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("TimeStamp") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Application"); - - b.HasIndex("TimeStamp"); - - b.ToTable("Logs", (string)null); - }); - - modelBuilder.Entity("AliasServerDb.ServerSetting", b => - { - b.Property("Key") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("Key"); - - b.ToTable("ServerSettings"); - }); - - modelBuilder.Entity("AliasServerDb.TaskRunnerJob", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("EndTime") - .HasColumnType("TEXT"); - - b.Property("ErrorMessage") - .HasColumnType("TEXT"); - - b.Property("IsOnDemand") - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("RunDate") - .HasColumnType("TEXT"); - - b.Property("StartTime") - .HasColumnType("TEXT"); - - b.Property("Status") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.ToTable("TaskRunnerJobs"); - }); - - modelBuilder.Entity("AliasServerDb.UserEmailClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("Address") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("AddressDomain") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("AddressLocal") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Address") - .IsUnique(); - - b.HasIndex("UserId"); - - b.ToTable("UserEmailClaims"); - }); - - modelBuilder.Entity("AliasServerDb.UserEncryptionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("IsPrimary") - .HasColumnType("INTEGER"); - - b.Property("PublicKey") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserEncryptionKeys"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("CredentialsCount") - .HasColumnType("INTEGER"); - - b.Property("EmailClaimsCount") - .HasColumnType("INTEGER"); - - b.Property("EncryptionSettings") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("EncryptionType") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FileSize") - .HasColumnType("INTEGER"); - - b.Property("RevisionNumber") - .HasColumnType("INTEGER"); - - b.Property("Salt") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("VaultBlob") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Verifier") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("TEXT"); - - b.Property("Version") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Vaults"); - }); - - modelBuilder.Entity("AliasVault.WorkerStatus.Database.WorkerServiceStatus", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CurrentStatus") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("DesiredStatus") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Heartbeat") - .HasColumnType("TEXT"); - - b.Property("ServiceName") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("varchar"); - - b.HasKey("Id"); - - b.ToTable("WorkerServiceStatuses"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("FriendlyName") - .HasColumnType("TEXT"); - - b.Property("Xml") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("DataProtectionKeys"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("RoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("UserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.ToTable("UserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.ToTable("UserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("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.UserEmailClaim", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("EmailClaims") - .HasForeignKey("UserId"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.UserEncryptionKey", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("EncryptionKeys") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("Vaults") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Navigation("EmailClaims"); - - b.Navigation("EncryptionKeys"); - - b.Navigation("Vaults"); - }); - - 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/SqliteMigrations/20241220164855_AddUserBlockedStatus.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20241220164855_AddUserBlockedStatus.cs deleted file mode 100644 index 1707a87dc..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20241220164855_AddUserBlockedStatus.cs +++ /dev/null @@ -1,30 +0,0 @@ -// -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - /// - public partial class AddUserBlockedStatus : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "Blocked", - table: "AliasVaultUsers", - type: "INTEGER", - nullable: false, - defaultValue: false); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Blocked", - table: "AliasVaultUsers"); - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20241223201909_IncludePostgresqlFixes.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20241223201909_IncludePostgresqlFixes.Designer.cs deleted file mode 100644 index e510fb1cd..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20241223201909_IncludePostgresqlFixes.Designer.cs +++ /dev/null @@ -1,886 +0,0 @@ -// -using System; -using AliasServerDb; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - [DbContext(typeof(AliasServerDbContextSqlite))] - [Migration("20241223201909_IncludePostgresqlFixes")] - partial class IncludePostgresqlFixes - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.0") - .HasAnnotation("Proxies:ChangeTracking", false) - .HasAnnotation("Proxies:CheckEquality", false) - .HasAnnotation("Proxies:LazyLoading", true); - - modelBuilder.Entity("AliasServerDb.AdminRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AdminUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LastPasswordChanged") - .HasColumnType("TEXT"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("Blocked") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordChangedAt") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("DeviceIdentifier") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("ExpireDate") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("IpAddress") - .HasMaxLength(45) - .HasColumnType("TEXT"); - - b.Property("PreviousTokenValue") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Value") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AliasVaultUserRefreshTokens"); - }); - - modelBuilder.Entity("AliasServerDb.AuthLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AdditionalInfo") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Browser") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("Country") - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("DeviceType") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("EventType") - .HasColumnType("INTEGER"); - - b.Property("FailureReason") - .HasColumnType("INTEGER"); - - b.Property("IpAddress") - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("IsSuccess") - .HasColumnType("INTEGER"); - - b.Property("IsSuspiciousActivity") - .HasColumnType("INTEGER"); - - b.Property("OperatingSystem") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("RequestPath") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("Timestamp") - .HasColumnType("TEXT"); - - b.Property("UserAgent") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - 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.Email", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("DateSystem") - .HasColumnType("TEXT"); - - b.Property("EncryptedSymmetricKey") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("From") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageHtml") - .HasColumnType("TEXT"); - - b.Property("MessagePlain") - .HasColumnType("TEXT"); - - b.Property("MessagePreview") - .HasColumnType("TEXT"); - - b.Property("MessageSource") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("PushNotificationSent") - .HasColumnType("INTEGER"); - - b.Property("Subject") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("To") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UserEncryptionKeyId") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Visible") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Date"); - - b.HasIndex("DateSystem"); - - b.HasIndex("PushNotificationSent"); - - b.HasIndex("ToLocal"); - - b.HasIndex("UserEncryptionKeyId"); - - b.HasIndex("Visible"); - - b.ToTable("Emails"); - }); - - modelBuilder.Entity("AliasServerDb.EmailAttachment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Bytes") - .IsRequired() - .HasColumnType("BLOB"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("EmailId") - .HasColumnType("INTEGER"); - - b.Property("Filename") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Filesize") - .HasColumnType("INTEGER"); - - b.Property("MimeType") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("EmailId"); - - b.ToTable("EmailAttachments"); - }); - - modelBuilder.Entity("AliasServerDb.Log", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Application") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Exception") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Level") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); - - b.Property("LogEvent") - .IsRequired() - .HasColumnType("TEXT") - .HasColumnName("LogEvent"); - - b.Property("Message") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageTemplate") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Properties") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("SourceContext") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("TimeStamp") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Application"); - - b.HasIndex("TimeStamp"); - - b.ToTable("Logs", (string)null); - }); - - modelBuilder.Entity("AliasServerDb.ServerSetting", b => - { - b.Property("Key") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("Key"); - - b.ToTable("ServerSettings"); - }); - - modelBuilder.Entity("AliasServerDb.TaskRunnerJob", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("EndTime") - .HasColumnType("TEXT"); - - b.Property("ErrorMessage") - .HasColumnType("TEXT"); - - b.Property("IsOnDemand") - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("RunDate") - .HasColumnType("TEXT"); - - b.Property("StartTime") - .HasColumnType("TEXT"); - - b.Property("Status") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.ToTable("TaskRunnerJobs"); - }); - - modelBuilder.Entity("AliasServerDb.UserEmailClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("Address") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("AddressDomain") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("AddressLocal") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Address") - .IsUnique(); - - b.HasIndex("UserId"); - - b.ToTable("UserEmailClaims"); - }); - - modelBuilder.Entity("AliasServerDb.UserEncryptionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("IsPrimary") - .HasColumnType("INTEGER"); - - b.Property("PublicKey") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserEncryptionKeys"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("CredentialsCount") - .HasColumnType("INTEGER"); - - b.Property("EmailClaimsCount") - .HasColumnType("INTEGER"); - - b.Property("EncryptionSettings") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("EncryptionType") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FileSize") - .HasColumnType("INTEGER"); - - b.Property("RevisionNumber") - .HasColumnType("INTEGER"); - - b.Property("Salt") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("VaultBlob") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Verifier") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("TEXT"); - - b.Property("Version") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Vaults"); - }); - - modelBuilder.Entity("AliasVault.WorkerStatus.Database.WorkerServiceStatus", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CurrentStatus") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("DesiredStatus") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Heartbeat") - .HasColumnType("TEXT"); - - b.Property("ServiceName") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("WorkerServiceStatuses"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("FriendlyName") - .HasColumnType("TEXT"); - - b.Property("Xml") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("DataProtectionKeys"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("RoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("UserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.ToTable("UserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.ToTable("UserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("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.UserEmailClaim", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("EmailClaims") - .HasForeignKey("UserId"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.UserEncryptionKey", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("EncryptionKeys") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("Vaults") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Navigation("EmailClaims"); - - b.Navigation("EncryptionKeys"); - - b.Navigation("Vaults"); - }); - - 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/SqliteMigrations/20241223201909_IncludePostgresqlFixes.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20241223201909_IncludePostgresqlFixes.cs deleted file mode 100644 index ce0d0fd06..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20241223201909_IncludePostgresqlFixes.cs +++ /dev/null @@ -1,55 +0,0 @@ -// -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - /// - public partial class IncludePostgresqlFixes : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "ServiceName", - table: "WorkerServiceStatuses", - type: "TEXT", - maxLength: 255, - nullable: false, - oldClrType: typeof(string), - oldType: "varchar", - oldMaxLength: 255); - - migrationBuilder.AlterColumn( - name: "EventType", - table: "AuthLogs", - type: "INTEGER", - nullable: false, - oldClrType: typeof(int), - oldType: "nvarchar(50)"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "ServiceName", - table: "WorkerServiceStatuses", - type: "varchar", - maxLength: 255, - nullable: false, - oldClrType: typeof(string), - oldType: "TEXT", - oldMaxLength: 255); - - migrationBuilder.AlterColumn( - name: "EventType", - table: "AuthLogs", - type: "nvarchar(50)", - nullable: false, - oldClrType: typeof(int), - oldType: "INTEGER"); - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20241225220908_UpdateAliasVaultEmailClaimNull.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20241225220908_UpdateAliasVaultEmailClaimNull.Designer.cs deleted file mode 100644 index 6c71a53a6..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20241225220908_UpdateAliasVaultEmailClaimNull.Designer.cs +++ /dev/null @@ -1,887 +0,0 @@ -// -using System; -using AliasServerDb; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - [DbContext(typeof(AliasServerDbContextSqlite))] - [Migration("20241225220908_UpdateAliasVaultEmailClaimNull")] - partial class UpdateAliasVaultEmailClaimNull - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.0") - .HasAnnotation("Proxies:ChangeTracking", false) - .HasAnnotation("Proxies:CheckEquality", false) - .HasAnnotation("Proxies:LazyLoading", true); - - modelBuilder.Entity("AliasServerDb.AdminRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AdminUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LastPasswordChanged") - .HasColumnType("TEXT"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("Blocked") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordChangedAt") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("DeviceIdentifier") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("ExpireDate") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("IpAddress") - .HasMaxLength(45) - .HasColumnType("TEXT"); - - b.Property("PreviousTokenValue") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Value") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AliasVaultUserRefreshTokens"); - }); - - modelBuilder.Entity("AliasServerDb.AuthLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AdditionalInfo") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Browser") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("Country") - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("DeviceType") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("EventType") - .HasColumnType("INTEGER"); - - b.Property("FailureReason") - .HasColumnType("INTEGER"); - - b.Property("IpAddress") - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("IsSuccess") - .HasColumnType("INTEGER"); - - b.Property("IsSuspiciousActivity") - .HasColumnType("INTEGER"); - - b.Property("OperatingSystem") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("RequestPath") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("Timestamp") - .HasColumnType("TEXT"); - - b.Property("UserAgent") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - 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.Email", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("DateSystem") - .HasColumnType("TEXT"); - - b.Property("EncryptedSymmetricKey") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("From") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageHtml") - .HasColumnType("TEXT"); - - b.Property("MessagePlain") - .HasColumnType("TEXT"); - - b.Property("MessagePreview") - .HasColumnType("TEXT"); - - b.Property("MessageSource") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("PushNotificationSent") - .HasColumnType("INTEGER"); - - b.Property("Subject") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("To") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UserEncryptionKeyId") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Visible") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Date"); - - b.HasIndex("DateSystem"); - - b.HasIndex("PushNotificationSent"); - - b.HasIndex("ToLocal"); - - b.HasIndex("UserEncryptionKeyId"); - - b.HasIndex("Visible"); - - b.ToTable("Emails"); - }); - - modelBuilder.Entity("AliasServerDb.EmailAttachment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Bytes") - .IsRequired() - .HasColumnType("BLOB"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("EmailId") - .HasColumnType("INTEGER"); - - b.Property("Filename") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Filesize") - .HasColumnType("INTEGER"); - - b.Property("MimeType") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("EmailId"); - - b.ToTable("EmailAttachments"); - }); - - modelBuilder.Entity("AliasServerDb.Log", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Application") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Exception") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Level") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); - - b.Property("LogEvent") - .IsRequired() - .HasColumnType("TEXT") - .HasColumnName("LogEvent"); - - b.Property("Message") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageTemplate") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Properties") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("SourceContext") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("TimeStamp") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Application"); - - b.HasIndex("TimeStamp"); - - b.ToTable("Logs", (string)null); - }); - - modelBuilder.Entity("AliasServerDb.ServerSetting", b => - { - b.Property("Key") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("Key"); - - b.ToTable("ServerSettings"); - }); - - modelBuilder.Entity("AliasServerDb.TaskRunnerJob", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("EndTime") - .HasColumnType("TEXT"); - - b.Property("ErrorMessage") - .HasColumnType("TEXT"); - - b.Property("IsOnDemand") - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("RunDate") - .HasColumnType("TEXT"); - - b.Property("StartTime") - .HasColumnType("TEXT"); - - b.Property("Status") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.ToTable("TaskRunnerJobs"); - }); - - modelBuilder.Entity("AliasServerDb.UserEmailClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("Address") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("AddressDomain") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("AddressLocal") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Address") - .IsUnique(); - - b.HasIndex("UserId"); - - b.ToTable("UserEmailClaims"); - }); - - modelBuilder.Entity("AliasServerDb.UserEncryptionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("IsPrimary") - .HasColumnType("INTEGER"); - - b.Property("PublicKey") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserEncryptionKeys"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("CredentialsCount") - .HasColumnType("INTEGER"); - - b.Property("EmailClaimsCount") - .HasColumnType("INTEGER"); - - b.Property("EncryptionSettings") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("EncryptionType") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FileSize") - .HasColumnType("INTEGER"); - - b.Property("RevisionNumber") - .HasColumnType("INTEGER"); - - b.Property("Salt") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("VaultBlob") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Verifier") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("TEXT"); - - b.Property("Version") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Vaults"); - }); - - modelBuilder.Entity("AliasVault.WorkerStatus.Database.WorkerServiceStatus", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CurrentStatus") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("DesiredStatus") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Heartbeat") - .HasColumnType("TEXT"); - - b.Property("ServiceName") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("WorkerServiceStatuses"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("FriendlyName") - .HasColumnType("TEXT"); - - b.Property("Xml") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("DataProtectionKeys"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("RoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("UserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.ToTable("UserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.ToTable("UserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("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.UserEmailClaim", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("EmailClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.UserEncryptionKey", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("EncryptionKeys") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("Vaults") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Navigation("EmailClaims"); - - b.Navigation("EncryptionKeys"); - - b.Navigation("Vaults"); - }); - - 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/SqliteMigrations/20241225220908_UpdateAliasVaultEmailClaimNull.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20241225220908_UpdateAliasVaultEmailClaimNull.cs deleted file mode 100644 index 857e2b11c..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20241225220908_UpdateAliasVaultEmailClaimNull.cs +++ /dev/null @@ -1,42 +0,0 @@ -// -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - /// - public partial class UpdateAliasVaultEmailClaimNull : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_UserEmailClaims_AliasVaultUsers_UserId", - table: "UserEmailClaims"); - - migrationBuilder.AddForeignKey( - name: "FK_UserEmailClaims_AliasVaultUsers_UserId", - table: "UserEmailClaims", - column: "UserId", - principalTable: "AliasVaultUsers", - principalColumn: "Id", - onDelete: ReferentialAction.SetNull); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_UserEmailClaims_AliasVaultUsers_UserId", - table: "UserEmailClaims"); - - migrationBuilder.AddForeignKey( - name: "FK_UserEmailClaims_AliasVaultUsers_UserId", - table: "UserEmailClaims", - column: "UserId", - principalTable: "AliasVaultUsers", - principalColumn: "Id"); - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20250210101257_AddAuthLogClientHeader.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20250210101257_AddAuthLogClientHeader.Designer.cs deleted file mode 100644 index 0c7f8f1a9..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20250210101257_AddAuthLogClientHeader.Designer.cs +++ /dev/null @@ -1,891 +0,0 @@ -// -using System; -using AliasServerDb; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - [DbContext(typeof(AliasServerDbContextSqlite))] - [Migration("20250210101257_AddAuthLogClientHeader")] - partial class AddAuthLogClientHeader - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.0") - .HasAnnotation("Proxies:ChangeTracking", false) - .HasAnnotation("Proxies:CheckEquality", false) - .HasAnnotation("Proxies:LazyLoading", true); - - modelBuilder.Entity("AliasServerDb.AdminRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AdminUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LastPasswordChanged") - .HasColumnType("TEXT"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("Blocked") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordChangedAt") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("DeviceIdentifier") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("ExpireDate") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("IpAddress") - .HasMaxLength(45) - .HasColumnType("TEXT"); - - b.Property("PreviousTokenValue") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Value") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AliasVaultUserRefreshTokens"); - }); - - modelBuilder.Entity("AliasServerDb.AuthLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AdditionalInfo") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Browser") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("Client") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("Country") - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("DeviceType") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("EventType") - .HasColumnType("INTEGER"); - - b.Property("FailureReason") - .HasColumnType("INTEGER"); - - b.Property("IpAddress") - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("IsSuccess") - .HasColumnType("INTEGER"); - - b.Property("IsSuspiciousActivity") - .HasColumnType("INTEGER"); - - b.Property("OperatingSystem") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("RequestPath") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("Timestamp") - .HasColumnType("TEXT"); - - b.Property("UserAgent") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - 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.Email", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("DateSystem") - .HasColumnType("TEXT"); - - b.Property("EncryptedSymmetricKey") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("From") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageHtml") - .HasColumnType("TEXT"); - - b.Property("MessagePlain") - .HasColumnType("TEXT"); - - b.Property("MessagePreview") - .HasColumnType("TEXT"); - - b.Property("MessageSource") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("PushNotificationSent") - .HasColumnType("INTEGER"); - - b.Property("Subject") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("To") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UserEncryptionKeyId") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Visible") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Date"); - - b.HasIndex("DateSystem"); - - b.HasIndex("PushNotificationSent"); - - b.HasIndex("ToLocal"); - - b.HasIndex("UserEncryptionKeyId"); - - b.HasIndex("Visible"); - - b.ToTable("Emails"); - }); - - modelBuilder.Entity("AliasServerDb.EmailAttachment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Bytes") - .IsRequired() - .HasColumnType("BLOB"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("EmailId") - .HasColumnType("INTEGER"); - - b.Property("Filename") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Filesize") - .HasColumnType("INTEGER"); - - b.Property("MimeType") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("EmailId"); - - b.ToTable("EmailAttachments"); - }); - - modelBuilder.Entity("AliasServerDb.Log", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Application") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Exception") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Level") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); - - b.Property("LogEvent") - .IsRequired() - .HasColumnType("TEXT") - .HasColumnName("LogEvent"); - - b.Property("Message") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageTemplate") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Properties") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("SourceContext") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("TimeStamp") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Application"); - - b.HasIndex("TimeStamp"); - - b.ToTable("Logs", (string)null); - }); - - modelBuilder.Entity("AliasServerDb.ServerSetting", b => - { - b.Property("Key") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("Key"); - - b.ToTable("ServerSettings"); - }); - - modelBuilder.Entity("AliasServerDb.TaskRunnerJob", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("EndTime") - .HasColumnType("TEXT"); - - b.Property("ErrorMessage") - .HasColumnType("TEXT"); - - b.Property("IsOnDemand") - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("RunDate") - .HasColumnType("TEXT"); - - b.Property("StartTime") - .HasColumnType("TEXT"); - - b.Property("Status") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.ToTable("TaskRunnerJobs"); - }); - - modelBuilder.Entity("AliasServerDb.UserEmailClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("Address") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("AddressDomain") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("AddressLocal") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Address") - .IsUnique(); - - b.HasIndex("UserId"); - - b.ToTable("UserEmailClaims"); - }); - - modelBuilder.Entity("AliasServerDb.UserEncryptionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("IsPrimary") - .HasColumnType("INTEGER"); - - b.Property("PublicKey") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserEncryptionKeys"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("CredentialsCount") - .HasColumnType("INTEGER"); - - b.Property("EmailClaimsCount") - .HasColumnType("INTEGER"); - - b.Property("EncryptionSettings") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("EncryptionType") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FileSize") - .HasColumnType("INTEGER"); - - b.Property("RevisionNumber") - .HasColumnType("INTEGER"); - - b.Property("Salt") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("VaultBlob") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Verifier") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("TEXT"); - - b.Property("Version") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Vaults"); - }); - - modelBuilder.Entity("AliasVault.WorkerStatus.Database.WorkerServiceStatus", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CurrentStatus") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("DesiredStatus") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Heartbeat") - .HasColumnType("TEXT"); - - b.Property("ServiceName") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("WorkerServiceStatuses"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("FriendlyName") - .HasColumnType("TEXT"); - - b.Property("Xml") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("DataProtectionKeys"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("RoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("UserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.ToTable("UserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.ToTable("UserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("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.UserEmailClaim", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("EmailClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.UserEncryptionKey", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("EncryptionKeys") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("Vaults") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Navigation("EmailClaims"); - - b.Navigation("EncryptionKeys"); - - b.Navigation("Vaults"); - }); - - 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/SqliteMigrations/20250210101257_AddAuthLogClientHeader.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20250210101257_AddAuthLogClientHeader.cs deleted file mode 100644 index 2f16cff85..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20250210101257_AddAuthLogClientHeader.cs +++ /dev/null @@ -1,30 +0,0 @@ -// -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - /// - public partial class AddAuthLogClientHeader : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "Client", - table: "AuthLogs", - type: "TEXT", - maxLength: 100, - nullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Client", - table: "AuthLogs"); - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20250210122722_AddVaultClientColumn.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20250210122722_AddVaultClientColumn.Designer.cs deleted file mode 100644 index c9a0a3e9d..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20250210122722_AddVaultClientColumn.Designer.cs +++ /dev/null @@ -1,895 +0,0 @@ -// -using System; -using AliasServerDb; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - [DbContext(typeof(AliasServerDbContextSqlite))] - [Migration("20250210122722_AddVaultClientColumn")] - partial class AddVaultClientColumn - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.0") - .HasAnnotation("Proxies:ChangeTracking", false) - .HasAnnotation("Proxies:CheckEquality", false) - .HasAnnotation("Proxies:LazyLoading", true); - - modelBuilder.Entity("AliasServerDb.AdminRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AdminUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LastPasswordChanged") - .HasColumnType("TEXT"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("Blocked") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordChangedAt") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("DeviceIdentifier") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("ExpireDate") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("IpAddress") - .HasMaxLength(45) - .HasColumnType("TEXT"); - - b.Property("PreviousTokenValue") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Value") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AliasVaultUserRefreshTokens"); - }); - - modelBuilder.Entity("AliasServerDb.AuthLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AdditionalInfo") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Browser") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("Client") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("Country") - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("DeviceType") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("EventType") - .HasColumnType("INTEGER"); - - b.Property("FailureReason") - .HasColumnType("INTEGER"); - - b.Property("IpAddress") - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("IsSuccess") - .HasColumnType("INTEGER"); - - b.Property("IsSuspiciousActivity") - .HasColumnType("INTEGER"); - - b.Property("OperatingSystem") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("RequestPath") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("Timestamp") - .HasColumnType("TEXT"); - - b.Property("UserAgent") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - 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.Email", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("DateSystem") - .HasColumnType("TEXT"); - - b.Property("EncryptedSymmetricKey") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("From") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageHtml") - .HasColumnType("TEXT"); - - b.Property("MessagePlain") - .HasColumnType("TEXT"); - - b.Property("MessagePreview") - .HasColumnType("TEXT"); - - b.Property("MessageSource") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("PushNotificationSent") - .HasColumnType("INTEGER"); - - b.Property("Subject") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("To") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UserEncryptionKeyId") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Visible") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Date"); - - b.HasIndex("DateSystem"); - - b.HasIndex("PushNotificationSent"); - - b.HasIndex("ToLocal"); - - b.HasIndex("UserEncryptionKeyId"); - - b.HasIndex("Visible"); - - b.ToTable("Emails"); - }); - - modelBuilder.Entity("AliasServerDb.EmailAttachment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Bytes") - .IsRequired() - .HasColumnType("BLOB"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("EmailId") - .HasColumnType("INTEGER"); - - b.Property("Filename") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Filesize") - .HasColumnType("INTEGER"); - - b.Property("MimeType") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("EmailId"); - - b.ToTable("EmailAttachments"); - }); - - modelBuilder.Entity("AliasServerDb.Log", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Application") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Exception") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Level") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); - - b.Property("LogEvent") - .IsRequired() - .HasColumnType("TEXT") - .HasColumnName("LogEvent"); - - b.Property("Message") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageTemplate") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Properties") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("SourceContext") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("TimeStamp") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Application"); - - b.HasIndex("TimeStamp"); - - b.ToTable("Logs", (string)null); - }); - - modelBuilder.Entity("AliasServerDb.ServerSetting", b => - { - b.Property("Key") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("Key"); - - b.ToTable("ServerSettings"); - }); - - modelBuilder.Entity("AliasServerDb.TaskRunnerJob", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("EndTime") - .HasColumnType("TEXT"); - - b.Property("ErrorMessage") - .HasColumnType("TEXT"); - - b.Property("IsOnDemand") - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("RunDate") - .HasColumnType("TEXT"); - - b.Property("StartTime") - .HasColumnType("TEXT"); - - b.Property("Status") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.ToTable("TaskRunnerJobs"); - }); - - modelBuilder.Entity("AliasServerDb.UserEmailClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("Address") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("AddressDomain") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("AddressLocal") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Address") - .IsUnique(); - - b.HasIndex("UserId"); - - b.ToTable("UserEmailClaims"); - }); - - modelBuilder.Entity("AliasServerDb.UserEncryptionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("IsPrimary") - .HasColumnType("INTEGER"); - - b.Property("PublicKey") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserEncryptionKeys"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("Client") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("CredentialsCount") - .HasColumnType("INTEGER"); - - b.Property("EmailClaimsCount") - .HasColumnType("INTEGER"); - - b.Property("EncryptionSettings") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("EncryptionType") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FileSize") - .HasColumnType("INTEGER"); - - b.Property("RevisionNumber") - .HasColumnType("INTEGER"); - - b.Property("Salt") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("VaultBlob") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Verifier") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("TEXT"); - - b.Property("Version") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Vaults"); - }); - - modelBuilder.Entity("AliasVault.WorkerStatus.Database.WorkerServiceStatus", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CurrentStatus") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("DesiredStatus") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Heartbeat") - .HasColumnType("TEXT"); - - b.Property("ServiceName") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("WorkerServiceStatuses"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("FriendlyName") - .HasColumnType("TEXT"); - - b.Property("Xml") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("DataProtectionKeys"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("RoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("UserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.ToTable("UserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.ToTable("UserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("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.UserEmailClaim", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("EmailClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.UserEncryptionKey", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("EncryptionKeys") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("Vaults") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Navigation("EmailClaims"); - - b.Navigation("EncryptionKeys"); - - b.Navigation("Vaults"); - }); - - 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/SqliteMigrations/20250210122722_AddVaultClientColumn.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20250210122722_AddVaultClientColumn.cs deleted file mode 100644 index dbb1f08d0..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20250210122722_AddVaultClientColumn.cs +++ /dev/null @@ -1,30 +0,0 @@ -// -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - /// - public partial class AddVaultClientColumn : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "Client", - table: "Vaults", - type: "TEXT", - maxLength: 255, - nullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Client", - table: "Vaults"); - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20250320101616_AddEmailClaimDisabledFlag.Designer.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20250320101616_AddEmailClaimDisabledFlag.Designer.cs deleted file mode 100644 index eb5a444c9..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20250320101616_AddEmailClaimDisabledFlag.Designer.cs +++ /dev/null @@ -1,898 +0,0 @@ -// -using System; -using AliasServerDb; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - [DbContext(typeof(AliasServerDbContextSqlite))] - [Migration("20250320101616_AddEmailClaimDisabledFlag")] - partial class AddEmailClaimDisabledFlag - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.3") - .HasAnnotation("Proxies:ChangeTracking", false) - .HasAnnotation("Proxies:CheckEquality", false) - .HasAnnotation("Proxies:LazyLoading", true); - - modelBuilder.Entity("AliasServerDb.AdminRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AdminUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LastPasswordChanged") - .HasColumnType("TEXT"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("Blocked") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordChangedAt") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("DeviceIdentifier") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("ExpireDate") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("IpAddress") - .HasMaxLength(45) - .HasColumnType("TEXT"); - - b.Property("PreviousTokenValue") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Value") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AliasVaultUserRefreshTokens"); - }); - - modelBuilder.Entity("AliasServerDb.AuthLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AdditionalInfo") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Browser") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("Client") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("Country") - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("DeviceType") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("EventType") - .HasColumnType("INTEGER"); - - b.Property("FailureReason") - .HasColumnType("INTEGER"); - - b.Property("IpAddress") - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("IsSuccess") - .HasColumnType("INTEGER"); - - b.Property("IsSuspiciousActivity") - .HasColumnType("INTEGER"); - - b.Property("OperatingSystem") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("RequestPath") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("Timestamp") - .HasColumnType("TEXT"); - - b.Property("UserAgent") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - 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.Email", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("DateSystem") - .HasColumnType("TEXT"); - - b.Property("EncryptedSymmetricKey") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("From") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageHtml") - .HasColumnType("TEXT"); - - b.Property("MessagePlain") - .HasColumnType("TEXT"); - - b.Property("MessagePreview") - .HasColumnType("TEXT"); - - b.Property("MessageSource") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("PushNotificationSent") - .HasColumnType("INTEGER"); - - b.Property("Subject") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("To") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UserEncryptionKeyId") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Visible") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Date"); - - b.HasIndex("DateSystem"); - - b.HasIndex("PushNotificationSent"); - - b.HasIndex("ToLocal"); - - b.HasIndex("UserEncryptionKeyId"); - - b.HasIndex("Visible"); - - b.ToTable("Emails"); - }); - - modelBuilder.Entity("AliasServerDb.EmailAttachment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Bytes") - .IsRequired() - .HasColumnType("BLOB"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("EmailId") - .HasColumnType("INTEGER"); - - b.Property("Filename") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Filesize") - .HasColumnType("INTEGER"); - - b.Property("MimeType") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("EmailId"); - - b.ToTable("EmailAttachments"); - }); - - modelBuilder.Entity("AliasServerDb.Log", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Application") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Exception") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Level") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); - - b.Property("LogEvent") - .IsRequired() - .HasColumnType("TEXT") - .HasColumnName("LogEvent"); - - b.Property("Message") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageTemplate") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Properties") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("SourceContext") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("TimeStamp") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Application"); - - b.HasIndex("TimeStamp"); - - b.ToTable("Logs", (string)null); - }); - - modelBuilder.Entity("AliasServerDb.ServerSetting", b => - { - b.Property("Key") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("Key"); - - b.ToTable("ServerSettings"); - }); - - modelBuilder.Entity("AliasServerDb.TaskRunnerJob", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("EndTime") - .HasColumnType("TEXT"); - - b.Property("ErrorMessage") - .HasColumnType("TEXT"); - - b.Property("IsOnDemand") - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("RunDate") - .HasColumnType("TEXT"); - - b.Property("StartTime") - .HasColumnType("TEXT"); - - b.Property("Status") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.ToTable("TaskRunnerJobs"); - }); - - modelBuilder.Entity("AliasServerDb.UserEmailClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("Address") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("AddressDomain") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("AddressLocal") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("Disabled") - .HasColumnType("INTEGER"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Address") - .IsUnique(); - - b.HasIndex("UserId"); - - b.ToTable("UserEmailClaims"); - }); - - modelBuilder.Entity("AliasServerDb.UserEncryptionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("IsPrimary") - .HasColumnType("INTEGER"); - - b.Property("PublicKey") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserEncryptionKeys"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("Client") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("CredentialsCount") - .HasColumnType("INTEGER"); - - b.Property("EmailClaimsCount") - .HasColumnType("INTEGER"); - - b.Property("EncryptionSettings") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("EncryptionType") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FileSize") - .HasColumnType("INTEGER"); - - b.Property("RevisionNumber") - .HasColumnType("INTEGER"); - - b.Property("Salt") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("VaultBlob") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Verifier") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("TEXT"); - - b.Property("Version") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Vaults"); - }); - - modelBuilder.Entity("AliasVault.WorkerStatus.Database.WorkerServiceStatus", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CurrentStatus") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("DesiredStatus") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Heartbeat") - .HasColumnType("TEXT"); - - b.Property("ServiceName") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("WorkerServiceStatuses"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("FriendlyName") - .HasColumnType("TEXT"); - - b.Property("Xml") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("DataProtectionKeys"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("RoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("UserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.ToTable("UserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.ToTable("UserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("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.UserEmailClaim", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("EmailClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.UserEncryptionKey", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("EncryptionKeys") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("Vaults") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Navigation("EmailClaims"); - - b.Navigation("EncryptionKeys"); - - b.Navigation("Vaults"); - }); - - 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/SqliteMigrations/20250320101616_AddEmailClaimDisabledFlag.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20250320101616_AddEmailClaimDisabledFlag.cs deleted file mode 100644 index 2272212bf..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/20250320101616_AddEmailClaimDisabledFlag.cs +++ /dev/null @@ -1,30 +0,0 @@ -// -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - /// - public partial class AddEmailClaimDisabledFlag : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "Disabled", - table: "UserEmailClaims", - type: "INTEGER", - nullable: false, - defaultValue: false); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Disabled", - table: "UserEmailClaims"); - } - } -} diff --git a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/AliasServerDbContextSqliteModelSnapshot.cs b/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/AliasServerDbContextSqliteModelSnapshot.cs deleted file mode 100644 index 645f98ddf..000000000 --- a/apps/server/Databases/AliasServerDb/Migrations/SqliteMigrations/AliasServerDbContextSqliteModelSnapshot.cs +++ /dev/null @@ -1,895 +0,0 @@ -// -using System; -using AliasServerDb; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AliasServerDb.Migrations.SqliteMigrations -{ - [DbContext(typeof(AliasServerDbContextSqlite))] - partial class AliasServerDbContextSqliteModelSnapshot : ModelSnapshot - { - protected override void BuildModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.3") - .HasAnnotation("Proxies:ChangeTracking", false) - .HasAnnotation("Proxies:CheckEquality", false) - .HasAnnotation("Proxies:LazyLoading", true); - - modelBuilder.Entity("AliasServerDb.AdminRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AdminUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LastPasswordChanged") - .HasColumnType("TEXT"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AdminUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultRoles"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("Blocked") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT"); - - b.Property("PasswordChangedAt") - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserName") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("AliasVaultUsers"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUserRefreshToken", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("DeviceIdentifier") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("ExpireDate") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("IpAddress") - .HasMaxLength(45) - .HasColumnType("TEXT"); - - b.Property("PreviousTokenValue") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Value") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AliasVaultUserRefreshTokens"); - }); - - modelBuilder.Entity("AliasServerDb.AuthLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AdditionalInfo") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Browser") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("Client") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("Country") - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("DeviceType") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("EventType") - .HasColumnType("INTEGER"); - - b.Property("FailureReason") - .HasColumnType("INTEGER"); - - b.Property("IpAddress") - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("IsSuccess") - .HasColumnType("INTEGER"); - - b.Property("IsSuspiciousActivity") - .HasColumnType("INTEGER"); - - b.Property("OperatingSystem") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("RequestPath") - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("Timestamp") - .HasColumnType("TEXT"); - - b.Property("UserAgent") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - 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.Email", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("DateSystem") - .HasColumnType("TEXT"); - - b.Property("EncryptedSymmetricKey") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("From") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FromLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageHtml") - .HasColumnType("TEXT"); - - b.Property("MessagePlain") - .HasColumnType("TEXT"); - - b.Property("MessagePreview") - .HasColumnType("TEXT"); - - b.Property("MessageSource") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("PushNotificationSent") - .HasColumnType("INTEGER"); - - b.Property("Subject") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("To") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToDomain") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ToLocal") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UserEncryptionKeyId") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("Visible") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Date"); - - b.HasIndex("DateSystem"); - - b.HasIndex("PushNotificationSent"); - - b.HasIndex("ToLocal"); - - b.HasIndex("UserEncryptionKeyId"); - - b.HasIndex("Visible"); - - b.ToTable("Emails"); - }); - - modelBuilder.Entity("AliasServerDb.EmailAttachment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Bytes") - .IsRequired() - .HasColumnType("BLOB"); - - b.Property("Date") - .HasColumnType("TEXT"); - - b.Property("EmailId") - .HasColumnType("INTEGER"); - - b.Property("Filename") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Filesize") - .HasColumnType("INTEGER"); - - b.Property("MimeType") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("EmailId"); - - b.ToTable("EmailAttachments"); - }); - - modelBuilder.Entity("AliasServerDb.Log", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Application") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Exception") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Level") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); - - b.Property("LogEvent") - .IsRequired() - .HasColumnType("TEXT") - .HasColumnName("LogEvent"); - - b.Property("Message") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("MessageTemplate") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Properties") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("SourceContext") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("TimeStamp") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Application"); - - b.HasIndex("TimeStamp"); - - b.ToTable("Logs", (string)null); - }); - - modelBuilder.Entity("AliasServerDb.ServerSetting", b => - { - b.Property("Key") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("Key"); - - b.ToTable("ServerSettings"); - }); - - modelBuilder.Entity("AliasServerDb.TaskRunnerJob", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("EndTime") - .HasColumnType("TEXT"); - - b.Property("ErrorMessage") - .HasColumnType("TEXT"); - - b.Property("IsOnDemand") - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("RunDate") - .HasColumnType("TEXT"); - - b.Property("StartTime") - .HasColumnType("TEXT"); - - b.Property("Status") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.ToTable("TaskRunnerJobs"); - }); - - modelBuilder.Entity("AliasServerDb.UserEmailClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("Address") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("AddressDomain") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("AddressLocal") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("Disabled") - .HasColumnType("INTEGER"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Address") - .IsUnique(); - - b.HasIndex("UserId"); - - b.ToTable("UserEmailClaims"); - }); - - modelBuilder.Entity("AliasServerDb.UserEncryptionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("IsPrimary") - .HasColumnType("INTEGER"); - - b.Property("PublicKey") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserEncryptionKeys"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("Client") - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("CredentialsCount") - .HasColumnType("INTEGER"); - - b.Property("EmailClaimsCount") - .HasColumnType("INTEGER"); - - b.Property("EncryptionSettings") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("EncryptionType") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FileSize") - .HasColumnType("INTEGER"); - - b.Property("RevisionNumber") - .HasColumnType("INTEGER"); - - b.Property("Salt") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.Property("UpdatedAt") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.Property("VaultBlob") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Verifier") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("TEXT"); - - b.Property("Version") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Vaults"); - }); - - modelBuilder.Entity("AliasVault.WorkerStatus.Database.WorkerServiceStatus", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CurrentStatus") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("DesiredStatus") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Heartbeat") - .HasColumnType("TEXT"); - - b.Property("ServiceName") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("WorkerServiceStatuses"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("FriendlyName") - .HasColumnType("TEXT"); - - b.Property("Xml") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("DataProtectionKeys"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("RoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("UserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.ToTable("UserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.ToTable("UserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("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.UserEmailClaim", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("EmailClaims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.UserEncryptionKey", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("EncryptionKeys") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.Vault", b => - { - b.HasOne("AliasServerDb.AliasVaultUser", "User") - .WithMany("Vaults") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AliasServerDb.AliasVaultUser", b => - { - b.Navigation("EmailClaims"); - - b.Navigation("EncryptionKeys"); - - b.Navigation("Vaults"); - }); - - 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/PostgresqlDbContextFactory.cs b/apps/server/Databases/AliasServerDb/PostgresqlDbContextFactory.cs index e2150f09d..5afbd2276 100644 --- a/apps/server/Databases/AliasServerDb/PostgresqlDbContextFactory.cs +++ b/apps/server/Databases/AliasServerDb/PostgresqlDbContextFactory.cs @@ -11,7 +11,7 @@ using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; /// -/// The AliasServerDbContextFactory interface. +/// The PostgreSQL DbContext factory. /// public class PostgresqlDbContextFactory : IAliasServerDbContextFactory { @@ -32,7 +32,7 @@ public class PostgresqlDbContextFactory : IAliasServerDbContextFactory var optionsBuilder = new DbContextOptionsBuilder(); ConfigureDbContextOptions(optionsBuilder); - return new AliasServerDbContextPostgresql(optionsBuilder.Options); + return new AliasServerDbContext(optionsBuilder.Options); } /// diff --git a/apps/server/Databases/AliasServerDb/SqliteDbContextFactory.cs b/apps/server/Databases/AliasServerDb/SqliteDbContextFactory.cs deleted file mode 100644 index d93ddc3fd..000000000 --- a/apps/server/Databases/AliasServerDb/SqliteDbContextFactory.cs +++ /dev/null @@ -1,53 +0,0 @@ -//----------------------------------------------------------------------- -// -// Copyright (c) lanedirt. All rights reserved. -// Licensed under the AGPLv3 license. See LICENSE.md file in the project root for full license information. -// -//----------------------------------------------------------------------- - -namespace AliasServerDb; - -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Configuration; - -/// -/// The AliasServerDbContextFactory interface. -/// -public class SqliteDbContextFactory : IAliasServerDbContextFactory -{ - private readonly IConfiguration _configuration; - - /// - /// Initializes a new instance of the class. - /// - /// The configuration. - public SqliteDbContextFactory(IConfiguration configuration) - { - _configuration = configuration; - } - - /// - public void ConfigureDbContextOptions(DbContextOptionsBuilder optionsBuilder) - { - var connectionString = _configuration.GetConnectionString("AliasServerDbContext") + - ";Mode=ReadWriteCreate;Cache=Shared"; - - optionsBuilder - .UseSqlite(connectionString, options => options.CommandTimeout(60)) - .UseLazyLoadingProxies(); - } - - /// - public AliasServerDbContext CreateDbContext() - { - var optionsBuilder = new DbContextOptionsBuilder(); - ConfigureDbContextOptions(optionsBuilder); - return new AliasServerDbContextSqlite(optionsBuilder.Options); - } - - /// - public Task CreateDbContextAsync(CancellationToken cancellationToken = default) - { - return Task.FromResult(CreateDbContext()); - } -} diff --git a/apps/server/Utilities/AliasVault.InstallCli/Program.cs b/apps/server/Utilities/AliasVault.InstallCli/Program.cs index ebe8bfb83..262fce9ba 100644 --- a/apps/server/Utilities/AliasVault.InstallCli/Program.cs +++ b/apps/server/Utilities/AliasVault.InstallCli/Program.cs @@ -11,7 +11,7 @@ using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata; // Add return type for top-level statements -return await Run(args); +return Run(args); /// /// Handles the migration of data between SQLite and PostgreSQL databases and password hashing utilities. @@ -23,13 +23,12 @@ public static partial class Program /// /// The command-line arguments. /// The exit code of the program. - public static async Task Run(string[] args) + public static int Run(string[] args) { if (args.Length == 0) { Console.WriteLine("Usage:"); Console.WriteLine(" hash-password "); - Console.WriteLine(" migrate-sqlite "); return 1; } @@ -44,19 +43,9 @@ public static partial class Program return HashPassword(args[1]); - case "migrate-sqlite": - if (args.Length != 3) - { - Console.WriteLine("Usage: migrate-sqlite "); - return 1; - } - - return await MigrateSqliteToPostgres(args[1], args[2]); - default: Console.WriteLine("Unknown command. Available commands:"); Console.WriteLine(" hash-password "); - Console.WriteLine(" migrate-sqlite "); return 1; } } @@ -76,274 +65,4 @@ public static partial class Program Console.WriteLine(hashedPassword); return 0; } - - /// - /// Migrates data from a SQLite database to a PostgreSQL database. - /// - /// The file path to the source SQLite database. - /// The connection string to the PostgreSQL database. - /// - /// Returns 0 if migration was successful, 1 if an error occurred. - /// - /// Thrown when a migration error occurs. - private static async Task MigrateSqliteToPostgres(string sqliteDbPath, string pgConnString) - { - try - { - if (!File.Exists(sqliteDbPath)) - { - Console.WriteLine($"Error: SQLite database not found at {sqliteDbPath}"); - return 1; - } - - Console.WriteLine($"Migrating SQLite database to PostgreSQL - start"); - - // Create connections to both databases - var sqliteConnString = $"Data Source={sqliteDbPath}"; - - // Create contexts - var optionsBuilderSqlite = new DbContextOptionsBuilder() - .UseSqlite(sqliteConnString); - - var optionsBuilderPg = new DbContextOptionsBuilder() - .UseNpgsql(pgConnString); - - // Make sure sqlite is on latest version migration - Console.WriteLine("Update sqlite database to latest version..."); - await using var sqliteContext = new AliasServerDbContextSqlite(optionsBuilderSqlite.Options); - await sqliteContext.Database.MigrateAsync(); - Console.WriteLine("Updating finished."); - - // Make sure postgres is on latest version migration - Console.WriteLine("Update postgres database to latest version..."); - await using var pgContext = new AliasServerDbContextPostgresql(optionsBuilderPg.Options); - await pgContext.Database.MigrateAsync(); - Console.WriteLine("Updating finished."); - - Console.WriteLine("Truncating existing tables in reverse dependency order..."); - - // Truncate tables in reverse order of dependencies - await TruncateTable(pgContext.EmailAttachments, "EmailAttachments"); - await TruncateTable(pgContext.Emails, "Emails"); - await TruncateTable(pgContext.UserTokens, "UserTokens"); - await TruncateTable(pgContext.UserRoles, "UserRoles"); - await TruncateTable(pgContext.UserLogin, "UserLogins"); - await TruncateTable(pgContext.UserEmailClaims, "UserEmailClaims"); - await TruncateTable(pgContext.Vaults, "Vaults"); - await TruncateTable(pgContext.UserEncryptionKeys, "UserEncryptionKeys"); - await TruncateTable(pgContext.AliasVaultUserRefreshTokens, "AliasVaultUserRefreshTokens"); - await TruncateTable(pgContext.Logs, "Logs"); - await TruncateTable(pgContext.AuthLogs, "AuthLogs"); - await TruncateTable(pgContext.DataProtectionKeys, "DataProtectionKeys"); - await TruncateTable(pgContext.ServerSettings, "ServerSettings"); - await TruncateTable(pgContext.TaskRunnerJobs, "TaskRunnerJobs"); - await TruncateTable(pgContext.AliasVaultUsers, "AliasVaultUsers"); - await TruncateTable(pgContext.AliasVaultRoles, "AliasVaultRoles"); - await TruncateTable(pgContext.AdminUsers, "AdminUsers"); - - Console.WriteLine("Starting content migration..."); - - // First, migrate tables without foreign key dependencies - await MigrateTable(sqliteContext.AliasVaultRoles, pgContext.AliasVaultRoles, pgContext, "AliasVaultRoles"); - await MigrateTable(sqliteContext.AliasVaultUsers, pgContext.AliasVaultUsers, pgContext, "AliasVaultUsers"); - await MigrateTable(sqliteContext.ServerSettings, pgContext.ServerSettings, pgContext, "ServerSettings"); - await MigrateTable(sqliteContext.TaskRunnerJobs, pgContext.TaskRunnerJobs, pgContext, "TaskRunnerJobs", true); - await MigrateTable(sqliteContext.DataProtectionKeys, pgContext.DataProtectionKeys, pgContext, "DataProtectionKeys", true); - await MigrateTable(sqliteContext.Logs, pgContext.Logs, pgContext, "Logs", true); - await MigrateTable(sqliteContext.AuthLogs, pgContext.AuthLogs, pgContext, "AuthLogs", true); - await MigrateTable(sqliteContext.AdminUsers, pgContext.AdminUsers, pgContext, "AdminUsers"); - - // Then migrate tables with foreign key dependencies - await MigrateTable(sqliteContext.AliasVaultUserRefreshTokens, pgContext.AliasVaultUserRefreshTokens, pgContext, "AliasVaultUserRefreshTokens"); - await MigrateTable(sqliteContext.UserEncryptionKeys, pgContext.UserEncryptionKeys, pgContext, "UserEncryptionKeys"); - await MigrateTable(sqliteContext.UserEmailClaims, pgContext.UserEmailClaims, pgContext, "UserEmailClaims"); - await MigrateTable(sqliteContext.Vaults, pgContext.Vaults, pgContext, "Vaults"); - - // Identity framework related tables - await MigrateTable(sqliteContext.UserRoles, pgContext.UserRoles, pgContext, "UserRoles"); - await MigrateTable(sqliteContext.UserLogin, pgContext.UserLogin, pgContext, "UserLogins"); - await MigrateTable(sqliteContext.UserTokens, pgContext.UserTokens, pgContext, "UserTokens"); - - // Email related tables (last due to dependencies) - await MigrateTable(sqliteContext.Emails, pgContext.Emails, pgContext, "Emails", true); - await MigrateTable(sqliteContext.EmailAttachments, pgContext.EmailAttachments, pgContext, "EmailAttachments", true); - - Console.WriteLine("Migration completed successfully!"); - return 0; - } - catch (Exception ex) - { - Console.WriteLine($"Error during migration: {ex.Message}"); - Console.WriteLine(ex.InnerException); - return 1; - } - } - - /// - /// Truncates a table in the PostgreSQL database. - /// - /// The entity type of the table being truncated. - /// The database table to truncate. - /// The name of the table being truncated (for logging purposes). - /// A task representing the asynchronous truncation operation. - private static async Task TruncateTable(DbSet table, string tableName) - where T : class - { - Console.WriteLine($"Truncating table {tableName}..."); - var count = await table.CountAsync(); - if (count > 0) - { - await table.ExecuteDeleteAsync(); - Console.WriteLine($"Removed {count} records from {tableName}"); - } - } - - /// - /// Migrates data from one database table to another, handling the transfer in batches. - /// - /// The entity type of the table being migrated. - /// The source database table. - /// The destination database table. - /// The destination database context. - /// The name of the table being migrated (for logging purposes). - /// Whether to reset the sequence for the table after migration. - /// A task representing the asynchronous migration operation. - /// - /// Thrown when the number of records in source and destination tables don't match after migration. - /// - /// - /// Thrown when a concurrency conflict occurs during the migration. - /// - private static async Task MigrateTable( - DbSet source, - DbSet destination, - DbContext destinationContext, - string tableName, - bool resetSequence = false) - where T : class - { - Console.WriteLine($"Migrating {tableName}..."); - - var items = await source.ToListAsync(); - Console.WriteLine($"Found {items.Count} records to migrate"); - - if (items.Count > 0) - { - // Get entity type from the model to check annotations - var entityType = destinationContext.Model.FindEntityType(typeof(T)); - - foreach (var item in items) - { - HandleMaxLengthConstraints(item, entityType!, tableName); - } - - const int batchSize = 50; - foreach (var batch in items.Chunk(batchSize)) - { - try - { - await destination.AddRangeAsync(batch); - await destinationContext.SaveChangesAsync(); - Console.WriteLine($"Migrated {batch.Length} records from {tableName}"); - } - catch (DbUpdateConcurrencyException ex) - { - Console.WriteLine($"Concurrency conflict occurred during migration of {tableName}..."); - await HandleConcurrencyConflict(ex, destinationContext); - Console.WriteLine($"Concurrency conflict resolved, {batch.Length} records inserted"); - } - } - - // Handle sequence reset logic... - if (resetSequence && destinationContext.Database.ProviderName == "Npgsql.EntityFrameworkCore.PostgreSQL") - { - await ResetSequence(destinationContext, tableName); - } - } - - // Ensure that the amount of records in the source and destination tables match - if (await source.CountAsync() > await destination.CountAsync()) - { - throw new ArgumentException($"The amount of records in the source is greater than the destination. Check if the migration is working correctly."); - } - } - - /// - /// Handles max length constraints for string properties in an entity. - /// - /// The entity type containing the properties to be processed. - /// The entity instance containing the properties to be processed. - /// The entity type to be processed. - /// The name of the table being processed (for logging purposes). - private static void HandleMaxLengthConstraints(T item, IEntityType entityType, string tableName) - where T : class - { - foreach (var property in entityType.GetProperties()) - { - // Only process string properties - if (property.ClrType == typeof(string)) - { - var maxLength = property.GetMaxLength(); - if (maxLength.HasValue) - { - var propertyInfo = typeof(T).GetProperty(property.Name); - var value = propertyInfo?.GetValue(item) as string; - - if (value?.Length > maxLength.Value) - { - propertyInfo!.SetValue(item, value.Substring(0, maxLength.Value)); - Console.WriteLine($"Truncated {property.Name} in {tableName} from {value.Length} to {maxLength.Value} characters"); - } - } - } - } - } - - /// - /// Resets the sequence for a table in the PostgreSQL database. - /// - /// The entity type of the table being reset. - /// The destination database context. - /// The name of the table being reset (for logging purposes). - /// A task representing the asynchronous operation. - private static async Task ResetSequence(DbContext destinationContext, string tableName) - where T : class - { - var tablePgName = destinationContext.Model.FindEntityType(typeof(T))?.GetTableName(); - if (!string.IsNullOrEmpty(tablePgName)) - { - var schema = destinationContext.Model.FindEntityType(typeof(T))?.GetSchema() ?? "public"; - var sql = $""" - SELECT setval(pg_get_serial_sequence('{schema}."{tablePgName}"', 'Id'), - (SELECT COALESCE(MAX("Id"::integer), 0) + 1 FROM {schema}."{tablePgName}"), false); - """; - await destinationContext.Database.ExecuteSqlRawAsync(sql); - Console.WriteLine($"Reset sequence for {tableName}"); - } - } - - /// - /// Handles a concurrency conflict by updating the original values with the database values. - /// - /// The DbUpdateConcurrencyException that occurred. - /// The destination database context. - /// A task representing the asynchronous operation. - private static async Task HandleConcurrencyConflict( - DbUpdateConcurrencyException ex, - DbContext destinationContext) - { - foreach (var entry in ex.Entries) - { - var databaseValues = await entry.GetDatabaseValuesAsync(); - if (databaseValues == null) - { - entry.State = EntityState.Detached; - } - else - { - entry.OriginalValues.SetValues(databaseValues); - await destinationContext.SaveChangesAsync(); - } - } - } } diff --git a/apps/server/Utilities/AliasVault.Logging/AliasVault.Logging.csproj b/apps/server/Utilities/AliasVault.Logging/AliasVault.Logging.csproj index fed0ae3a1..a6271cd35 100644 --- a/apps/server/Utilities/AliasVault.Logging/AliasVault.Logging.csproj +++ b/apps/server/Utilities/AliasVault.Logging/AliasVault.Logging.csproj @@ -28,7 +28,6 @@ - all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/database/README.md b/database/README.md index b9289f295..6b02f5249 100644 --- a/database/README.md +++ b/database/README.md @@ -1,5 +1,3 @@ -This is the default location where the SQLite database is stored. +This is the default location where the Postgres database files are stored (configured via Docker filesystem mounts). -The database is created during the first run of the application. - -For production use, it is recommended to switch to a more secure database, such as SQL Server or PostgreSQL. +The database is created during the first run of the application. \ No newline at end of file diff --git a/docs/installation/update/index.md b/docs/installation/update/index.md index 1ef67ed08..fe60ae57a 100644 --- a/docs/installation/update/index.md +++ b/docs/installation/update/index.md @@ -34,9 +34,9 @@ For most version updates, you can use the standard update process: > Tip: to skip the confirmation prompts and automatically proceed with the update, use the `-y` flag: `./install.sh update -y` ## Version-Specific Upgrade Guides -Some versions require additional steps during upgrade. If you are upgrading from an older version, please check the relevant upgrade guide below: +Upgrading from certain earlier versions require additional steps during upgrade. If you are upgrading from an older version, please check the relevant articles below if it applies to your server: -- [Updating to v0.10.0](v0.10.0.html) - SQLite to PostgreSQL migration +- [Updating from < v0.10.0](v0.10.0.html) - SQLite to PostgreSQL migration ## Additional Update Options diff --git a/docs/installation/update/v0.10.0.md b/docs/installation/update/v0.10.0.md index 554109694..b0c32ea1b 100644 --- a/docs/installation/update/v0.10.0.md +++ b/docs/installation/update/v0.10.0.md @@ -1,17 +1,20 @@ --- layout: default -title: Update to v0.10.0 +title: Update from < v0.10.0 parent: Update grand_parent: Server Installation nav_order: 1 --- -# Upgrading to v0.10.0 +# Updating from < v0.10.0 {: .no_toc } -This guide covers the upgrade process from version < v0.10.0 to v0.10.0 or newer, which includes a one-time database migration from SQLite to PostgreSQL. +This guide covers the upgrade process from version < v0.10.0 to the latest version. Due to significant database changes, this upgrade must be performed in two steps: -The v0.10.0 release introduces a new database backend, PostgreSQL, which replaces SQLite. This change is required because SQLite is not suitable for environments with concurrent writes that AliasVault requires. +1. First upgrade to version 0.17.0 and perform the database migration +2. Then upgrade to version 0.18.0 or greater + +Since the v0.10.0 release the database backend has changed from SQLite to PostgreSQL. This change is required because SQLite is not suitable for environments with concurrent writes that AliasVault requires. A built-in database migration tool is included in the installer script to help you migrate your data from SQLite to PostgreSQL. @@ -21,14 +24,17 @@ A built-in database migration tool is included in the installer script to help y ```bash cp database/AliasServerDb.sqlite database/AliasServerDb.sqlite.backup ``` -2. Update AliasVault to the latest version: + +2. Update AliasVault to version 0.17.0: ```bash -./install.sh update +./install.sh install 0.17.0 ``` + 3. Run the database migration tool: ```bash ./install.sh migrate-db ``` + 4. After the migration has completed successfully, restart all AliasVault containers: ```bash ./install.sh restart @@ -36,4 +42,9 @@ cp database/AliasServerDb.sqlite database/AliasServerDb.sqlite.backup 5. Test the upgrade by logging in to the admin panel and checking that your data is intact. +6. Once you've confirmed everything is working correctly, you can update to the latest version: +```bash +./install.sh update +``` + If you encounter any issues during the upgrade, please create an issue on the [GitHub repository](https://github.com/lanedirt/AliasVault/issues) or contact via Discord. diff --git a/install.sh b/install.sh index e5abcb07d..ff7b8402c 100755 --- a/install.sh +++ b/install.sh @@ -58,7 +58,6 @@ show_usage() { printf " db-import Import database from file\n" printf "\n" printf " configure-dev-db Enable/disable development database (for local development only)\n" - printf " migrate-db Migrate data from SQLite to PostgreSQL (only when upgrading from a version prior to 0.10.0)\n" printf "\n" printf "Options:\n" printf " --verbose Show detailed output\n" @@ -282,9 +281,6 @@ main() { "configure-dev-db") configure_dev_database ;; - "migrate-db") - handle_migrate_db - ;; "db-export") handle_db_export ;; @@ -1777,98 +1773,6 @@ print_dev_db_details() { printf "${MAGENTA}=========================================================${NC}\n" } -# Function to handle database migration. This is a one-time operation necessary when upgrading from <= 0.9.x to 0.10.0+ and only needs to be run once. -handle_migrate_db() { - printf "${YELLOW}+++ Database Migration Tool +++${NC}\n" - printf "\n" - - # Check for old SQLite database - SQLITE_DB="database/AliasServerDb.sqlite" - if [ ! -f "$SQLITE_DB" ]; then - printf "${RED}Error: SQLite database not found at ${SQLITE_DB}${NC}\n" - exit 1 - fi - - # Get the absolute path of the SQLite database - SQLITE_DB_ABS=$(realpath "$SQLITE_DB") - SQLITE_DB_DIR=$(dirname "$SQLITE_DB_ABS") - SQLITE_DB_NAME=$(basename "$SQLITE_DB_ABS") - - # Get PostgreSQL password from .env file - POSTGRES_PASSWORD=$(grep "^POSTGRES_PASSWORD=" "$ENV_FILE" | cut -d= -f2-) - if [ -z "$POSTGRES_PASSWORD" ]; then - printf "${RED}Error: POSTGRES_PASSWORD not found in .env file${NC}\n" - exit 1 - fi - - # Get network name in lowercase - NETWORK_NAME="$(pwd | xargs basename)_default" - NETWORK_NAME=$(echo "$NETWORK_NAME" | tr '[:upper:]' '[:lower:]') - - printf "\n${YELLOW}Warning: This will migrate data from your SQLite database to PostgreSQL.${NC}\n" - printf "\n" - printf "This is a one-time operation necessary when upgrading from <= 0.9.x to 0.10.0+ and only needs to be run once.\n" - printf "\n" - printf "Source database: ${CYAN}${SQLITE_DB_ABS}${NC}\n" - printf "Target: PostgreSQL database (using connection string from docker-compose.yml)\n" - printf "Make sure you have backed up your data before proceeding.\n" - - printf "\n${RED}WARNING: This operation will DELETE ALL EXISTING DATA in the PostgreSQL database.${NC}\n" - printf "${RED}Only proceed if you understand that any current PostgreSQL data will be permanently lost.${NC}\n" - printf "${RED}This operation will stop all services and restart them after the migration is complete.${NC}\n" - printf "\n" - - read -p "Continue with migration? [y/N]: " confirm - if [[ ! $confirm =~ ^[Yy]$ ]]; then - printf "${YELLOW}Migration cancelled.${NC}\n" - exit 0 - fi - - printf "${CYAN}> Stopping services to ensure database is not in use...${NC}\n" - docker compose stop api admin task-runner smtp - - if ! docker pull ${GITHUB_CONTAINER_REGISTRY}-installcli:0.10.3 > /dev/null 2>&1; then - printf "${YELLOW}> Pre-built image not found, building locally...${NC}" - if [ "$VERBOSE" = true ]; then - docker build -t installcli -f apps/server/Utilities/AliasVault.InstallCli/Dockerfile . - else - ( - docker build -t installcli -f apps/server/Utilities/AliasVault.InstallCli/Dockerfile . > install_build_output.log 2>&1 & - BUILD_PID=$! - while kill -0 $BUILD_PID 2>/dev/null; do - printf "." - sleep 1 - done - printf "\n" - wait $BUILD_PID - BUILD_EXIT_CODE=$? - if [ $BUILD_EXIT_CODE -ne 0 ]; then - printf "\n${RED}> Error building Docker image. Check install_build_output.log for details.${NC}\n" - exit $BUILD_EXIT_CODE - fi - ) - fi - - # Run migration with volume mount and connection string - docker run --rm \ - --network="${NETWORK_NAME}" \ - -v "${SQLITE_DB_DIR}:/sqlite" \ - installcli migrate-sqlite "/sqlite/${SQLITE_DB_NAME}" "Host=postgres;Database=aliasvault;Username=aliasvault;Password=${POSTGRES_PASSWORD}" - else - # Run migration with volume mount using pre-built image - docker run --rm \ - --network="${NETWORK_NAME}" \ - -v "${SQLITE_DB_DIR}:/sqlite" \ - ${GITHUB_CONTAINER_REGISTRY}-installcli:0.10.0 migrate-sqlite "/sqlite/${SQLITE_DB_NAME}" "Host=postgres;Database=aliasvault;Username=aliasvault;Password=${POSTGRES_PASSWORD}" - fi - - # Starting services again - printf "${CYAN}> Starting services...${NC}\n" - docker compose start api admin task-runner smtp reverse-proxy - - printf "${GREEN}> Check migration output above for details.${NC}\n" -} - # Function to set deployment mode in .env set_deployment_mode() { local mode=$1