From 4eee69f1015f6b078e295082fbb98e1865dc169d Mon Sep 17 00:00:00 2001 From: Jason Sylvestre Date: Thu, 25 Jul 2024 09:13:08 -0700 Subject: [PATCH] Migration --- ...240725161200_orderFieldLengths.Designer.cs | 1150 +++++++++++++++++ .../20240725161200_orderFieldLengths.cs | 213 +++ .../AppDbContextSqlServerModelSnapshot.cs | 30 +- ...240725161155_orderFieldLengths.Designer.cs | 1112 ++++++++++++++++ .../20240725161155_orderFieldLengths.cs | 19 + .../Sqlite/AppDbContextSqliteModelSnapshot.cs | 10 + 6 files changed, 2524 insertions(+), 10 deletions(-) create mode 100644 Hippo.Core/Migrations/SqlServer/20240725161200_orderFieldLengths.Designer.cs create mode 100644 Hippo.Core/Migrations/SqlServer/20240725161200_orderFieldLengths.cs create mode 100644 Hippo.Core/Migrations/Sqlite/20240725161155_orderFieldLengths.Designer.cs create mode 100644 Hippo.Core/Migrations/Sqlite/20240725161155_orderFieldLengths.cs diff --git a/Hippo.Core/Migrations/SqlServer/20240725161200_orderFieldLengths.Designer.cs b/Hippo.Core/Migrations/SqlServer/20240725161200_orderFieldLengths.Designer.cs new file mode 100644 index 00000000..7f84b7ca --- /dev/null +++ b/Hippo.Core/Migrations/SqlServer/20240725161200_orderFieldLengths.Designer.cs @@ -0,0 +1,1150 @@ +// +using System; +using Hippo.Core.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Hippo.Core.Migrations.SqlServer +{ + [DbContext(typeof(AppDbContextSqlServer))] + [Migration("20240725161200_orderFieldLengths")] + partial class orderFieldLengths + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "6.0.19") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); + + modelBuilder.Entity("AccessTypeAccount", b => + { + b.Property("AccessTypesId") + .HasColumnType("int"); + + b.Property("AccountsId") + .HasColumnType("int"); + + b.HasKey("AccessTypesId", "AccountsId"); + + b.HasIndex("AccountsId"); + + b.ToTable("AccessTypeAccount"); + }); + + modelBuilder.Entity("AccessTypeCluster", b => + { + b.Property("AccessTypesId") + .HasColumnType("int"); + + b.Property("ClustersId") + .HasColumnType("int"); + + b.HasKey("AccessTypesId", "ClustersId"); + + b.HasIndex("ClustersId"); + + b.ToTable("AccessTypeCluster"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.AccessType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("AccessTypes"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.Account", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); + + b.Property("ClusterId") + .HasColumnType("int"); + + b.Property("CreatedOn") + .HasColumnType("datetime2"); + + b.Property("Data") + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .HasMaxLength(300) + .HasColumnType("nvarchar(300)"); + + b.Property("Kerberos") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.Property("Name") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("OwnerId") + .HasColumnType("int"); + + b.Property("SshKey") + .HasColumnType("nvarchar(max)"); + + b.Property("UpdatedOn") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("ClusterId"); + + b.HasIndex("CreatedOn"); + + b.HasIndex("Email"); + + b.HasIndex("Kerberos"); + + b.HasIndex("Name"); + + b.HasIndex("OwnerId"); + + b.HasIndex("UpdatedOn"); + + b.ToTable("Accounts"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.Billing", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); + + b.Property("ChartString") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("OrderId") + .HasColumnType("int"); + + b.Property("Percentage") + .HasColumnType("decimal(18,2)"); + + b.Property("Updated") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("OrderId"); + + b.ToTable("Billings"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.Cluster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); + + b.Property("Description") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("Domain") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("Email") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("IsActive") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(true); + + b.Property("Name") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.Property("SshKeyId") + .HasMaxLength(40) + .HasColumnType("nvarchar(40)"); + + b.Property("SshName") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("SshUrl") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("Clusters"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.FinancialDetail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); + + b.Property("AutoApprove") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(true); + + b.Property("ChartString") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ClusterId") + .HasColumnType("int"); + + b.Property("FinancialSystemApiSource") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("SecretAccessKey") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.HasKey("Id"); + + b.HasIndex("ClusterId") + .IsUnique(); + + b.ToTable("FinancialDetails"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.Group", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); + + b.Property("ClusterId") + .HasColumnType("int"); + + b.Property("Data") + .HasColumnType("nvarchar(max)"); + + b.Property("DisplayName") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.HasKey("Id"); + + b.HasIndex("ClusterId", "Name") + .IsUnique(); + + b.ToTable("Groups"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.GroupAdminAccount", b => + { + b.Property("AccountId") + .HasColumnType("int"); + + b.Property("GroupId") + .HasColumnType("int"); + + b.HasKey("AccountId", "GroupId"); + + b.HasIndex("GroupId"); + + b.ToTable("GroupAdminAccount"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.GroupMemberAccount", b => + { + b.Property("AccountId") + .HasColumnType("int"); + + b.Property("GroupId") + .HasColumnType("int"); + + b.HasKey("AccountId", "GroupId"); + + b.HasIndex("GroupId"); + + b.ToTable("GroupMemberAccount"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.History", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); + + b.Property("ActedById") + .HasColumnType("int"); + + b.Property("ActedDate") + .HasColumnType("datetime2"); + + b.Property("Action") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("AdminAction") + .HasColumnType("bit"); + + b.Property("ClusterId") + .HasColumnType("int"); + + b.Property("Details") + .HasColumnType("nvarchar(max)"); + + b.Property("OrderId") + .HasColumnType("int"); + + b.Property("Status") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Type") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("ActedById"); + + b.HasIndex("ActedDate"); + + b.HasIndex("Action"); + + b.HasIndex("ClusterId"); + + b.HasIndex("OrderId"); + + b.HasIndex("Type"); + + b.ToTable("Histories"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.Order", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); + + b.Property("Adjustment") + .HasColumnType("decimal(18,2)"); + + b.Property("AdjustmentReason") + .HasColumnType("nvarchar(max)"); + + b.Property("AdminNotes") + .HasColumnType("nvarchar(max)"); + + b.Property("BalanceRemaining") + .HasColumnType("decimal(18,2)"); + + b.Property("Category") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ClusterId") + .HasColumnType("int"); + + b.Property("CreatedOn") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("ExpirationDate") + .HasColumnType("datetime2"); + + b.Property("ExternalReference") + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); + + b.Property("InstallmentDate") + .HasColumnType("datetime2"); + + b.Property("InstallmentType") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("Installments") + .HasColumnType("int"); + + b.Property("LifeCycle") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("NextNotificationDate") + .HasColumnType("datetime2"); + + b.Property("NextPaymentDate") + .HasColumnType("datetime2"); + + b.Property("Notes") + .HasColumnType("nvarchar(max)"); + + b.Property("PrincipalInvestigatorId") + .HasColumnType("int"); + + b.Property("ProductName") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Quantity") + .HasColumnType("decimal(18,2)"); + + b.Property("Status") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.Property("SubTotal") + .HasColumnType("decimal(18,2)"); + + b.Property("Total") + .HasColumnType("decimal(18,2)"); + + b.Property("UnitPrice") + .HasColumnType("decimal(18,2)"); + + b.Property("Units") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("ClusterId"); + + b.HasIndex("ExpirationDate"); + + b.HasIndex("NextNotificationDate"); + + b.HasIndex("PrincipalInvestigatorId"); + + b.HasIndex("Status"); + + b.ToTable("Orders"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.OrderMetaData", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("OrderId") + .HasColumnType("int"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(450) + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("OrderId"); + + b.HasIndex("OrderId", "Name", "Value"); + + b.ToTable("MetaData"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.Payment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); + + b.Property("Amount") + .HasColumnType("decimal(18,2)"); + + b.Property("CreatedById") + .HasColumnType("int"); + + b.Property("CreatedOn") + .HasColumnType("datetime2"); + + b.Property("Details") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("FinancialSystemId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("OrderId") + .HasColumnType("int"); + + b.Property("Status") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.Property("TrackingNumber") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("OrderId"); + + b.HasIndex("Status"); + + b.ToTable("Payments"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.Permission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); + + b.Property("ClusterId") + .HasColumnType("int"); + + b.Property("RoleId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ClusterId"); + + b.HasIndex("RoleId"); + + b.HasIndex("UserId"); + + b.ToTable("Permissions"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.Product", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); + + b.Property("Category") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ClusterId") + .HasColumnType("int"); + + b.Property("Description") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("InstallmentType") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("Installments") + .HasColumnType("int"); + + b.Property("IsActive") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(true); + + b.Property("LastUpdated") + .HasColumnType("datetime2"); + + b.Property("LifeCycle") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("UnitPrice") + .HasColumnType("decimal(18,2)"); + + b.Property("Units") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("ClusterId"); + + b.ToTable("Products"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.QueuedEvent", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); + + b.Property("Action") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("Data") + .HasColumnType("nvarchar(max)"); + + b.Property("ErrorMessage") + .HasColumnType("nvarchar(max)"); + + b.Property("RequestId") + .HasColumnType("int"); + + b.Property("Status") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("UpdatedAt") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("Action"); + + b.HasIndex("CreatedAt"); + + b.HasIndex("RequestId"); + + b.HasIndex("Status"); + + b.HasIndex("UpdatedAt"); + + b.ToTable("QueuedEvents"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.Request", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); + + b.Property("Action") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ActorId") + .HasColumnType("int"); + + b.Property("ClusterId") + .HasColumnType("int"); + + b.Property("CreatedOn") + .HasColumnType("datetime2"); + + b.Property("Data") + .HasColumnType("nvarchar(max)"); + + b.Property("Group") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("RequesterId") + .HasColumnType("int"); + + b.Property("SshKey") + .HasColumnType("nvarchar(max)"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("SupervisingPI") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("UpdatedOn") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("Action"); + + b.HasIndex("ActorId"); + + b.HasIndex("ClusterId"); + + b.HasIndex("Group"); + + b.HasIndex("RequesterId"); + + b.HasIndex("Status"); + + b.ToTable("Requests"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.Role", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("Roles"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.TempGroup", b => + { + b.Property("ClusterId") + .HasColumnType("int"); + + b.Property("Group") + .HasColumnType("nvarchar(450)"); + + b.HasKey("ClusterId", "Group"); + + b.ToTable("TempGroups"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.TempKerberos", b => + { + b.Property("ClusterId") + .HasColumnType("int"); + + b.Property("Kerberos") + .HasColumnType("nvarchar(450)"); + + b.HasKey("ClusterId", "Kerberos"); + + b.ToTable("TempKerberos"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); + + b.Property("Email") + .IsRequired() + .HasMaxLength(300) + .HasColumnType("nvarchar(300)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Iam") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("Kerberos") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("MothraId") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.HasKey("Id"); + + b.HasIndex("Email"); + + b.HasIndex("Iam") + .IsUnique() + .HasFilter("[Iam] IS NOT NULL"); + + b.ToTable("Users"); + }); + + modelBuilder.Entity("AccessTypeAccount", b => + { + b.HasOne("Hippo.Core.Domain.AccessType", null) + .WithMany() + .HasForeignKey("AccessTypesId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Hippo.Core.Domain.Account", null) + .WithMany() + .HasForeignKey("AccountsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("AccessTypeCluster", b => + { + b.HasOne("Hippo.Core.Domain.AccessType", null) + .WithMany() + .HasForeignKey("AccessTypesId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Hippo.Core.Domain.Cluster", null) + .WithMany() + .HasForeignKey("ClustersId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Hippo.Core.Domain.Account", b => + { + b.HasOne("Hippo.Core.Domain.Cluster", "Cluster") + .WithMany("Accounts") + .HasForeignKey("ClusterId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Hippo.Core.Domain.User", "Owner") + .WithMany("Accounts") + .HasForeignKey("OwnerId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Cluster"); + + b.Navigation("Owner"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.Billing", b => + { + b.HasOne("Hippo.Core.Domain.Order", "Order") + .WithMany("Billings") + .HasForeignKey("OrderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Order"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.FinancialDetail", b => + { + b.HasOne("Hippo.Core.Domain.Cluster", "Cluster") + .WithOne("FinancialDetail") + .HasForeignKey("Hippo.Core.Domain.FinancialDetail", "ClusterId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Cluster"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.Group", b => + { + b.HasOne("Hippo.Core.Domain.Cluster", "Cluster") + .WithMany("Groups") + .HasForeignKey("ClusterId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Cluster"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.GroupAdminAccount", b => + { + b.HasOne("Hippo.Core.Domain.Account", "Account") + .WithMany() + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Hippo.Core.Domain.Group", "Group") + .WithMany() + .HasForeignKey("GroupId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Account"); + + b.Navigation("Group"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.GroupMemberAccount", b => + { + b.HasOne("Hippo.Core.Domain.Account", "Account") + .WithMany() + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Hippo.Core.Domain.Group", "Group") + .WithMany() + .HasForeignKey("GroupId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Account"); + + b.Navigation("Group"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.History", b => + { + b.HasOne("Hippo.Core.Domain.User", "ActedBy") + .WithMany() + .HasForeignKey("ActedById") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Hippo.Core.Domain.Cluster", "Cluster") + .WithMany() + .HasForeignKey("ClusterId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Hippo.Core.Domain.Order", "Order") + .WithMany("History") + .HasForeignKey("OrderId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("ActedBy"); + + b.Navigation("Cluster"); + + b.Navigation("Order"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.Order", b => + { + b.HasOne("Hippo.Core.Domain.Cluster", "Cluster") + .WithMany("Orders") + .HasForeignKey("ClusterId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Hippo.Core.Domain.Account", "PrincipalInvestigator") + .WithMany("Orders") + .HasForeignKey("PrincipalInvestigatorId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Cluster"); + + b.Navigation("PrincipalInvestigator"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.OrderMetaData", b => + { + b.HasOne("Hippo.Core.Domain.Order", "Order") + .WithMany("MetaData") + .HasForeignKey("OrderId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Order"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.Payment", b => + { + b.HasOne("Hippo.Core.Domain.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById"); + + b.HasOne("Hippo.Core.Domain.Order", "Order") + .WithMany("Payments") + .HasForeignKey("OrderId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("CreatedBy"); + + b.Navigation("Order"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.Permission", b => + { + b.HasOne("Hippo.Core.Domain.Cluster", "Cluster") + .WithMany() + .HasForeignKey("ClusterId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Hippo.Core.Domain.Role", "Role") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Hippo.Core.Domain.User", "User") + .WithMany("Permissions") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Cluster"); + + b.Navigation("Role"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.Product", b => + { + b.HasOne("Hippo.Core.Domain.Cluster", "Cluster") + .WithMany("Products") + .HasForeignKey("ClusterId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Cluster"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.QueuedEvent", b => + { + b.HasOne("Hippo.Core.Domain.Request", "Request") + .WithMany("QueuedEvents") + .HasForeignKey("RequestId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Request"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.Request", b => + { + b.HasOne("Hippo.Core.Domain.User", "Actor") + .WithMany() + .HasForeignKey("ActorId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Hippo.Core.Domain.Cluster", "Cluster") + .WithMany() + .HasForeignKey("ClusterId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Hippo.Core.Domain.User", "Requester") + .WithMany() + .HasForeignKey("RequesterId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Actor"); + + b.Navigation("Cluster"); + + b.Navigation("Requester"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.Account", b => + { + b.Navigation("Orders"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.Cluster", b => + { + b.Navigation("Accounts"); + + b.Navigation("FinancialDetail"); + + b.Navigation("Groups"); + + b.Navigation("Orders"); + + b.Navigation("Products"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.Order", b => + { + b.Navigation("Billings"); + + b.Navigation("History"); + + b.Navigation("MetaData"); + + b.Navigation("Payments"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.Request", b => + { + b.Navigation("QueuedEvents"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.User", b => + { + b.Navigation("Accounts"); + + b.Navigation("Permissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Hippo.Core/Migrations/SqlServer/20240725161200_orderFieldLengths.cs b/Hippo.Core/Migrations/SqlServer/20240725161200_orderFieldLengths.cs new file mode 100644 index 00000000..a05d933b --- /dev/null +++ b/Hippo.Core/Migrations/SqlServer/20240725161200_orderFieldLengths.cs @@ -0,0 +1,213 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Hippo.Core.Migrations.SqlServer +{ + public partial class orderFieldLengths : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "Units", + table: "Products", + type: "nvarchar(50)", + maxLength: 50, + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(max)", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "TrackingNumber", + table: "Payments", + type: "nvarchar(20)", + maxLength: 20, + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(max)", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "Status", + table: "Payments", + type: "nvarchar(20)", + maxLength: 20, + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(450)", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "FinancialSystemId", + table: "Payments", + type: "nvarchar(128)", + maxLength: 128, + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(max)", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "Details", + table: "Payments", + type: "nvarchar(250)", + maxLength: 250, + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(max)", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "Units", + table: "Orders", + type: "nvarchar(50)", + maxLength: 50, + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(max)", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "Status", + table: "Orders", + type: "nvarchar(20)", + maxLength: 20, + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(450)", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "SecretAccessKey", + table: "FinancialDetails", + type: "nvarchar(200)", + maxLength: 200, + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(max)", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ChartString", + table: "FinancialDetails", + type: "nvarchar(128)", + maxLength: 128, + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(max)", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ChartString", + table: "Billings", + type: "nvarchar(128)", + maxLength: 128, + nullable: false, + oldClrType: typeof(string), + oldType: "nvarchar(max)"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "Units", + table: "Products", + type: "nvarchar(max)", + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(50)", + oldMaxLength: 50, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "TrackingNumber", + table: "Payments", + type: "nvarchar(max)", + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(20)", + oldMaxLength: 20, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "Status", + table: "Payments", + type: "nvarchar(450)", + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(20)", + oldMaxLength: 20, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "FinancialSystemId", + table: "Payments", + type: "nvarchar(max)", + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(128)", + oldMaxLength: 128, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "Details", + table: "Payments", + type: "nvarchar(max)", + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(250)", + oldMaxLength: 250, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "Units", + table: "Orders", + type: "nvarchar(max)", + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(50)", + oldMaxLength: 50, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "Status", + table: "Orders", + type: "nvarchar(450)", + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(20)", + oldMaxLength: 20, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "SecretAccessKey", + table: "FinancialDetails", + type: "nvarchar(max)", + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(200)", + oldMaxLength: 200, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ChartString", + table: "FinancialDetails", + type: "nvarchar(max)", + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(128)", + oldMaxLength: 128, + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ChartString", + table: "Billings", + type: "nvarchar(max)", + nullable: false, + oldClrType: typeof(string), + oldType: "nvarchar(128)", + oldMaxLength: 128); + } + } +} diff --git a/Hippo.Core/Migrations/SqlServer/AppDbContextSqlServerModelSnapshot.cs b/Hippo.Core/Migrations/SqlServer/AppDbContextSqlServerModelSnapshot.cs index 73a2ee00..c6df37b3 100644 --- a/Hippo.Core/Migrations/SqlServer/AppDbContextSqlServerModelSnapshot.cs +++ b/Hippo.Core/Migrations/SqlServer/AppDbContextSqlServerModelSnapshot.cs @@ -140,7 +140,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("ChartString") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("OrderId") .HasColumnType("int"); @@ -222,7 +223,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasDefaultValue(true); b.Property("ChartString") - .HasColumnType("nvarchar(max)"); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("ClusterId") .HasColumnType("int"); @@ -233,7 +235,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("nvarchar(50)"); b.Property("SecretAccessKey") - .HasColumnType("nvarchar(max)"); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.HasKey("Id"); @@ -440,7 +443,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("decimal(18,2)"); b.Property("Status") - .HasColumnType("nvarchar(450)"); + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); b.Property("SubTotal") .HasColumnType("decimal(18,2)"); @@ -452,7 +456,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("decimal(18,2)"); b.Property("Units") - .HasColumnType("nvarchar(max)"); + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); b.HasKey("Id"); @@ -517,19 +522,23 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("datetime2"); b.Property("Details") - .HasColumnType("nvarchar(max)"); + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); b.Property("FinancialSystemId") - .HasColumnType("nvarchar(max)"); + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); b.Property("OrderId") .HasColumnType("int"); b.Property("Status") - .HasColumnType("nvarchar(450)"); + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); b.Property("TrackingNumber") - .HasColumnType("nvarchar(max)"); + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); b.HasKey("Id"); @@ -617,7 +626,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("decimal(18,2)"); b.Property("Units") - .HasColumnType("nvarchar(max)"); + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); b.HasKey("Id"); diff --git a/Hippo.Core/Migrations/Sqlite/20240725161155_orderFieldLengths.Designer.cs b/Hippo.Core/Migrations/Sqlite/20240725161155_orderFieldLengths.Designer.cs new file mode 100644 index 00000000..90817506 --- /dev/null +++ b/Hippo.Core/Migrations/Sqlite/20240725161155_orderFieldLengths.Designer.cs @@ -0,0 +1,1112 @@ +// +using System; +using Hippo.Core.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Hippo.Core.Migrations.Sqlite +{ + [DbContext(typeof(AppDbContextSqlite))] + [Migration("20240725161155_orderFieldLengths")] + partial class orderFieldLengths + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "6.0.19"); + + modelBuilder.Entity("AccessTypeAccount", b => + { + b.Property("AccessTypesId") + .HasColumnType("INTEGER"); + + b.Property("AccountsId") + .HasColumnType("INTEGER"); + + b.HasKey("AccessTypesId", "AccountsId"); + + b.HasIndex("AccountsId"); + + b.ToTable("AccessTypeAccount"); + }); + + modelBuilder.Entity("AccessTypeCluster", b => + { + b.Property("AccessTypesId") + .HasColumnType("INTEGER"); + + b.Property("ClustersId") + .HasColumnType("INTEGER"); + + b.HasKey("AccessTypesId", "ClustersId"); + + b.HasIndex("ClustersId"); + + b.ToTable("AccessTypeCluster"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.AccessType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("AccessTypes"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.Account", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ClusterId") + .HasColumnType("INTEGER"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Data") + .HasColumnType("TEXT"); + + b.Property("Email") + .HasMaxLength(300) + .HasColumnType("TEXT"); + + b.Property("Kerberos") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("Name") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("OwnerId") + .HasColumnType("INTEGER"); + + b.Property("SshKey") + .HasColumnType("TEXT"); + + b.Property("UpdatedOn") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ClusterId"); + + b.HasIndex("CreatedOn"); + + b.HasIndex("Email"); + + b.HasIndex("Kerberos"); + + b.HasIndex("Name"); + + b.HasIndex("OwnerId"); + + b.HasIndex("UpdatedOn"); + + b.ToTable("Accounts"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.Billing", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ChartString") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("OrderId") + .HasColumnType("INTEGER"); + + b.Property("Percentage") + .HasColumnType("TEXT"); + + b.Property("Updated") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("OrderId"); + + b.ToTable("Billings"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.Cluster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("TEXT"); + + b.Property("Domain") + .HasMaxLength(250) + .HasColumnType("TEXT"); + + b.Property("Email") + .HasMaxLength(250) + .HasColumnType("TEXT"); + + b.Property("IsActive") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER") + .HasDefaultValue(true); + + b.Property("Name") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("SshKeyId") + .HasMaxLength(40) + .HasColumnType("TEXT"); + + b.Property("SshName") + .HasMaxLength(250) + .HasColumnType("TEXT"); + + b.Property("SshUrl") + .HasMaxLength(250) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("Clusters"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.FinancialDetail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AutoApprove") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER") + .HasDefaultValue(true); + + b.Property("ChartString") + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("ClusterId") + .HasColumnType("INTEGER"); + + b.Property("FinancialSystemApiSource") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("SecretAccessKey") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ClusterId") + .IsUnique(); + + b.ToTable("FinancialDetails"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.Group", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ClusterId") + .HasColumnType("INTEGER"); + + b.Property("Data") + .HasColumnType("TEXT"); + + b.Property("DisplayName") + .HasMaxLength(250) + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ClusterId", "Name") + .IsUnique(); + + b.ToTable("Groups"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.GroupAdminAccount", b => + { + b.Property("AccountId") + .HasColumnType("INTEGER"); + + b.Property("GroupId") + .HasColumnType("INTEGER"); + + b.HasKey("AccountId", "GroupId"); + + b.HasIndex("GroupId"); + + b.ToTable("GroupAdminAccount"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.GroupMemberAccount", b => + { + b.Property("AccountId") + .HasColumnType("INTEGER"); + + b.Property("GroupId") + .HasColumnType("INTEGER"); + + b.HasKey("AccountId", "GroupId"); + + b.HasIndex("GroupId"); + + b.ToTable("GroupMemberAccount"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.History", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ActedById") + .HasColumnType("INTEGER"); + + b.Property("ActedDate") + .HasColumnType("TEXT"); + + b.Property("Action") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("AdminAction") + .HasColumnType("INTEGER"); + + b.Property("ClusterId") + .HasColumnType("INTEGER"); + + b.Property("Details") + .HasColumnType("TEXT"); + + b.Property("OrderId") + .HasColumnType("INTEGER"); + + b.Property("Status") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Type") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ActedById"); + + b.HasIndex("ActedDate"); + + b.HasIndex("Action"); + + b.HasIndex("ClusterId"); + + b.HasIndex("OrderId"); + + b.HasIndex("Type"); + + b.ToTable("Histories"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.Order", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Adjustment") + .HasColumnType("TEXT"); + + b.Property("AdjustmentReason") + .HasColumnType("TEXT"); + + b.Property("AdminNotes") + .HasColumnType("TEXT"); + + b.Property("BalanceRemaining") + .HasColumnType("TEXT"); + + b.Property("Category") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ClusterId") + .HasColumnType("INTEGER"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Description") + .HasMaxLength(250) + .HasColumnType("TEXT"); + + b.Property("ExpirationDate") + .HasColumnType("TEXT"); + + b.Property("ExternalReference") + .HasMaxLength(150) + .HasColumnType("TEXT"); + + b.Property("InstallmentDate") + .HasColumnType("TEXT"); + + b.Property("InstallmentType") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("TEXT"); + + b.Property("Installments") + .HasColumnType("INTEGER"); + + b.Property("LifeCycle") + .HasColumnType("INTEGER"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("NextNotificationDate") + .HasColumnType("TEXT"); + + b.Property("NextPaymentDate") + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasColumnType("TEXT"); + + b.Property("PrincipalInvestigatorId") + .HasColumnType("INTEGER"); + + b.Property("ProductName") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Quantity") + .HasColumnType("TEXT"); + + b.Property("Status") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("SubTotal") + .HasColumnType("TEXT"); + + b.Property("Total") + .HasColumnType("TEXT"); + + b.Property("UnitPrice") + .HasColumnType("TEXT"); + + b.Property("Units") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ClusterId"); + + b.HasIndex("ExpirationDate"); + + b.HasIndex("NextNotificationDate"); + + b.HasIndex("PrincipalInvestigatorId"); + + b.HasIndex("Status"); + + b.ToTable("Orders"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.OrderMetaData", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("OrderId") + .HasColumnType("INTEGER"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(450) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("OrderId"); + + b.HasIndex("OrderId", "Name", "Value"); + + b.ToTable("MetaData"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.Payment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Amount") + .HasColumnType("TEXT"); + + b.Property("CreatedById") + .HasColumnType("INTEGER"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Details") + .HasMaxLength(250) + .HasColumnType("TEXT"); + + b.Property("FinancialSystemId") + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("OrderId") + .HasColumnType("INTEGER"); + + b.Property("Status") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("TrackingNumber") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("OrderId"); + + b.HasIndex("Status"); + + b.ToTable("Payments"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.Permission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ClusterId") + .HasColumnType("INTEGER"); + + b.Property("RoleId") + .HasColumnType("INTEGER"); + + b.Property("UserId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("ClusterId"); + + b.HasIndex("RoleId"); + + b.HasIndex("UserId"); + + b.ToTable("Permissions"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.Product", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Category") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ClusterId") + .HasColumnType("INTEGER"); + + b.Property("Description") + .HasMaxLength(250) + .HasColumnType("TEXT"); + + b.Property("InstallmentType") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("TEXT"); + + b.Property("Installments") + .HasColumnType("INTEGER"); + + b.Property("IsActive") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER") + .HasDefaultValue(true); + + b.Property("LastUpdated") + .HasColumnType("TEXT"); + + b.Property("LifeCycle") + .HasColumnType("INTEGER"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("UnitPrice") + .HasColumnType("TEXT"); + + b.Property("Units") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ClusterId"); + + b.ToTable("Products"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.QueuedEvent", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Action") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("CreatedAt") + .HasColumnType("TEXT"); + + b.Property("Data") + .HasColumnType("TEXT"); + + b.Property("ErrorMessage") + .HasColumnType("TEXT"); + + b.Property("RequestId") + .HasColumnType("INTEGER"); + + b.Property("Status") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("UpdatedAt") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Action"); + + b.HasIndex("CreatedAt"); + + b.HasIndex("RequestId"); + + b.HasIndex("Status"); + + b.HasIndex("UpdatedAt"); + + b.ToTable("QueuedEvents"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.Request", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Action") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("ActorId") + .HasColumnType("INTEGER"); + + b.Property("ClusterId") + .HasColumnType("INTEGER"); + + b.Property("CreatedOn") + .HasColumnType("TEXT"); + + b.Property("Data") + .HasColumnType("TEXT"); + + b.Property("Group") + .HasMaxLength(32) + .HasColumnType("TEXT"); + + b.Property("RequesterId") + .HasColumnType("INTEGER"); + + b.Property("SshKey") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("SupervisingPI") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("UpdatedOn") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Action"); + + b.HasIndex("ActorId"); + + b.HasIndex("ClusterId"); + + b.HasIndex("Group"); + + b.HasIndex("RequesterId"); + + b.HasIndex("Status"); + + b.ToTable("Requests"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.Role", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("Roles"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.TempGroup", b => + { + b.Property("ClusterId") + .HasColumnType("INTEGER"); + + b.Property("Group") + .HasColumnType("TEXT"); + + b.HasKey("ClusterId", "Group"); + + b.ToTable("TempGroups"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.TempKerberos", b => + { + b.Property("ClusterId") + .HasColumnType("INTEGER"); + + b.Property("Kerberos") + .HasColumnType("TEXT"); + + b.HasKey("ClusterId", "Kerberos"); + + b.ToTable("TempKerberos"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(300) + .HasColumnType("TEXT"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Iam") + .HasMaxLength(10) + .HasColumnType("TEXT"); + + b.Property("Kerberos") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("MothraId") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Email"); + + b.HasIndex("Iam") + .IsUnique(); + + b.ToTable("Users"); + }); + + modelBuilder.Entity("AccessTypeAccount", b => + { + b.HasOne("Hippo.Core.Domain.AccessType", null) + .WithMany() + .HasForeignKey("AccessTypesId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Hippo.Core.Domain.Account", null) + .WithMany() + .HasForeignKey("AccountsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("AccessTypeCluster", b => + { + b.HasOne("Hippo.Core.Domain.AccessType", null) + .WithMany() + .HasForeignKey("AccessTypesId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Hippo.Core.Domain.Cluster", null) + .WithMany() + .HasForeignKey("ClustersId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Hippo.Core.Domain.Account", b => + { + b.HasOne("Hippo.Core.Domain.Cluster", "Cluster") + .WithMany("Accounts") + .HasForeignKey("ClusterId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Hippo.Core.Domain.User", "Owner") + .WithMany("Accounts") + .HasForeignKey("OwnerId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Cluster"); + + b.Navigation("Owner"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.Billing", b => + { + b.HasOne("Hippo.Core.Domain.Order", "Order") + .WithMany("Billings") + .HasForeignKey("OrderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Order"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.FinancialDetail", b => + { + b.HasOne("Hippo.Core.Domain.Cluster", "Cluster") + .WithOne("FinancialDetail") + .HasForeignKey("Hippo.Core.Domain.FinancialDetail", "ClusterId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Cluster"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.Group", b => + { + b.HasOne("Hippo.Core.Domain.Cluster", "Cluster") + .WithMany("Groups") + .HasForeignKey("ClusterId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Cluster"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.GroupAdminAccount", b => + { + b.HasOne("Hippo.Core.Domain.Account", "Account") + .WithMany() + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Hippo.Core.Domain.Group", "Group") + .WithMany() + .HasForeignKey("GroupId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Account"); + + b.Navigation("Group"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.GroupMemberAccount", b => + { + b.HasOne("Hippo.Core.Domain.Account", "Account") + .WithMany() + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Hippo.Core.Domain.Group", "Group") + .WithMany() + .HasForeignKey("GroupId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Account"); + + b.Navigation("Group"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.History", b => + { + b.HasOne("Hippo.Core.Domain.User", "ActedBy") + .WithMany() + .HasForeignKey("ActedById") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Hippo.Core.Domain.Cluster", "Cluster") + .WithMany() + .HasForeignKey("ClusterId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Hippo.Core.Domain.Order", "Order") + .WithMany("History") + .HasForeignKey("OrderId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("ActedBy"); + + b.Navigation("Cluster"); + + b.Navigation("Order"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.Order", b => + { + b.HasOne("Hippo.Core.Domain.Cluster", "Cluster") + .WithMany("Orders") + .HasForeignKey("ClusterId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Hippo.Core.Domain.Account", "PrincipalInvestigator") + .WithMany("Orders") + .HasForeignKey("PrincipalInvestigatorId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Cluster"); + + b.Navigation("PrincipalInvestigator"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.OrderMetaData", b => + { + b.HasOne("Hippo.Core.Domain.Order", "Order") + .WithMany("MetaData") + .HasForeignKey("OrderId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Order"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.Payment", b => + { + b.HasOne("Hippo.Core.Domain.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById"); + + b.HasOne("Hippo.Core.Domain.Order", "Order") + .WithMany("Payments") + .HasForeignKey("OrderId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("CreatedBy"); + + b.Navigation("Order"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.Permission", b => + { + b.HasOne("Hippo.Core.Domain.Cluster", "Cluster") + .WithMany() + .HasForeignKey("ClusterId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Hippo.Core.Domain.Role", "Role") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Hippo.Core.Domain.User", "User") + .WithMany("Permissions") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Cluster"); + + b.Navigation("Role"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.Product", b => + { + b.HasOne("Hippo.Core.Domain.Cluster", "Cluster") + .WithMany("Products") + .HasForeignKey("ClusterId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Cluster"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.QueuedEvent", b => + { + b.HasOne("Hippo.Core.Domain.Request", "Request") + .WithMany("QueuedEvents") + .HasForeignKey("RequestId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Request"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.Request", b => + { + b.HasOne("Hippo.Core.Domain.User", "Actor") + .WithMany() + .HasForeignKey("ActorId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Hippo.Core.Domain.Cluster", "Cluster") + .WithMany() + .HasForeignKey("ClusterId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Hippo.Core.Domain.User", "Requester") + .WithMany() + .HasForeignKey("RequesterId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Actor"); + + b.Navigation("Cluster"); + + b.Navigation("Requester"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.Account", b => + { + b.Navigation("Orders"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.Cluster", b => + { + b.Navigation("Accounts"); + + b.Navigation("FinancialDetail"); + + b.Navigation("Groups"); + + b.Navigation("Orders"); + + b.Navigation("Products"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.Order", b => + { + b.Navigation("Billings"); + + b.Navigation("History"); + + b.Navigation("MetaData"); + + b.Navigation("Payments"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.Request", b => + { + b.Navigation("QueuedEvents"); + }); + + modelBuilder.Entity("Hippo.Core.Domain.User", b => + { + b.Navigation("Accounts"); + + b.Navigation("Permissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Hippo.Core/Migrations/Sqlite/20240725161155_orderFieldLengths.cs b/Hippo.Core/Migrations/Sqlite/20240725161155_orderFieldLengths.cs new file mode 100644 index 00000000..08bed6c9 --- /dev/null +++ b/Hippo.Core/Migrations/Sqlite/20240725161155_orderFieldLengths.cs @@ -0,0 +1,19 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Hippo.Core.Migrations.Sqlite +{ + public partial class orderFieldLengths : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/Hippo.Core/Migrations/Sqlite/AppDbContextSqliteModelSnapshot.cs b/Hippo.Core/Migrations/Sqlite/AppDbContextSqliteModelSnapshot.cs index eeee4819..c285cbce 100644 --- a/Hippo.Core/Migrations/Sqlite/AppDbContextSqliteModelSnapshot.cs +++ b/Hippo.Core/Migrations/Sqlite/AppDbContextSqliteModelSnapshot.cs @@ -129,6 +129,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("ChartString") .IsRequired() + .HasMaxLength(128) .HasColumnType("TEXT"); b.Property("OrderId") @@ -207,6 +208,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasDefaultValue(true); b.Property("ChartString") + .HasMaxLength(128) .HasColumnType("TEXT"); b.Property("ClusterId") @@ -218,6 +220,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("TEXT"); b.Property("SecretAccessKey") + .HasMaxLength(200) .HasColumnType("TEXT"); b.HasKey("Id"); @@ -419,6 +422,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("TEXT"); b.Property("Status") + .HasMaxLength(20) .HasColumnType("TEXT"); b.Property("SubTotal") @@ -431,6 +435,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("TEXT"); b.Property("Units") + .HasMaxLength(50) .HasColumnType("TEXT"); b.HasKey("Id"); @@ -492,18 +497,22 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("TEXT"); b.Property("Details") + .HasMaxLength(250) .HasColumnType("TEXT"); b.Property("FinancialSystemId") + .HasMaxLength(128) .HasColumnType("TEXT"); b.Property("OrderId") .HasColumnType("INTEGER"); b.Property("Status") + .HasMaxLength(20) .HasColumnType("TEXT"); b.Property("TrackingNumber") + .HasMaxLength(20) .HasColumnType("TEXT"); b.HasKey("Id"); @@ -588,6 +597,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("TEXT"); b.Property("Units") + .HasMaxLength(50) .HasColumnType("TEXT"); b.HasKey("Id");