по идее обновила датабазу(создала новую), надеюсь все правильно
This commit is contained in:
parent
8541eb5943
commit
086247bcce
@ -15,7 +15,7 @@ namespace ConfectioneryDatabaseImplement
|
|||||||
{
|
{
|
||||||
if (optionsBuilder.IsConfigured == false)
|
if (optionsBuilder.IsConfigured == false)
|
||||||
{
|
{
|
||||||
optionsBuilder.UseSqlServer(@"Data Source=localhost\SQLEXPRESS;Initial Catalog=ConfectioneryDatabaseFull;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
optionsBuilder.UseSqlServer(@"Data Source=localhost\SQLEXPRESS;Initial Catalog=ConfectioneryDatabaseNew;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
||||||
}
|
}
|
||||||
base.OnConfiguring(optionsBuilder);
|
base.OnConfiguring(optionsBuilder);
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|||||||
namespace ConfectioneryDatabaseImplement.Migrations
|
namespace ConfectioneryDatabaseImplement.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(ConfectioneryDatabase))]
|
[DbContext(typeof(ConfectioneryDatabase))]
|
||||||
[Migration("20240328194118_InitialCreate")]
|
[Migration("20240501112235_InitialCreate")]
|
||||||
partial class InitialCreate
|
partial class InitialCreate
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@ -25,6 +25,31 @@ namespace ConfectioneryDatabaseImplement.Migrations
|
|||||||
|
|
||||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.Client", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("ClientFIO")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Email")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Password")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Clients");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.Component", b =>
|
modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.Component", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
@ -53,6 +78,9 @@ namespace ConfectioneryDatabaseImplement.Migrations
|
|||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int?>("ClientId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<int>("Count")
|
b.Property<int>("Count")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
@ -73,6 +101,8 @@ namespace ConfectioneryDatabaseImplement.Migrations
|
|||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ClientId");
|
||||||
|
|
||||||
b.HasIndex("PastryId");
|
b.HasIndex("PastryId");
|
||||||
|
|
||||||
b.ToTable("Orders");
|
b.ToTable("Orders");
|
||||||
@ -126,6 +156,10 @@ namespace ConfectioneryDatabaseImplement.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.Order", b =>
|
modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.Order", b =>
|
||||||
{
|
{
|
||||||
|
b.HasOne("ConfectioneryDatabaseImplement.Models.Client", null)
|
||||||
|
.WithMany("Orders")
|
||||||
|
.HasForeignKey("ClientId");
|
||||||
|
|
||||||
b.HasOne("ConfectioneryDatabaseImplement.Models.Pastry", "Pastry")
|
b.HasOne("ConfectioneryDatabaseImplement.Models.Pastry", "Pastry")
|
||||||
.WithMany("Orders")
|
.WithMany("Orders")
|
||||||
.HasForeignKey("PastryId")
|
.HasForeignKey("PastryId")
|
||||||
@ -154,6 +188,11 @@ namespace ConfectioneryDatabaseImplement.Migrations
|
|||||||
b.Navigation("Pastry");
|
b.Navigation("Pastry");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.Client", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Orders");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.Component", b =>
|
modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.Component", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("PastryComponents");
|
b.Navigation("PastryComponents");
|
@ -11,6 +11,21 @@ namespace ConfectioneryDatabaseImplement.Migrations
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Clients",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
ClientFIO = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Email = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Password = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Clients", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "Components",
|
name: "Components",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
@ -45,16 +60,22 @@ namespace ConfectioneryDatabaseImplement.Migrations
|
|||||||
{
|
{
|
||||||
Id = table.Column<int>(type: "int", nullable: false)
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
PastryId = table.Column<int>(type: "int", nullable: false),
|
||||||
Count = table.Column<int>(type: "int", nullable: false),
|
Count = table.Column<int>(type: "int", nullable: false),
|
||||||
Sum = table.Column<double>(type: "float", nullable: false),
|
Sum = table.Column<double>(type: "float", nullable: false),
|
||||||
Status = table.Column<int>(type: "int", nullable: false),
|
Status = table.Column<int>(type: "int", nullable: false),
|
||||||
DateCreate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
DateCreate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||||
DateImplement = table.Column<DateTime>(type: "datetime2", nullable: true),
|
DateImplement = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||||
PastryId = table.Column<int>(type: "int", nullable: false)
|
ClientId = table.Column<int>(type: "int", nullable: true)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
table.PrimaryKey("PK_Orders", x => x.Id);
|
table.PrimaryKey("PK_Orders", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Orders_Clients_ClientId",
|
||||||
|
column: x => x.ClientId,
|
||||||
|
principalTable: "Clients",
|
||||||
|
principalColumn: "Id");
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "FK_Orders_Pastrys_PastryId",
|
name: "FK_Orders_Pastrys_PastryId",
|
||||||
column: x => x.PastryId,
|
column: x => x.PastryId,
|
||||||
@ -90,6 +111,11 @@ namespace ConfectioneryDatabaseImplement.Migrations
|
|||||||
onDelete: ReferentialAction.Cascade);
|
onDelete: ReferentialAction.Cascade);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Orders_ClientId",
|
||||||
|
table: "Orders",
|
||||||
|
column: "ClientId");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_Orders_PastryId",
|
name: "IX_Orders_PastryId",
|
||||||
table: "Orders",
|
table: "Orders",
|
||||||
@ -115,6 +141,9 @@ namespace ConfectioneryDatabaseImplement.Migrations
|
|||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "PastryComponents");
|
name: "PastryComponents");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Clients");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "Components");
|
name: "Components");
|
||||||
|
|
@ -22,6 +22,31 @@ namespace ConfectioneryDatabaseImplement.Migrations
|
|||||||
|
|
||||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.Client", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("ClientFIO")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Email")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Password")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Clients");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.Component", b =>
|
modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.Component", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
@ -50,6 +75,9 @@ namespace ConfectioneryDatabaseImplement.Migrations
|
|||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int?>("ClientId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<int>("Count")
|
b.Property<int>("Count")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
@ -70,6 +98,8 @@ namespace ConfectioneryDatabaseImplement.Migrations
|
|||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ClientId");
|
||||||
|
|
||||||
b.HasIndex("PastryId");
|
b.HasIndex("PastryId");
|
||||||
|
|
||||||
b.ToTable("Orders");
|
b.ToTable("Orders");
|
||||||
@ -123,6 +153,10 @@ namespace ConfectioneryDatabaseImplement.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.Order", b =>
|
modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.Order", b =>
|
||||||
{
|
{
|
||||||
|
b.HasOne("ConfectioneryDatabaseImplement.Models.Client", null)
|
||||||
|
.WithMany("Orders")
|
||||||
|
.HasForeignKey("ClientId");
|
||||||
|
|
||||||
b.HasOne("ConfectioneryDatabaseImplement.Models.Pastry", "Pastry")
|
b.HasOne("ConfectioneryDatabaseImplement.Models.Pastry", "Pastry")
|
||||||
.WithMany("Orders")
|
.WithMany("Orders")
|
||||||
.HasForeignKey("PastryId")
|
.HasForeignKey("PastryId")
|
||||||
@ -151,6 +185,11 @@ namespace ConfectioneryDatabaseImplement.Migrations
|
|||||||
b.Navigation("Pastry");
|
b.Navigation("Pastry");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.Client", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Orders");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.Component", b =>
|
modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.Component", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("PastryComponents");
|
b.Navigation("PastryComponents");
|
||||||
|
Loading…
Reference in New Issue
Block a user