diff --git a/FlowerShop/FlowerShopDatabaseImplement/Migrations/20240425154411_InitCreate.cs b/FlowerShop/FlowerShopDatabaseImplement/Migrations/20240425154411_InitCreate.cs deleted file mode 100644 index 575ed8f..0000000 --- a/FlowerShop/FlowerShopDatabaseImplement/Migrations/20240425154411_InitCreate.cs +++ /dev/null @@ -1,182 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace FlowerShopDatabaseImplement.Migrations -{ - public partial class InitCreate : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Components", - columns: table => new - { - Id = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - ComponentName = table.Column(type: "text", nullable: false), - Cost = table.Column(type: "double precision", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Components", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Flowers", - columns: table => new - { - Id = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - FlowerName = table.Column(type: "text", nullable: false), - Price = table.Column(type: "double precision", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Flowers", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Shops", - columns: table => new - { - Id = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - ShopName = table.Column(type: "text", nullable: false), - Address = table.Column(type: "text", nullable: false), - DateOpening = table.Column(type: "timestamp without time zone", nullable: false), - MaximumFlowers = table.Column(type: "integer", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Shops", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "FlowerComponents", - columns: table => new - { - Id = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - FlowerId = table.Column(type: "integer", nullable: false), - ComponentId = table.Column(type: "integer", nullable: false), - Count = table.Column(type: "integer", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_FlowerComponents", x => x.Id); - table.ForeignKey( - name: "FK_FlowerComponents_Components_ComponentId", - column: x => x.ComponentId, - principalTable: "Components", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_FlowerComponents_Flowers_FlowerId", - column: x => x.FlowerId, - principalTable: "Flowers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "Orders", - columns: table => new - { - Id = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - FlowerId = table.Column(type: "integer", nullable: false), - Count = table.Column(type: "integer", nullable: false), - Sum = table.Column(type: "double precision", nullable: false), - Status = table.Column(type: "integer", nullable: false), - DateCreate = table.Column(type: "timestamp without time zone", nullable: false), - DateImplement = table.Column(type: "timestamp without time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Orders", x => x.Id); - table.ForeignKey( - name: "FK_Orders_Flowers_FlowerId", - column: x => x.FlowerId, - principalTable: "Flowers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ShopFlowers", - columns: table => new - { - Id = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - ShopId = table.Column(type: "integer", nullable: false), - FlowerId = table.Column(type: "integer", nullable: false), - Count = table.Column(type: "integer", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ShopFlowers", x => x.Id); - table.ForeignKey( - name: "FK_ShopFlowers_Flowers_FlowerId", - column: x => x.FlowerId, - principalTable: "Flowers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ShopFlowers_Shops_ShopId", - column: x => x.ShopId, - principalTable: "Shops", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_FlowerComponents_ComponentId", - table: "FlowerComponents", - column: "ComponentId"); - - migrationBuilder.CreateIndex( - name: "IX_FlowerComponents_FlowerId", - table: "FlowerComponents", - column: "FlowerId"); - - migrationBuilder.CreateIndex( - name: "IX_Orders_FlowerId", - table: "Orders", - column: "FlowerId"); - - migrationBuilder.CreateIndex( - name: "IX_ShopFlowers_FlowerId", - table: "ShopFlowers", - column: "FlowerId"); - - migrationBuilder.CreateIndex( - name: "IX_ShopFlowers_ShopId", - table: "ShopFlowers", - column: "ShopId"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "FlowerComponents"); - - migrationBuilder.DropTable( - name: "Orders"); - - migrationBuilder.DropTable( - name: "ShopFlowers"); - - migrationBuilder.DropTable( - name: "Components"); - - migrationBuilder.DropTable( - name: "Flowers"); - - migrationBuilder.DropTable( - name: "Shops"); - } - } -} diff --git a/FlowerShop/FlowerShopDatabaseImplement/Migrations/FlowerShopDatabaseModelSnapshot.cs b/FlowerShop/FlowerShopDatabaseImplement/Migrations/FlowerShopDatabaseModelSnapshot.cs deleted file mode 100644 index 9c5a37a..0000000 --- a/FlowerShop/FlowerShopDatabaseImplement/Migrations/FlowerShopDatabaseModelSnapshot.cs +++ /dev/null @@ -1,243 +0,0 @@ -// -using System; -using FlowerShopDatabaseImplement; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace FlowerShopDatabaseImplement.Migrations -{ - [DbContext(typeof(FlowerShopDatabase))] - partial class FlowerShopDatabaseModelSnapshot : ModelSnapshot - { - protected override void BuildModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "6.0.27") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("FlowerShopDatabaseImplement.Models.Component", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ComponentName") - .IsRequired() - .HasColumnType("text"); - - b.Property("Cost") - .HasColumnType("double precision"); - - b.HasKey("Id"); - - b.ToTable("Components"); - }); - - modelBuilder.Entity("FlowerShopDatabaseImplement.Models.Flower", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("FlowerName") - .IsRequired() - .HasColumnType("text"); - - b.Property("Price") - .HasColumnType("double precision"); - - b.HasKey("Id"); - - b.ToTable("Flowers"); - }); - - modelBuilder.Entity("FlowerShopDatabaseImplement.Models.FlowerComponent", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ComponentId") - .HasColumnType("integer"); - - b.Property("Count") - .HasColumnType("integer"); - - b.Property("FlowerId") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("ComponentId"); - - b.HasIndex("FlowerId"); - - b.ToTable("FlowerComponents"); - }); - - modelBuilder.Entity("FlowerShopDatabaseImplement.Models.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Count") - .HasColumnType("integer"); - - b.Property("DateCreate") - .HasColumnType("timestamp without time zone"); - - b.Property("DateImplement") - .HasColumnType("timestamp without time zone"); - - b.Property("FlowerId") - .HasColumnType("integer"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("Sum") - .HasColumnType("double precision"); - - b.HasKey("Id"); - - b.HasIndex("FlowerId"); - - b.ToTable("Orders"); - }); - - modelBuilder.Entity("FlowerShopDatabaseImplement.Models.Shop", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Address") - .IsRequired() - .HasColumnType("text"); - - b.Property("DateOpening") - .HasColumnType("timestamp without time zone"); - - b.Property("MaximumFlowers") - .HasColumnType("integer"); - - b.Property("ShopName") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Shops"); - }); - - modelBuilder.Entity("FlowerShopDatabaseImplement.Models.ShopFlower", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Count") - .HasColumnType("integer"); - - b.Property("FlowerId") - .HasColumnType("integer"); - - b.Property("ShopId") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("FlowerId"); - - b.HasIndex("ShopId"); - - b.ToTable("ShopFlowers"); - }); - - modelBuilder.Entity("FlowerShopDatabaseImplement.Models.FlowerComponent", b => - { - b.HasOne("FlowerShopDatabaseImplement.Models.Component", "Component") - .WithMany("FlowerComponents") - .HasForeignKey("ComponentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("FlowerShopDatabaseImplement.Models.Flower", "Flower") - .WithMany("Components") - .HasForeignKey("FlowerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Component"); - - b.Navigation("Flower"); - }); - - modelBuilder.Entity("FlowerShopDatabaseImplement.Models.Order", b => - { - b.HasOne("FlowerShopDatabaseImplement.Models.Flower", null) - .WithMany("Orders") - .HasForeignKey("FlowerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("FlowerShopDatabaseImplement.Models.ShopFlower", b => - { - b.HasOne("FlowerShopDatabaseImplement.Models.Flower", "Flower") - .WithMany() - .HasForeignKey("FlowerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("FlowerShopDatabaseImplement.Models.Shop", "Shop") - .WithMany("Flowers") - .HasForeignKey("ShopId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Flower"); - - b.Navigation("Shop"); - }); - - modelBuilder.Entity("FlowerShopDatabaseImplement.Models.Component", b => - { - b.Navigation("FlowerComponents"); - }); - - modelBuilder.Entity("FlowerShopDatabaseImplement.Models.Flower", b => - { - b.Navigation("Components"); - - b.Navigation("Orders"); - }); - - modelBuilder.Entity("FlowerShopDatabaseImplement.Models.Shop", b => - { - b.Navigation("Flowers"); - }); -#pragma warning restore 612, 618 - } - } -}