diff --git a/src/CSharp/EasyMicroservices.SupportsMicroservice.Database/Database/Contexts/SupportContext.cs b/src/CSharp/EasyMicroservices.SupportsMicroservice.Database/Database/Contexts/SupportContext.cs index 25f3eea..4ef92e8 100644 --- a/src/CSharp/EasyMicroservices.SupportsMicroservice.Database/Database/Contexts/SupportContext.cs +++ b/src/CSharp/EasyMicroservices.SupportsMicroservice.Database/Database/Contexts/SupportContext.cs @@ -60,7 +60,6 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) .WithMany(b => b.TicketDepartments) .HasForeignKey(bc => bc.DepartmentId); - model.HasIndex(bc => bc.TicketId).IsUnique(); }); modelBuilder.Entity(model => @@ -79,7 +78,6 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) .WithMany(b => b.TicketAssigns) .HasForeignKey(bc => bc.TicketId); - model.HasIndex(bc => bc.TicketId).IsUnique(); }); modelBuilder.Entity(model => { diff --git a/src/CSharp/EasyMicroservices.SupportsMicroservice.Database/Migrations/20231128153829_remove_isunique.Designer.cs b/src/CSharp/EasyMicroservices.SupportsMicroservice.Database/Migrations/20231128153829_remove_isunique.Designer.cs new file mode 100644 index 0000000..1effacf --- /dev/null +++ b/src/CSharp/EasyMicroservices.SupportsMicroservice.Database/Migrations/20231128153829_remove_isunique.Designer.cs @@ -0,0 +1,441 @@ +// +using System; +using EasyMicroservices.SupportsMicroservice.Database.Contexts; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace EasyMicroservices.SupportsMicroservice.Migrations +{ + [DbContext(typeof(SupportContext))] + [Migration("20231128153829_remove_isunique")] + partial class remove_isunique + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.14") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("EasyMicroservices.SupportsMicroservice.Database.Entities.DepartmentEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreationDateTime") + .HasColumnType("datetime2"); + + b.Property("DeletedDateTime") + .HasColumnType("datetime2"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("ModificationDateTime") + .HasColumnType("datetime2"); + + b.Property("Title") + .HasColumnType("nvarchar(max)"); + + b.Property("UniqueIdentity") + .HasColumnType("nvarchar(450)") + .UseCollation("SQL_Latin1_General_CP1_CS_AS"); + + b.HasKey("Id"); + + b.HasIndex("CreationDateTime"); + + b.HasIndex("DeletedDateTime"); + + b.HasIndex("IsDeleted"); + + b.HasIndex("ModificationDateTime"); + + b.HasIndex("UniqueIdentity"); + + b.ToTable("Departmants"); + }); + + modelBuilder.Entity("EasyMicroservices.SupportsMicroservice.Database.Entities.TicketAssignEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreationDateTime") + .HasColumnType("datetime2"); + + b.Property("DeletedDateTime") + .HasColumnType("datetime2"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("ModificationDateTime") + .HasColumnType("datetime2"); + + b.Property("TicketId") + .HasColumnType("bigint"); + + b.Property("UniqueIdentity") + .HasColumnType("nvarchar(450)") + .UseCollation("SQL_Latin1_General_CP1_CS_AS"); + + b.HasKey("Id"); + + b.HasIndex("CreationDateTime"); + + b.HasIndex("DeletedDateTime"); + + b.HasIndex("IsDeleted"); + + b.HasIndex("ModificationDateTime"); + + b.HasIndex("TicketId"); + + b.HasIndex("UniqueIdentity"); + + b.ToTable("TicketAssigns"); + }); + + modelBuilder.Entity("EasyMicroservices.SupportsMicroservice.Database.Entities.TicketDepartmentEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreationDateTime") + .HasColumnType("datetime2"); + + b.Property("DeletedDateTime") + .HasColumnType("datetime2"); + + b.Property("DepartmentId") + .HasColumnType("bigint"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("ModificationDateTime") + .HasColumnType("datetime2"); + + b.Property("TicketId") + .HasColumnType("bigint"); + + b.Property("UniqueIdentity") + .HasColumnType("nvarchar(450)") + .UseCollation("SQL_Latin1_General_CP1_CS_AS"); + + b.HasKey("Id"); + + b.HasIndex("CreationDateTime"); + + b.HasIndex("DeletedDateTime"); + + b.HasIndex("DepartmentId"); + + b.HasIndex("IsDeleted"); + + b.HasIndex("ModificationDateTime"); + + b.HasIndex("TicketId"); + + b.HasIndex("UniqueIdentity"); + + b.ToTable("TicketDepartments"); + }); + + modelBuilder.Entity("EasyMicroservices.SupportsMicroservice.Database.Entities.TicketDiscussionEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Content") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationDateTime") + .HasColumnType("datetime2"); + + b.Property("DeletedDateTime") + .HasColumnType("datetime2"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("ModificationDateTime") + .HasColumnType("datetime2"); + + b.Property("TicketId") + .HasColumnType("bigint"); + + b.Property("UniqueIdentity") + .HasColumnType("nvarchar(450)") + .UseCollation("SQL_Latin1_General_CP1_CS_AS"); + + b.HasKey("Id"); + + b.HasIndex("CreationDateTime"); + + b.HasIndex("DeletedDateTime"); + + b.HasIndex("IsDeleted"); + + b.HasIndex("ModificationDateTime"); + + b.HasIndex("TicketId"); + + b.HasIndex("UniqueIdentity"); + + b.ToTable("TicketDiscussions"); + }); + + modelBuilder.Entity("EasyMicroservices.SupportsMicroservice.Database.Entities.TicketEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreationDateTime") + .HasColumnType("datetime2"); + + b.Property("DeletedDateTime") + .HasColumnType("datetime2"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("ModificationDateTime") + .HasColumnType("datetime2"); + + b.Property("Priority") + .HasColumnType("int"); + + b.Property("SensitivityStatus") + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("Title") + .HasColumnType("nvarchar(max)"); + + b.Property("UniqueIdentity") + .HasColumnType("nvarchar(450)") + .UseCollation("SQL_Latin1_General_CP1_CS_AS"); + + b.HasKey("Id"); + + b.HasIndex("CreationDateTime"); + + b.HasIndex("DeletedDateTime"); + + b.HasIndex("IsDeleted"); + + b.HasIndex("ModificationDateTime"); + + b.HasIndex("UniqueIdentity"); + + b.ToTable("Tickets"); + }); + + modelBuilder.Entity("EasyMicroservices.SupportsMicroservice.Database.Entities.TicketHistoryEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Content") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationDateTime") + .HasColumnType("datetime2"); + + b.Property("DeletedDateTime") + .HasColumnType("datetime2"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("ModificationDateTime") + .HasColumnType("datetime2"); + + b.Property("TicketId") + .HasColumnType("bigint"); + + b.Property("UniqueIdentity") + .HasColumnType("nvarchar(450)") + .UseCollation("SQL_Latin1_General_CP1_CS_AS"); + + b.HasKey("Id"); + + b.HasIndex("CreationDateTime"); + + b.HasIndex("DeletedDateTime"); + + b.HasIndex("IsDeleted"); + + b.HasIndex("ModificationDateTime"); + + b.HasIndex("TicketId"); + + b.HasIndex("UniqueIdentity"); + + b.ToTable("TicketHistories"); + }); + + modelBuilder.Entity("EasyMicroservices.SupportsMicroservice.Database.Entities.TicketSupportTimeHistoryEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreationDateTime") + .HasColumnType("datetime2"); + + b.Property("DeletedDateTime") + .HasColumnType("datetime2"); + + b.Property("EndDateTime") + .HasColumnType("datetime2"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("ModificationDateTime") + .HasColumnType("datetime2"); + + b.Property("StartDateTime") + .HasColumnType("datetime2"); + + b.Property("TicketId") + .HasColumnType("bigint"); + + b.Property("UniqueIdentity") + .HasColumnType("nvarchar(450)") + .UseCollation("SQL_Latin1_General_CP1_CS_AS"); + + b.HasKey("Id"); + + b.HasIndex("CreationDateTime"); + + b.HasIndex("DeletedDateTime"); + + b.HasIndex("IsDeleted"); + + b.HasIndex("ModificationDateTime"); + + b.HasIndex("TicketId"); + + b.HasIndex("UniqueIdentity"); + + b.ToTable("TicketSupportTimeHistories"); + }); + + modelBuilder.Entity("EasyMicroservices.SupportsMicroservice.Database.Entities.TicketAssignEntity", b => + { + b.HasOne("EasyMicroservices.SupportsMicroservice.Database.Entities.TicketEntity", "Ticket") + .WithMany("TicketAssigns") + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Ticket"); + }); + + modelBuilder.Entity("EasyMicroservices.SupportsMicroservice.Database.Entities.TicketDepartmentEntity", b => + { + b.HasOne("EasyMicroservices.SupportsMicroservice.Database.Entities.DepartmentEntity", "Department") + .WithMany("TicketDepartments") + .HasForeignKey("DepartmentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("EasyMicroservices.SupportsMicroservice.Database.Entities.TicketEntity", "Ticket") + .WithMany("TicketDepartments") + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Department"); + + b.Navigation("Ticket"); + }); + + modelBuilder.Entity("EasyMicroservices.SupportsMicroservice.Database.Entities.TicketDiscussionEntity", b => + { + b.HasOne("EasyMicroservices.SupportsMicroservice.Database.Entities.TicketEntity", "Ticket") + .WithMany("TicketDiscussions") + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Ticket"); + }); + + modelBuilder.Entity("EasyMicroservices.SupportsMicroservice.Database.Entities.TicketHistoryEntity", b => + { + b.HasOne("EasyMicroservices.SupportsMicroservice.Database.Entities.TicketEntity", "Ticket") + .WithMany("TicketHistories") + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Ticket"); + }); + + modelBuilder.Entity("EasyMicroservices.SupportsMicroservice.Database.Entities.TicketSupportTimeHistoryEntity", b => + { + b.HasOne("EasyMicroservices.SupportsMicroservice.Database.Entities.TicketEntity", "Ticket") + .WithMany("TicketSupportTimeHistories") + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Ticket"); + }); + + modelBuilder.Entity("EasyMicroservices.SupportsMicroservice.Database.Entities.DepartmentEntity", b => + { + b.Navigation("TicketDepartments"); + }); + + modelBuilder.Entity("EasyMicroservices.SupportsMicroservice.Database.Entities.TicketEntity", b => + { + b.Navigation("TicketAssigns"); + + b.Navigation("TicketDepartments"); + + b.Navigation("TicketDiscussions"); + + b.Navigation("TicketHistories"); + + b.Navigation("TicketSupportTimeHistories"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/CSharp/EasyMicroservices.SupportsMicroservice.Database/Migrations/20231128153829_remove_isunique.cs b/src/CSharp/EasyMicroservices.SupportsMicroservice.Database/Migrations/20231128153829_remove_isunique.cs new file mode 100644 index 0000000..80b9e83 --- /dev/null +++ b/src/CSharp/EasyMicroservices.SupportsMicroservice.Database/Migrations/20231128153829_remove_isunique.cs @@ -0,0 +1,56 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace EasyMicroservices.SupportsMicroservice.Migrations +{ + /// + public partial class remove_isunique : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropIndex( + name: "IX_TicketDepartments_TicketId", + table: "TicketDepartments"); + + migrationBuilder.DropIndex( + name: "IX_TicketAssigns_TicketId", + table: "TicketAssigns"); + + migrationBuilder.CreateIndex( + name: "IX_TicketDepartments_TicketId", + table: "TicketDepartments", + column: "TicketId"); + + migrationBuilder.CreateIndex( + name: "IX_TicketAssigns_TicketId", + table: "TicketAssigns", + column: "TicketId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropIndex( + name: "IX_TicketDepartments_TicketId", + table: "TicketDepartments"); + + migrationBuilder.DropIndex( + name: "IX_TicketAssigns_TicketId", + table: "TicketAssigns"); + + migrationBuilder.CreateIndex( + name: "IX_TicketDepartments_TicketId", + table: "TicketDepartments", + column: "TicketId", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_TicketAssigns_TicketId", + table: "TicketAssigns", + column: "TicketId", + unique: true); + } + } +} diff --git a/src/CSharp/EasyMicroservices.SupportsMicroservice.Database/Migrations/SupportContextModelSnapshot.cs b/src/CSharp/EasyMicroservices.SupportsMicroservice.Database/Migrations/SupportContextModelSnapshot.cs index f62b5bb..0c5f351 100644 --- a/src/CSharp/EasyMicroservices.SupportsMicroservice.Database/Migrations/SupportContextModelSnapshot.cs +++ b/src/CSharp/EasyMicroservices.SupportsMicroservice.Database/Migrations/SupportContextModelSnapshot.cs @@ -101,8 +101,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("ModificationDateTime"); - b.HasIndex("TicketId") - .IsUnique(); + b.HasIndex("TicketId"); b.HasIndex("UniqueIdentity"); @@ -151,8 +150,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("ModificationDateTime"); - b.HasIndex("TicketId") - .IsUnique(); + b.HasIndex("TicketId"); b.HasIndex("UniqueIdentity");