first migration

This commit is contained in:
2025-04-17 18:07:41 +04:00
parent fddb9c9d83
commit 1b8b1a06f8
7 changed files with 964 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
using SmallSoftwareContracts.Infrastructure;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SmallSoftwareDatabase;
class DefaultConfigurationDatabase : IConfigurationDatabase
{
public string ConnectionString => "";
}

View File

@@ -0,0 +1,338 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using SmallSoftwareDatabase;
#nullable disable
namespace SmallSoftwareDatabase.Migrations
{
[DbContext(typeof(SmallSoftwareDbContext))]
[Migration("20250417140247_FirstMigration")]
partial class FirstMigration
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "9.0.2")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("SmallSoftwareDatabase.Models.InstallationRequest", b =>
{
b.Property<string>("RequestId")
.HasColumnType("text");
b.Property<string>("SoftwareId")
.HasColumnType("text");
b.Property<int>("Count")
.HasColumnType("integer");
b.Property<double>("Price")
.HasColumnType("double precision");
b.HasKey("RequestId", "SoftwareId");
b.HasIndex("SoftwareId");
b.ToTable("InstallationRequests");
});
modelBuilder.Entity("SmallSoftwareDatabase.Models.Manufacturer", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<string>("ManufacturerName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PrevManufacturerName")
.HasColumnType("text");
b.Property<string>("PrevPrevManufacturerName")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ManufacturerName")
.IsUnique();
b.ToTable("Manufacturers");
});
modelBuilder.Entity("SmallSoftwareDatabase.Models.Post", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<DateTime>("ChangeDate")
.HasColumnType("timestamp without time zone");
b.Property<bool>("IsActual")
.HasColumnType("boolean");
b.Property<string>("PostId")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PostName")
.IsRequired()
.HasColumnType("text");
b.Property<int>("PostType")
.HasColumnType("integer");
b.Property<double>("Salary")
.HasColumnType("double precision");
b.HasKey("Id");
b.HasIndex("PostId", "IsActual")
.IsUnique()
.HasFilter("\"IsActual\" = TRUE");
b.HasIndex("PostName", "IsActual")
.IsUnique()
.HasFilter("\"IsActual\" = TRUE");
b.ToTable("Posts");
});
modelBuilder.Entity("SmallSoftwareDatabase.Models.Request", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<string>("Email")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsCancel")
.HasColumnType("boolean");
b.Property<DateTime>("RequestDate")
.HasColumnType("timestamp without time zone");
b.Property<double>("Sum")
.HasColumnType("double precision");
b.Property<string>("WorkerId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("WorkerId");
b.ToTable("Requests");
});
modelBuilder.Entity("SmallSoftwareDatabase.Models.Salary", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<DateTime>("SalaryDate")
.HasColumnType("timestamp without time zone");
b.Property<string>("WorkerId")
.IsRequired()
.HasColumnType("text");
b.Property<double>("WorkerSalary")
.HasColumnType("double precision");
b.HasKey("Id");
b.HasIndex("WorkerId");
b.ToTable("Salaries");
});
modelBuilder.Entity("SmallSoftwareDatabase.Models.Software", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<bool>("IsDeleted")
.HasColumnType("boolean");
b.Property<string>("ManufacturerId")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PrevPrevSoftwareName")
.HasColumnType("text");
b.Property<string>("PrevSoftwareName")
.HasColumnType("text");
b.Property<double>("Price")
.HasColumnType("double precision");
b.Property<string>("SoftwareName")
.IsRequired()
.HasColumnType("text");
b.Property<int>("SoftwareType")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ManufacturerId");
b.HasIndex("SoftwareName", "IsDeleted")
.IsUnique()
.HasFilter("\"IsDeleted\" = FALSE");
b.ToTable("Softwares");
});
modelBuilder.Entity("SmallSoftwareDatabase.Models.SoftwareHistory", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<DateTime>("ChangeDate")
.HasColumnType("timestamp without time zone");
b.Property<double>("OldPrice")
.HasColumnType("double precision");
b.Property<string>("SoftwareId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("SoftwareId");
b.ToTable("SoftwareHistories");
});
modelBuilder.Entity("SmallSoftwareDatabase.Models.Worker", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<DateTime>("BirthDate")
.HasColumnType("timestamp without time zone");
b.Property<DateTime>("EmploymentDate")
.HasColumnType("timestamp without time zone");
b.Property<string>("FIO")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsDeleted")
.HasColumnType("boolean");
b.Property<string>("PostId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Workers");
});
modelBuilder.Entity("SmallSoftwareDatabase.Models.InstallationRequest", b =>
{
b.HasOne("SmallSoftwareDatabase.Models.Request", "Request")
.WithMany("InstallationRequests")
.HasForeignKey("RequestId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("SmallSoftwareDatabase.Models.Software", "Software")
.WithMany("InstallationRequests")
.HasForeignKey("SoftwareId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Request");
b.Navigation("Software");
});
modelBuilder.Entity("SmallSoftwareDatabase.Models.Request", b =>
{
b.HasOne("SmallSoftwareDatabase.Models.Worker", "Worker")
.WithMany("Requests")
.HasForeignKey("WorkerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Worker");
});
modelBuilder.Entity("SmallSoftwareDatabase.Models.Salary", b =>
{
b.HasOne("SmallSoftwareDatabase.Models.Worker", "Worker")
.WithMany("Salaries")
.HasForeignKey("WorkerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Worker");
});
modelBuilder.Entity("SmallSoftwareDatabase.Models.Software", b =>
{
b.HasOne("SmallSoftwareDatabase.Models.Manufacturer", "Manufacturer")
.WithMany("Softwares")
.HasForeignKey("ManufacturerId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Manufacturer");
});
modelBuilder.Entity("SmallSoftwareDatabase.Models.SoftwareHistory", b =>
{
b.HasOne("SmallSoftwareDatabase.Models.Software", "Software")
.WithMany("SoftwareHistories")
.HasForeignKey("SoftwareId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Software");
});
modelBuilder.Entity("SmallSoftwareDatabase.Models.Manufacturer", b =>
{
b.Navigation("Softwares");
});
modelBuilder.Entity("SmallSoftwareDatabase.Models.Request", b =>
{
b.Navigation("InstallationRequests");
});
modelBuilder.Entity("SmallSoftwareDatabase.Models.Software", b =>
{
b.Navigation("InstallationRequests");
b.Navigation("SoftwareHistories");
});
modelBuilder.Entity("SmallSoftwareDatabase.Models.Worker", b =>
{
b.Navigation("Requests");
b.Navigation("Salaries");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,254 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace SmallSoftwareDatabase.Migrations
{
/// <inheritdoc />
public partial class FirstMigration : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Manufacturers",
columns: table => new
{
Id = table.Column<string>(type: "text", nullable: false),
ManufacturerName = table.Column<string>(type: "text", nullable: false),
PrevManufacturerName = table.Column<string>(type: "text", nullable: true),
PrevPrevManufacturerName = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Manufacturers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Posts",
columns: table => new
{
Id = table.Column<string>(type: "text", nullable: false),
PostId = table.Column<string>(type: "text", nullable: false),
PostName = table.Column<string>(type: "text", nullable: false),
PostType = table.Column<int>(type: "integer", nullable: false),
Salary = table.Column<double>(type: "double precision", nullable: false),
IsActual = table.Column<bool>(type: "boolean", nullable: false),
ChangeDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Posts", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Workers",
columns: table => new
{
Id = table.Column<string>(type: "text", nullable: false),
FIO = table.Column<string>(type: "text", nullable: false),
PostId = table.Column<string>(type: "text", nullable: false),
BirthDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
EmploymentDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
IsDeleted = table.Column<bool>(type: "boolean", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Workers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Softwares",
columns: table => new
{
Id = table.Column<string>(type: "text", nullable: false),
SoftwareName = table.Column<string>(type: "text", nullable: false),
SoftwareType = table.Column<int>(type: "integer", nullable: false),
ManufacturerId = table.Column<string>(type: "text", nullable: false),
Price = table.Column<double>(type: "double precision", nullable: false),
IsDeleted = table.Column<bool>(type: "boolean", nullable: false),
PrevSoftwareName = table.Column<string>(type: "text", nullable: true),
PrevPrevSoftwareName = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Softwares", x => x.Id);
table.ForeignKey(
name: "FK_Softwares_Manufacturers_ManufacturerId",
column: x => x.ManufacturerId,
principalTable: "Manufacturers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "Requests",
columns: table => new
{
Id = table.Column<string>(type: "text", nullable: false),
WorkerId = table.Column<string>(type: "text", nullable: false),
RequestDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
Email = table.Column<string>(type: "text", nullable: false),
Sum = table.Column<double>(type: "double precision", nullable: false),
IsCancel = table.Column<bool>(type: "boolean", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Requests", x => x.Id);
table.ForeignKey(
name: "FK_Requests_Workers_WorkerId",
column: x => x.WorkerId,
principalTable: "Workers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Salaries",
columns: table => new
{
Id = table.Column<string>(type: "text", nullable: false),
WorkerId = table.Column<string>(type: "text", nullable: false),
WorkerSalary = table.Column<double>(type: "double precision", nullable: false),
SalaryDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Salaries", x => x.Id);
table.ForeignKey(
name: "FK_Salaries_Workers_WorkerId",
column: x => x.WorkerId,
principalTable: "Workers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "SoftwareHistories",
columns: table => new
{
Id = table.Column<string>(type: "text", nullable: false),
SoftwareId = table.Column<string>(type: "text", nullable: false),
OldPrice = table.Column<double>(type: "double precision", nullable: false),
ChangeDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_SoftwareHistories", x => x.Id);
table.ForeignKey(
name: "FK_SoftwareHistories_Softwares_SoftwareId",
column: x => x.SoftwareId,
principalTable: "Softwares",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "InstallationRequests",
columns: table => new
{
SoftwareId = table.Column<string>(type: "text", nullable: false),
RequestId = table.Column<string>(type: "text", nullable: false),
Count = table.Column<int>(type: "integer", nullable: false),
Price = table.Column<double>(type: "double precision", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_InstallationRequests", x => new { x.RequestId, x.SoftwareId });
table.ForeignKey(
name: "FK_InstallationRequests_Requests_RequestId",
column: x => x.RequestId,
principalTable: "Requests",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_InstallationRequests_Softwares_SoftwareId",
column: x => x.SoftwareId,
principalTable: "Softwares",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_InstallationRequests_SoftwareId",
table: "InstallationRequests",
column: "SoftwareId");
migrationBuilder.CreateIndex(
name: "IX_Manufacturers_ManufacturerName",
table: "Manufacturers",
column: "ManufacturerName",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Posts_PostId_IsActual",
table: "Posts",
columns: new[] { "PostId", "IsActual" },
unique: true,
filter: "\"IsActual\" = TRUE");
migrationBuilder.CreateIndex(
name: "IX_Posts_PostName_IsActual",
table: "Posts",
columns: new[] { "PostName", "IsActual" },
unique: true,
filter: "\"IsActual\" = TRUE");
migrationBuilder.CreateIndex(
name: "IX_Requests_WorkerId",
table: "Requests",
column: "WorkerId");
migrationBuilder.CreateIndex(
name: "IX_Salaries_WorkerId",
table: "Salaries",
column: "WorkerId");
migrationBuilder.CreateIndex(
name: "IX_SoftwareHistories_SoftwareId",
table: "SoftwareHistories",
column: "SoftwareId");
migrationBuilder.CreateIndex(
name: "IX_Softwares_ManufacturerId",
table: "Softwares",
column: "ManufacturerId");
migrationBuilder.CreateIndex(
name: "IX_Softwares_SoftwareName_IsDeleted",
table: "Softwares",
columns: new[] { "SoftwareName", "IsDeleted" },
unique: true,
filter: "\"IsDeleted\" = FALSE");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "InstallationRequests");
migrationBuilder.DropTable(
name: "Posts");
migrationBuilder.DropTable(
name: "Salaries");
migrationBuilder.DropTable(
name: "SoftwareHistories");
migrationBuilder.DropTable(
name: "Requests");
migrationBuilder.DropTable(
name: "Softwares");
migrationBuilder.DropTable(
name: "Workers");
migrationBuilder.DropTable(
name: "Manufacturers");
}
}
}

View File

@@ -0,0 +1,335 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using SmallSoftwareDatabase;
#nullable disable
namespace SmallSoftwareDatabase.Migrations
{
[DbContext(typeof(SmallSoftwareDbContext))]
partial class SmallSoftwareDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "9.0.2")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("SmallSoftwareDatabase.Models.InstallationRequest", b =>
{
b.Property<string>("RequestId")
.HasColumnType("text");
b.Property<string>("SoftwareId")
.HasColumnType("text");
b.Property<int>("Count")
.HasColumnType("integer");
b.Property<double>("Price")
.HasColumnType("double precision");
b.HasKey("RequestId", "SoftwareId");
b.HasIndex("SoftwareId");
b.ToTable("InstallationRequests");
});
modelBuilder.Entity("SmallSoftwareDatabase.Models.Manufacturer", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<string>("ManufacturerName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PrevManufacturerName")
.HasColumnType("text");
b.Property<string>("PrevPrevManufacturerName")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ManufacturerName")
.IsUnique();
b.ToTable("Manufacturers");
});
modelBuilder.Entity("SmallSoftwareDatabase.Models.Post", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<DateTime>("ChangeDate")
.HasColumnType("timestamp without time zone");
b.Property<bool>("IsActual")
.HasColumnType("boolean");
b.Property<string>("PostId")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PostName")
.IsRequired()
.HasColumnType("text");
b.Property<int>("PostType")
.HasColumnType("integer");
b.Property<double>("Salary")
.HasColumnType("double precision");
b.HasKey("Id");
b.HasIndex("PostId", "IsActual")
.IsUnique()
.HasFilter("\"IsActual\" = TRUE");
b.HasIndex("PostName", "IsActual")
.IsUnique()
.HasFilter("\"IsActual\" = TRUE");
b.ToTable("Posts");
});
modelBuilder.Entity("SmallSoftwareDatabase.Models.Request", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<string>("Email")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsCancel")
.HasColumnType("boolean");
b.Property<DateTime>("RequestDate")
.HasColumnType("timestamp without time zone");
b.Property<double>("Sum")
.HasColumnType("double precision");
b.Property<string>("WorkerId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("WorkerId");
b.ToTable("Requests");
});
modelBuilder.Entity("SmallSoftwareDatabase.Models.Salary", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<DateTime>("SalaryDate")
.HasColumnType("timestamp without time zone");
b.Property<string>("WorkerId")
.IsRequired()
.HasColumnType("text");
b.Property<double>("WorkerSalary")
.HasColumnType("double precision");
b.HasKey("Id");
b.HasIndex("WorkerId");
b.ToTable("Salaries");
});
modelBuilder.Entity("SmallSoftwareDatabase.Models.Software", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<bool>("IsDeleted")
.HasColumnType("boolean");
b.Property<string>("ManufacturerId")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PrevPrevSoftwareName")
.HasColumnType("text");
b.Property<string>("PrevSoftwareName")
.HasColumnType("text");
b.Property<double>("Price")
.HasColumnType("double precision");
b.Property<string>("SoftwareName")
.IsRequired()
.HasColumnType("text");
b.Property<int>("SoftwareType")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ManufacturerId");
b.HasIndex("SoftwareName", "IsDeleted")
.IsUnique()
.HasFilter("\"IsDeleted\" = FALSE");
b.ToTable("Softwares");
});
modelBuilder.Entity("SmallSoftwareDatabase.Models.SoftwareHistory", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<DateTime>("ChangeDate")
.HasColumnType("timestamp without time zone");
b.Property<double>("OldPrice")
.HasColumnType("double precision");
b.Property<string>("SoftwareId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("SoftwareId");
b.ToTable("SoftwareHistories");
});
modelBuilder.Entity("SmallSoftwareDatabase.Models.Worker", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<DateTime>("BirthDate")
.HasColumnType("timestamp without time zone");
b.Property<DateTime>("EmploymentDate")
.HasColumnType("timestamp without time zone");
b.Property<string>("FIO")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsDeleted")
.HasColumnType("boolean");
b.Property<string>("PostId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Workers");
});
modelBuilder.Entity("SmallSoftwareDatabase.Models.InstallationRequest", b =>
{
b.HasOne("SmallSoftwareDatabase.Models.Request", "Request")
.WithMany("InstallationRequests")
.HasForeignKey("RequestId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("SmallSoftwareDatabase.Models.Software", "Software")
.WithMany("InstallationRequests")
.HasForeignKey("SoftwareId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Request");
b.Navigation("Software");
});
modelBuilder.Entity("SmallSoftwareDatabase.Models.Request", b =>
{
b.HasOne("SmallSoftwareDatabase.Models.Worker", "Worker")
.WithMany("Requests")
.HasForeignKey("WorkerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Worker");
});
modelBuilder.Entity("SmallSoftwareDatabase.Models.Salary", b =>
{
b.HasOne("SmallSoftwareDatabase.Models.Worker", "Worker")
.WithMany("Salaries")
.HasForeignKey("WorkerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Worker");
});
modelBuilder.Entity("SmallSoftwareDatabase.Models.Software", b =>
{
b.HasOne("SmallSoftwareDatabase.Models.Manufacturer", "Manufacturer")
.WithMany("Softwares")
.HasForeignKey("ManufacturerId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Manufacturer");
});
modelBuilder.Entity("SmallSoftwareDatabase.Models.SoftwareHistory", b =>
{
b.HasOne("SmallSoftwareDatabase.Models.Software", "Software")
.WithMany("SoftwareHistories")
.HasForeignKey("SoftwareId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Software");
});
modelBuilder.Entity("SmallSoftwareDatabase.Models.Manufacturer", b =>
{
b.Navigation("Softwares");
});
modelBuilder.Entity("SmallSoftwareDatabase.Models.Request", b =>
{
b.Navigation("InstallationRequests");
});
modelBuilder.Entity("SmallSoftwareDatabase.Models.Software", b =>
{
b.Navigation("InstallationRequests");
b.Navigation("SoftwareHistories");
});
modelBuilder.Entity("SmallSoftwareDatabase.Models.Worker", b =>
{
b.Navigation("Requests");
b.Navigation("Salaries");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,16 @@
using Microsoft.EntityFrameworkCore.Design;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SmallSoftwareDatabase;
internal class SampleContextFactory : IDesignTimeDbContextFactory<SmallSoftwareDbContext>
{
public SmallSoftwareDbContext CreateDbContext(string[] args)
{
return new SmallSoftwareDbContext(new DefaultConfigurationDatabase());
}
}

View File

@@ -9,6 +9,10 @@
<ItemGroup>
<PackageReference Include="AutoMapper" Version="14.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.3" />
</ItemGroup>

View File

@@ -9,6 +9,10 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="9.0.3" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Serilog.AspNetCore" Version="9.0.0" />
</ItemGroup>