Database improvement

1.  Separate configuration files
2.  Remove commented code
3.  Improve entity configurations (constraints, indexes, relationships)
This commit is contained in:
2025-12-04 08:09:01 -05:00
parent 2d5d075879
commit 826eac1372
8 changed files with 787 additions and 80 deletions
+44 -20
View File
@@ -29,20 +29,22 @@ namespace Data.Migrations
.HasColumnType("INTEGER");
b.Property<string>("Description")
.HasMaxLength(1024)
.HasMaxLength(1000)
.HasColumnType("TEXT");
b.Property<string>("Documentation")
.HasMaxLength(64)
.HasMaxLength(500)
.HasColumnType("TEXT");
b.Property<string>("Eligibility")
.IsRequired()
.HasMaxLength(256)
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property<int>("EventFormat")
.HasColumnType("INTEGER");
b.Property<string>("EventFormat")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<int?>("LevelOfEffort")
.HasColumnType("INTEGER");
@@ -69,21 +71,24 @@ namespace Data.Migrations
.HasColumnType("INTEGER");
b.Property<string>("SemifinalistActivity")
.HasMaxLength(100)
.HasMaxLength(500)
.HasColumnType("TEXT");
b.Property<string>("ShortName")
.IsRequired()
.HasMaxLength(40)
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<string>("Theme")
.HasMaxLength(4096)
.HasMaxLength(500)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("Name");
b.HasIndex("EventFormat");
b.HasIndex("Name")
.IsUnique();
b.ToTable("Events");
});
@@ -95,11 +100,12 @@ namespace Data.Migrations
.HasColumnType("INTEGER");
b.Property<string>("Email")
.HasMaxLength(255)
.HasColumnType("TEXT");
b.Property<string>("FirstName")
.IsRequired()
.HasMaxLength(50)
.HasMaxLength(100)
.HasColumnType("TEXT");
b.Property<int>("Grade")
@@ -107,22 +113,27 @@ namespace Data.Migrations
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(50)
.HasMaxLength(100)
.HasColumnType("TEXT");
b.Property<string>("NationalId")
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<int?>("OfficerRole")
.HasColumnType("INTEGER");
b.Property<string>("OfficerRole")
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<string>("PhoneNumber")
.HasMaxLength(20)
.HasColumnType("TEXT");
b.Property<string>("RegionalId")
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<string>("StateId")
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<int>("TsaYear")
@@ -130,21 +141,31 @@ namespace Data.Migrations
b.HasKey("Id");
b.HasIndex("Email");
b.HasIndex("Grade");
b.HasIndex("FirstName", "LastName");
b.ToTable("Students");
});
modelBuilder.Entity("Core.Entities.StudentEventRanking", b =>
{
b.Property<int>("EventDefinitionId")
b.Property<int>("StudentId")
.HasColumnType("INTEGER");
b.Property<int>("StudentId")
b.Property<int>("EventDefinitionId")
.HasColumnType("INTEGER");
b.Property<int>("Rank")
.HasColumnType("INTEGER");
b.HasKey("EventDefinitionId", "StudentId");
b.HasKey("StudentId", "EventDefinitionId");
b.HasIndex("EventDefinitionId");
b.HasIndex("Rank");
b.HasIndex("StudentId");
@@ -164,7 +185,7 @@ namespace Data.Migrations
.HasColumnType("INTEGER");
b.Property<string>("Identifier")
.HasMaxLength(32)
.HasMaxLength(50)
.HasColumnType("TEXT");
b.HasKey("Id");
@@ -173,6 +194,8 @@ namespace Data.Migrations
b.HasIndex("EventId");
b.HasIndex("EventId", "Identifier");
b.ToTable("Teams");
});
@@ -188,7 +211,7 @@ namespace Data.Migrations
b.HasIndex("TeamsId");
b.ToTable("StudentTeam");
b.ToTable("TeamStudents", (string)null);
});
modelBuilder.Entity("Core.Entities.StudentEventRanking", b =>
@@ -214,12 +237,13 @@ namespace Data.Migrations
{
b.HasOne("Core.Entities.Student", "Captain")
.WithMany()
.HasForeignKey("CaptainId");
.HasForeignKey("CaptainId")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("Core.Entities.EventDefinition", "Event")
.WithMany()
.HasForeignKey("EventId")
.OnDelete(DeleteBehavior.Cascade)
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Captain");