From 12a56676467cc55c6b75f76ff09f5af770eb32d1 Mon Sep 17 00:00:00 2001 From: GokaPek Date: Mon, 22 Apr 2024 14:08:12 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=B1=D0=B0=D0=B7=D1=8B=20=D0=B4=D0=B0?= =?UTF-8?q?=D0=BD=D0=BD=D1=8B=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... 20240422100607_InitialCreate.Designer.cs} | 67 +++++++++++++--- ...ate.cs => 20240422100607_InitialCreate.cs} | 76 +++++++++++++------ .../AbstractLawFirmDataBaseModelSnapshot.cs | 67 +++++++++++++--- 3 files changed, 165 insertions(+), 45 deletions(-) rename LawFirm/AbstractLawFirmDatabaseImplement/Migrations/{20240325152423_InitialCreate.Designer.cs => 20240422100607_InitialCreate.Designer.cs} (72%) rename LawFirm/AbstractLawFirmDatabaseImplement/Migrations/{20240325152423_InitialCreate.cs => 20240422100607_InitialCreate.cs} (59%) diff --git a/LawFirm/AbstractLawFirmDatabaseImplement/Migrations/20240325152423_InitialCreate.Designer.cs b/LawFirm/AbstractLawFirmDatabaseImplement/Migrations/20240422100607_InitialCreate.Designer.cs similarity index 72% rename from LawFirm/AbstractLawFirmDatabaseImplement/Migrations/20240325152423_InitialCreate.Designer.cs rename to LawFirm/AbstractLawFirmDatabaseImplement/Migrations/20240422100607_InitialCreate.Designer.cs index 716d4c8..f50a377 100644 --- a/LawFirm/AbstractLawFirmDatabaseImplement/Migrations/20240325152423_InitialCreate.Designer.cs +++ b/LawFirm/AbstractLawFirmDatabaseImplement/Migrations/20240422100607_InitialCreate.Designer.cs @@ -9,21 +9,46 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; #nullable disable -namespace AbstractLawFirmDatabaseImplement.Migrations +namespace AbstractLawFirmDataBaseImplement.Migrations { [DbContext(typeof(AbstractLawFirmDatabase))] - [Migration("20240325152423_InitialCreate")] + [Migration("20240422100607_InitialCreate")] partial class InitialCreate { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("DocumentVersion", "6.0.28") + .HasAnnotation("ProductVersion", "6.0.28") .HasAnnotation("Relational:MaxIdentifierLength", 128); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); + modelBuilder.Entity("AbstractLawFirmDataBaseImplement.Models.Client", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); + + b.Property("ClientFIO") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Password") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Clients"); + }); + modelBuilder.Entity("AbstractLawFirmDataBaseImplement.Models.Component", b => { b.Property("Id") @@ -44,7 +69,7 @@ namespace AbstractLawFirmDatabaseImplement.Migrations b.ToTable("Components"); }); - modelBuilder.Entity("AbstractLawFirmDataBaseImplement.Models.Document", b => + modelBuilder.Entity("AbstractLawFirmDatabaseImplement.Models.Document", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -64,7 +89,7 @@ namespace AbstractLawFirmDatabaseImplement.Migrations b.ToTable("Documents"); }); - modelBuilder.Entity("AbstractLawFirmDataBaseImplement.Models.DocumentComponent", b => + modelBuilder.Entity("AbstractLawFirmDatabaseImplement.Models.DocumentComponent", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -90,7 +115,7 @@ namespace AbstractLawFirmDatabaseImplement.Migrations b.ToTable("DocumentComponents"); }); - modelBuilder.Entity("AbstractLawFirmDataBaseImplement.Models.Order", b => + modelBuilder.Entity("AbstractLawFirmDatabaseImplement.Models.Order", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -98,6 +123,9 @@ namespace AbstractLawFirmDatabaseImplement.Migrations SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); + b.Property("ClientId") + .HasColumnType("int"); + b.Property("Count") .HasColumnType("int"); @@ -118,12 +146,14 @@ namespace AbstractLawFirmDatabaseImplement.Migrations b.HasKey("Id"); + b.HasIndex("ClientId"); + b.HasIndex("DocumentId"); b.ToTable("Orders"); }); - modelBuilder.Entity("AbstractLawFirmDataBaseImplement.Models.DocumentComponent", b => + modelBuilder.Entity("AbstractLawFirmDatabaseImplement.Models.DocumentComponent", b => { b.HasOne("AbstractLawFirmDataBaseImplement.Models.Component", "Component") .WithMany("DocumentComponents") @@ -131,7 +161,7 @@ namespace AbstractLawFirmDatabaseImplement.Migrations .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.HasOne("AbstractLawFirmDataBaseImplement.Models.Document", "Document") + b.HasOne("AbstractLawFirmDatabaseImplement.Models.Document", "Document") .WithMany("Components") .HasForeignKey("DocumentId") .OnDelete(DeleteBehavior.Cascade) @@ -142,13 +172,28 @@ namespace AbstractLawFirmDatabaseImplement.Migrations b.Navigation("Document"); }); - modelBuilder.Entity("AbstractLawFirmDataBaseImplement.Models.Order", b => + modelBuilder.Entity("AbstractLawFirmDatabaseImplement.Models.Order", b => { - b.HasOne("AbstractLawFirmDataBaseImplement.Models.Document", null) + b.HasOne("AbstractLawFirmDataBaseImplement.Models.Client", "Client") + .WithMany("Orders") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AbstractLawFirmDatabaseImplement.Models.Document", "Document") .WithMany("Orders") .HasForeignKey("DocumentId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Client"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("AbstractLawFirmDataBaseImplement.Models.Client", b => + { + b.Navigation("Orders"); }); modelBuilder.Entity("AbstractLawFirmDataBaseImplement.Models.Component", b => @@ -156,7 +201,7 @@ namespace AbstractLawFirmDatabaseImplement.Migrations b.Navigation("DocumentComponents"); }); - modelBuilder.Entity("AbstractLawFirmDataBaseImplement.Models.Document", b => + modelBuilder.Entity("AbstractLawFirmDatabaseImplement.Models.Document", b => { b.Navigation("Components"); diff --git a/LawFirm/AbstractLawFirmDatabaseImplement/Migrations/20240325152423_InitialCreate.cs b/LawFirm/AbstractLawFirmDatabaseImplement/Migrations/20240422100607_InitialCreate.cs similarity index 59% rename from LawFirm/AbstractLawFirmDatabaseImplement/Migrations/20240325152423_InitialCreate.cs rename to LawFirm/AbstractLawFirmDatabaseImplement/Migrations/20240422100607_InitialCreate.cs index 76ed1cd..962923d 100644 --- a/LawFirm/AbstractLawFirmDatabaseImplement/Migrations/20240325152423_InitialCreate.cs +++ b/LawFirm/AbstractLawFirmDatabaseImplement/Migrations/20240422100607_InitialCreate.cs @@ -3,12 +3,27 @@ using Microsoft.EntityFrameworkCore.Migrations; #nullable disable -namespace AbstractLawFirmDatabaseImplement.Migrations +namespace AbstractLawFirmDataBaseImplement.Migrations { public partial class InitialCreate : Migration { protected override void Up(MigrationBuilder migrationBuilder) { + migrationBuilder.CreateTable( + name: "Clients", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + ClientFIO = table.Column(type: "nvarchar(max)", nullable: false), + Email = table.Column(type: "nvarchar(max)", nullable: false), + Password = table.Column(type: "nvarchar(max)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Clients", x => x.Id); + }); + migrationBuilder.CreateTable( name: "Components", columns: table => new @@ -65,28 +80,35 @@ namespace AbstractLawFirmDatabaseImplement.Migrations }); migrationBuilder.CreateTable( - name: "Orders", - columns: table => new - { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - DocumentId = table.Column(type: "int", nullable: false), - Count = table.Column(type: "int", nullable: false), - Sum = table.Column(type: "float", nullable: false), - Status = table.Column(type: "int", nullable: false), - DateCreate = table.Column(type: "datetime2", nullable: false), - DateImplement = table.Column(type: "datetime2", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Orders", x => x.Id); - table.ForeignKey( - name: "FK_Orders_Documents_DocumentId", - column: x => x.DocumentId, - principalTable: "Documents", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); + name: "Orders", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + DocumentId = table.Column(type: "int", nullable: false), + ClientId = table.Column(type: "int", nullable: false), + Count = table.Column(type: "int", nullable: false), + Sum = table.Column(type: "float", nullable: false), + Status = table.Column(type: "int", nullable: false), + DateCreate = table.Column(type: "datetime2", nullable: false), + DateImplement = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Orders", x => x.Id); + table.ForeignKey( + name: "FK_Orders_Clients_ClientId", + column: x => x.ClientId, + principalTable: "Clients", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Orders_Documents_DocumentId", + column: x => x.DocumentId, + principalTable: "Documents", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); migrationBuilder.CreateIndex( name: "IX_DocumentComponents_ComponentId", @@ -98,6 +120,11 @@ namespace AbstractLawFirmDatabaseImplement.Migrations table: "DocumentComponents", column: "DocumentId"); + migrationBuilder.CreateIndex( + name: "IX_Orders_ClientId", + table: "Orders", + column: "ClientId"); + migrationBuilder.CreateIndex( name: "IX_Orders_DocumentId", table: "Orders", @@ -115,6 +142,9 @@ namespace AbstractLawFirmDatabaseImplement.Migrations migrationBuilder.DropTable( name: "Components"); + migrationBuilder.DropTable( + name: "Clients"); + migrationBuilder.DropTable( name: "Documents"); } diff --git a/LawFirm/AbstractLawFirmDatabaseImplement/Migrations/AbstractLawFirmDataBaseModelSnapshot.cs b/LawFirm/AbstractLawFirmDatabaseImplement/Migrations/AbstractLawFirmDataBaseModelSnapshot.cs index 910988c..1fb7d69 100644 --- a/LawFirm/AbstractLawFirmDatabaseImplement/Migrations/AbstractLawFirmDataBaseModelSnapshot.cs +++ b/LawFirm/AbstractLawFirmDatabaseImplement/Migrations/AbstractLawFirmDataBaseModelSnapshot.cs @@ -8,20 +8,45 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; #nullable disable -namespace AbstractLawFirmDatabaseImplement.Migrations +namespace AbstractLawFirmDataBaseImplement.Migrations { [DbContext(typeof(AbstractLawFirmDatabase))] - partial class AbstractLawFirmDataBaseModelSnapshot : ModelSnapshot + partial class AbstractLawFirmDatabaseModelSnapshot : ModelSnapshot { protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("DocumentVersion", "6.0.28") + .HasAnnotation("ProductVersion", "6.0.28") .HasAnnotation("Relational:MaxIdentifierLength", 128); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); + modelBuilder.Entity("AbstractLawFirmDataBaseImplement.Models.Client", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); + + b.Property("ClientFIO") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Password") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Clients"); + }); + modelBuilder.Entity("AbstractLawFirmDataBaseImplement.Models.Component", b => { b.Property("Id") @@ -42,7 +67,7 @@ namespace AbstractLawFirmDatabaseImplement.Migrations b.ToTable("Components"); }); - modelBuilder.Entity("AbstractLawFirmDataBaseImplement.Models.Document", b => + modelBuilder.Entity("AbstractLawFirmDatabaseImplement.Models.Document", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -62,7 +87,7 @@ namespace AbstractLawFirmDatabaseImplement.Migrations b.ToTable("Documents"); }); - modelBuilder.Entity("AbstractLawFirmDataBaseImplement.Models.DocumentComponent", b => + modelBuilder.Entity("AbstractLawFirmDatabaseImplement.Models.DocumentComponent", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -88,7 +113,7 @@ namespace AbstractLawFirmDatabaseImplement.Migrations b.ToTable("DocumentComponents"); }); - modelBuilder.Entity("AbstractLawFirmDataBaseImplement.Models.Order", b => + modelBuilder.Entity("AbstractLawFirmDatabaseImplement.Models.Order", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -96,6 +121,9 @@ namespace AbstractLawFirmDatabaseImplement.Migrations SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); + b.Property("ClientId") + .HasColumnType("int"); + b.Property("Count") .HasColumnType("int"); @@ -116,12 +144,14 @@ namespace AbstractLawFirmDatabaseImplement.Migrations b.HasKey("Id"); + b.HasIndex("ClientId"); + b.HasIndex("DocumentId"); b.ToTable("Orders"); }); - modelBuilder.Entity("AbstractLawFirmDataBaseImplement.Models.DocumentComponent", b => + modelBuilder.Entity("AbstractLawFirmDatabaseImplement.Models.DocumentComponent", b => { b.HasOne("AbstractLawFirmDataBaseImplement.Models.Component", "Component") .WithMany("DocumentComponents") @@ -129,7 +159,7 @@ namespace AbstractLawFirmDatabaseImplement.Migrations .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.HasOne("AbstractLawFirmDataBaseImplement.Models.Document", "Document") + b.HasOne("AbstractLawFirmDatabaseImplement.Models.Document", "Document") .WithMany("Components") .HasForeignKey("DocumentId") .OnDelete(DeleteBehavior.Cascade) @@ -140,13 +170,28 @@ namespace AbstractLawFirmDatabaseImplement.Migrations b.Navigation("Document"); }); - modelBuilder.Entity("AbstractLawFirmDataBaseImplement.Models.Order", b => + modelBuilder.Entity("AbstractLawFirmDatabaseImplement.Models.Order", b => { - b.HasOne("AbstractLawFirmDataBaseImplement.Models.Document", null) + b.HasOne("AbstractLawFirmDataBaseImplement.Models.Client", "Client") + .WithMany("Orders") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AbstractLawFirmDatabaseImplement.Models.Document", "Document") .WithMany("Orders") .HasForeignKey("DocumentId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Client"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("AbstractLawFirmDataBaseImplement.Models.Client", b => + { + b.Navigation("Orders"); }); modelBuilder.Entity("AbstractLawFirmDataBaseImplement.Models.Component", b => @@ -154,7 +199,7 @@ namespace AbstractLawFirmDatabaseImplement.Migrations b.Navigation("DocumentComponents"); }); - modelBuilder.Entity("AbstractLawFirmDataBaseImplement.Models.Document", b => + modelBuilder.Entity("AbstractLawFirmDatabaseImplement.Models.Document", b => { b.Navigation("Components");