Миграция

This commit is contained in:
dasha 2023-04-06 21:28:58 +04:00
parent 51a8119546
commit 3244f9d2ea
4 changed files with 21 additions and 22 deletions

View File

@ -7,6 +7,10 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.13" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

View File

@ -12,8 +12,8 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace HardwareShopDatabaseImplement.Migrations
{
[DbContext(typeof(HardwareShopDatabase))]
[Migration("20230402135808_init")]
partial class init
[Migration("20230406172812_InitMigration")]
partial class InitMigration
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -112,6 +112,9 @@ namespace HardwareShopDatabaseImplement.Migrations
b.Property<double>("Cost")
.HasColumnType("double precision");
b.Property<DateTime>("DateCreate")
.HasColumnType("timestamp with time zone");
b.Property<int>("UserId")
.HasColumnType("integer");
@ -376,24 +379,20 @@ namespace HardwareShopDatabaseImplement.Migrations
modelBuilder.Entity("HardwareShopDatabaseImplement.Models.Storekeeper.Component", b =>
{
b.HasOne("HardwareShopDatabaseImplement.Models.User", "User")
b.HasOne("HardwareShopDatabaseImplement.Models.User", null)
.WithMany("Components")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("HardwareShopDatabaseImplement.Models.Storekeeper.Good", b =>
{
b.HasOne("HardwareShopDatabaseImplement.Models.User", "User")
b.HasOne("HardwareShopDatabaseImplement.Models.User", null)
.WithMany("Goods")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("HardwareShopDatabaseImplement.Models.Storekeeper.Order", b =>
@ -404,15 +403,13 @@ namespace HardwareShopDatabaseImplement.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("HardwareShopDatabaseImplement.Models.User", "User")
b.HasOne("HardwareShopDatabaseImplement.Models.User", null)
.WithMany("Orders")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Good");
b.Navigation("User");
});
modelBuilder.Entity("HardwareShopDatabaseImplement.Models.Worker.Build", b =>

View File

@ -7,7 +7,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace HardwareShopDatabaseImplement.Migrations
{
/// <inheritdoc />
public partial class init : Migration
public partial class InitMigration : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
@ -57,7 +57,8 @@ namespace HardwareShopDatabaseImplement.Migrations
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ComponentName = table.Column<string>(type: "text", nullable: false),
Cost = table.Column<double>(type: "double precision", nullable: false),
UserId = table.Column<int>(type: "integer", nullable: false)
UserId = table.Column<int>(type: "integer", nullable: false),
DateCreate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{

View File

@ -109,6 +109,9 @@ namespace HardwareShopDatabaseImplement.Migrations
b.Property<double>("Cost")
.HasColumnType("double precision");
b.Property<DateTime>("DateCreate")
.HasColumnType("timestamp with time zone");
b.Property<int>("UserId")
.HasColumnType("integer");
@ -373,24 +376,20 @@ namespace HardwareShopDatabaseImplement.Migrations
modelBuilder.Entity("HardwareShopDatabaseImplement.Models.Storekeeper.Component", b =>
{
b.HasOne("HardwareShopDatabaseImplement.Models.User", "User")
b.HasOne("HardwareShopDatabaseImplement.Models.User", null)
.WithMany("Components")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("HardwareShopDatabaseImplement.Models.Storekeeper.Good", b =>
{
b.HasOne("HardwareShopDatabaseImplement.Models.User", "User")
b.HasOne("HardwareShopDatabaseImplement.Models.User", null)
.WithMany("Goods")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("HardwareShopDatabaseImplement.Models.Storekeeper.Order", b =>
@ -401,15 +400,13 @@ namespace HardwareShopDatabaseImplement.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("HardwareShopDatabaseImplement.Models.User", "User")
b.HasOne("HardwareShopDatabaseImplement.Models.User", null)
.WithMany("Orders")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Good");
b.Navigation("User");
});
modelBuilder.Entity("HardwareShopDatabaseImplement.Models.Worker.Build", b =>