Миграция

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> </PropertyGroup>
<ItemGroup> <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="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.13" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup> </ItemGroup>

View File

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

View File

@ -7,7 +7,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace HardwareShopDatabaseImplement.Migrations namespace HardwareShopDatabaseImplement.Migrations
{ {
/// <inheritdoc /> /// <inheritdoc />
public partial class init : Migration public partial class InitMigration : Migration
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
@ -57,7 +57,8 @@ namespace HardwareShopDatabaseImplement.Migrations
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ComponentName = table.Column<string>(type: "text", nullable: false), ComponentName = table.Column<string>(type: "text", nullable: false),
Cost = table.Column<double>(type: "double precision", 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 => constraints: table =>
{ {

View File

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