diff --git a/FoodOrders/FoodOrdersDatabaseImplement/Migrations/20230228062451_ThirdMigration.Designer.cs b/FoodOrders/FoodOrdersDatabaseImplement/Migrations/20230228062451_ThirdMigration.Designer.cs new file mode 100644 index 0000000..8645355 --- /dev/null +++ b/FoodOrders/FoodOrdersDatabaseImplement/Migrations/20230228062451_ThirdMigration.Designer.cs @@ -0,0 +1,169 @@ +// +using System; +using FoodOrdersDatabaseImplement; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace FoodOrdersDatabaseImplement.Migrations +{ + [DbContext(typeof(FoodOrdersDatabase))] + [Migration("20230228062451_ThirdMigration")] + partial class ThirdMigration + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.3") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("FoodOrdersDatabaseImplement.Models.Component", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ComponentName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Cost") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.ToTable("Components"); + }); + + modelBuilder.Entity("FoodOrdersDatabaseImplement.Models.Dish", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("DishName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Price") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.ToTable("Dishes"); + }); + + modelBuilder.Entity("FoodOrdersDatabaseImplement.Models.DishComponent", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ComponentId") + .HasColumnType("int"); + + b.Property("Count") + .HasColumnType("int"); + + b.Property("DishId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ComponentId"); + + b.HasIndex("DishId"); + + b.ToTable("DishComponents"); + }); + + modelBuilder.Entity("FoodOrdersDatabaseImplement.Models.Order", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Count") + .HasColumnType("int"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateImplement") + .HasColumnType("datetime2"); + + b.Property("DishId") + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("Sum") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.HasIndex("DishId"); + + b.ToTable("Orders"); + }); + + modelBuilder.Entity("FoodOrdersDatabaseImplement.Models.DishComponent", b => + { + b.HasOne("FoodOrdersDatabaseImplement.Models.Component", "Component") + .WithMany("DishComponents") + .HasForeignKey("ComponentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("FoodOrdersDatabaseImplement.Models.Dish", "Dish") + .WithMany("Components") + .HasForeignKey("DishId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Component"); + + b.Navigation("Dish"); + }); + + modelBuilder.Entity("FoodOrdersDatabaseImplement.Models.Order", b => + { + b.HasOne("FoodOrdersDatabaseImplement.Models.Dish", "Dish") + .WithMany() + .HasForeignKey("DishId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Dish"); + }); + + modelBuilder.Entity("FoodOrdersDatabaseImplement.Models.Component", b => + { + b.Navigation("DishComponents"); + }); + + modelBuilder.Entity("FoodOrdersDatabaseImplement.Models.Dish", b => + { + b.Navigation("Components"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/FoodOrders/FoodOrdersDatabaseImplement/Migrations/20230228062451_ThirdMigration.cs b/FoodOrders/FoodOrdersDatabaseImplement/Migrations/20230228062451_ThirdMigration.cs new file mode 100644 index 0000000..5b89b48 --- /dev/null +++ b/FoodOrders/FoodOrdersDatabaseImplement/Migrations/20230228062451_ThirdMigration.cs @@ -0,0 +1,37 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace FoodOrdersDatabaseImplement.Migrations +{ + /// + public partial class ThirdMigration : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "DateImplement", + table: "Orders", + type: "datetime2", + nullable: true, + oldClrType: typeof(DateTime), + oldType: "datetime2"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "DateImplement", + table: "Orders", + type: "datetime2", + nullable: false, + defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + oldClrType: typeof(DateTime), + oldType: "datetime2", + oldNullable: true); + } + } +} diff --git a/FoodOrders/FoodOrdersDatabaseImplement/Migrations/FoodOrdersDatabaseModelSnapshot.cs b/FoodOrders/FoodOrdersDatabaseImplement/Migrations/FoodOrdersDatabaseModelSnapshot.cs index 1eb004b..6d911c5 100644 --- a/FoodOrders/FoodOrdersDatabaseImplement/Migrations/FoodOrdersDatabaseModelSnapshot.cs +++ b/FoodOrders/FoodOrdersDatabaseImplement/Migrations/FoodOrdersDatabaseModelSnapshot.cs @@ -103,7 +103,6 @@ namespace FoodOrdersDatabaseImplement.Migrations .HasColumnType("datetime2"); b.Property("DateImplement") - .IsRequired() .HasColumnType("datetime2"); b.Property("DishId")