Первая миграция
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TwoFromTheCasketContracts.Infastructure;
|
||||
|
||||
namespace TwoFromTheCasketDatabase;
|
||||
|
||||
public class DefaultConfigurationDatabase : IConfigurationDatabase
|
||||
{
|
||||
public string ConnectionString => "";
|
||||
}
|
||||
330
TwoFromTheCasketContracts/TwoFromTheCasketDatabase/Migrations/20250417161710_FirstMigration.Designer.cs
generated
Normal file
330
TwoFromTheCasketContracts/TwoFromTheCasketDatabase/Migrations/20250417161710_FirstMigration.Designer.cs
generated
Normal file
@@ -0,0 +1,330 @@
|
||||
// <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 TwoFromTheCasketDatabase;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace TwoFromTheCasketDatabase.Migrations
|
||||
{
|
||||
[DbContext(typeof(TwoFromTheCasketDbContext))]
|
||||
[Migration("20250417161710_FirstMigration")]
|
||||
partial class FirstMigration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "9.0.4")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("TwoFromTheCasketDatabase.Models.ComplitedWork", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("RoomId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("WorkId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RoomId");
|
||||
|
||||
b.HasIndex("WorkId");
|
||||
|
||||
b.ToTable("ComplitedWorks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TwoFromTheCasketDatabase.Models.Room", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Address")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("OwnerFIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<double>("Space")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Address")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Rooms");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TwoFromTheCasketDatabase.Models.RoomHistory", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("ChangeDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("OwnerFIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("RoomId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RoomId");
|
||||
|
||||
b.ToTable("RoomHistories");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TwoFromTheCasketDatabase.Models.Salary", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<double>("Sum")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.Property<string>("WorkerId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WorkerId");
|
||||
|
||||
b.ToTable("Salaries");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TwoFromTheCasketDatabase.Models.Specialization", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("ChangeDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("IsActual")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<double>("Salary")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.Property<string>("SpecializationName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SpecializationName")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Specializations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TwoFromTheCasketDatabase.Models.Work", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Works");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TwoFromTheCasketDatabase.Models.Worker", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("DateBirthDay")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("FIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("IsCurrent")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("PhoneNumber")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("SpecializationId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("ValidFrom")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("PhoneNumber")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("SpecializationId");
|
||||
|
||||
b.ToTable("Workers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TwoFromTheCasketDatabase.Models.WorkerComplitedWork", b =>
|
||||
{
|
||||
b.Property<string>("WorkerId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ComplitedWorkId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<double>("NumberOfWorkingHours")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.HasKey("WorkerId", "ComplitedWorkId");
|
||||
|
||||
b.HasIndex("ComplitedWorkId");
|
||||
|
||||
b.ToTable("WorkerComplitedWorks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TwoFromTheCasketDatabase.Models.ComplitedWork", b =>
|
||||
{
|
||||
b.HasOne("TwoFromTheCasketDatabase.Models.Room", "Room")
|
||||
.WithMany("ComplitedWorks")
|
||||
.HasForeignKey("RoomId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("TwoFromTheCasketDatabase.Models.Work", "Work")
|
||||
.WithMany("ComplitedWorks")
|
||||
.HasForeignKey("WorkId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Room");
|
||||
|
||||
b.Navigation("Work");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TwoFromTheCasketDatabase.Models.RoomHistory", b =>
|
||||
{
|
||||
b.HasOne("TwoFromTheCasketDatabase.Models.Room", "Room")
|
||||
.WithMany("RoomHistories")
|
||||
.HasForeignKey("RoomId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Room");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TwoFromTheCasketDatabase.Models.Salary", b =>
|
||||
{
|
||||
b.HasOne("TwoFromTheCasketDatabase.Models.Worker", "Worker")
|
||||
.WithMany("Salaries")
|
||||
.HasForeignKey("WorkerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Worker");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TwoFromTheCasketDatabase.Models.Worker", b =>
|
||||
{
|
||||
b.HasOne("TwoFromTheCasketDatabase.Models.Specialization", "Specialization")
|
||||
.WithMany("Workers")
|
||||
.HasForeignKey("SpecializationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Specialization");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TwoFromTheCasketDatabase.Models.WorkerComplitedWork", b =>
|
||||
{
|
||||
b.HasOne("TwoFromTheCasketDatabase.Models.ComplitedWork", "ComplitedWork")
|
||||
.WithMany("WorkersComplitedWorks")
|
||||
.HasForeignKey("ComplitedWorkId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("TwoFromTheCasketDatabase.Models.Worker", "Worker")
|
||||
.WithMany("WorkersComplitedWorks")
|
||||
.HasForeignKey("WorkerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("ComplitedWork");
|
||||
|
||||
b.Navigation("Worker");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TwoFromTheCasketDatabase.Models.ComplitedWork", b =>
|
||||
{
|
||||
b.Navigation("WorkersComplitedWorks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TwoFromTheCasketDatabase.Models.Room", b =>
|
||||
{
|
||||
b.Navigation("ComplitedWorks");
|
||||
|
||||
b.Navigation("RoomHistories");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TwoFromTheCasketDatabase.Models.Specialization", b =>
|
||||
{
|
||||
b.Navigation("Workers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TwoFromTheCasketDatabase.Models.Work", b =>
|
||||
{
|
||||
b.Navigation("ComplitedWorks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TwoFromTheCasketDatabase.Models.Worker", b =>
|
||||
{
|
||||
b.Navigation("Salaries");
|
||||
|
||||
b.Navigation("WorkersComplitedWorks");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,250 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace TwoFromTheCasketDatabase.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class FirstMigration : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Rooms",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<string>(type: "text", nullable: false),
|
||||
OwnerFIO = table.Column<string>(type: "text", nullable: false),
|
||||
Address = table.Column<string>(type: "text", nullable: false),
|
||||
Space = table.Column<double>(type: "double precision", nullable: false),
|
||||
Type = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Rooms", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Specializations",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<string>(type: "text", nullable: false),
|
||||
SpecializationName = table.Column<string>(type: "text", 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 with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Specializations", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Works",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<string>(type: "text", nullable: false),
|
||||
Type = table.Column<int>(type: "integer", nullable: false),
|
||||
Description = table.Column<string>(type: "text", nullable: false),
|
||||
Date = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Works", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "RoomHistories",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<string>(type: "text", nullable: false),
|
||||
RoomId = table.Column<string>(type: "text", nullable: false),
|
||||
OwnerFIO = table.Column<string>(type: "text", nullable: false),
|
||||
Type = table.Column<int>(type: "integer", nullable: false),
|
||||
ChangeDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_RoomHistories", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_RoomHistories_Rooms_RoomId",
|
||||
column: x => x.RoomId,
|
||||
principalTable: "Rooms",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Workers",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<string>(type: "text", nullable: false),
|
||||
FIO = table.Column<string>(type: "text", nullable: false),
|
||||
SpecializationId = table.Column<string>(type: "text", nullable: false),
|
||||
PhoneNumber = table.Column<string>(type: "text", nullable: false),
|
||||
DateBirthDay = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
ValidFrom = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
IsCurrent = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Workers", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Workers_Specializations_SpecializationId",
|
||||
column: x => x.SpecializationId,
|
||||
principalTable: "Specializations",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ComplitedWorks",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<string>(type: "text", nullable: false),
|
||||
WorkId = table.Column<string>(type: "text", nullable: false),
|
||||
RoomId = table.Column<string>(type: "text", nullable: false),
|
||||
Date = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ComplitedWorks", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ComplitedWorks_Rooms_RoomId",
|
||||
column: x => x.RoomId,
|
||||
principalTable: "Rooms",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_ComplitedWorks_Works_WorkId",
|
||||
column: x => x.WorkId,
|
||||
principalTable: "Works",
|
||||
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),
|
||||
Sum = table.Column<double>(type: "double precision", nullable: false),
|
||||
Date = table.Column<DateTime>(type: "timestamp with 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: "WorkerComplitedWorks",
|
||||
columns: table => new
|
||||
{
|
||||
WorkerId = table.Column<string>(type: "text", nullable: false),
|
||||
ComplitedWorkId = table.Column<string>(type: "text", nullable: false),
|
||||
NumberOfWorkingHours = table.Column<double>(type: "double precision", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_WorkerComplitedWorks", x => new { x.WorkerId, x.ComplitedWorkId });
|
||||
table.ForeignKey(
|
||||
name: "FK_WorkerComplitedWorks_ComplitedWorks_ComplitedWorkId",
|
||||
column: x => x.ComplitedWorkId,
|
||||
principalTable: "ComplitedWorks",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_WorkerComplitedWorks_Workers_WorkerId",
|
||||
column: x => x.WorkerId,
|
||||
principalTable: "Workers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ComplitedWorks_RoomId",
|
||||
table: "ComplitedWorks",
|
||||
column: "RoomId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ComplitedWorks_WorkId",
|
||||
table: "ComplitedWorks",
|
||||
column: "WorkId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_RoomHistories_RoomId",
|
||||
table: "RoomHistories",
|
||||
column: "RoomId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Rooms_Address",
|
||||
table: "Rooms",
|
||||
column: "Address",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Salaries_WorkerId",
|
||||
table: "Salaries",
|
||||
column: "WorkerId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Specializations_SpecializationName",
|
||||
table: "Specializations",
|
||||
column: "SpecializationName",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_WorkerComplitedWorks_ComplitedWorkId",
|
||||
table: "WorkerComplitedWorks",
|
||||
column: "ComplitedWorkId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Workers_PhoneNumber",
|
||||
table: "Workers",
|
||||
column: "PhoneNumber",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Workers_SpecializationId",
|
||||
table: "Workers",
|
||||
column: "SpecializationId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "RoomHistories");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Salaries");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "WorkerComplitedWorks");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ComplitedWorks");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Workers");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Rooms");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Works");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Specializations");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,327 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using TwoFromTheCasketDatabase;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace TwoFromTheCasketDatabase.Migrations
|
||||
{
|
||||
[DbContext(typeof(TwoFromTheCasketDbContext))]
|
||||
partial class TwoFromTheCasketDbContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "9.0.4")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("TwoFromTheCasketDatabase.Models.ComplitedWork", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("RoomId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("WorkId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RoomId");
|
||||
|
||||
b.HasIndex("WorkId");
|
||||
|
||||
b.ToTable("ComplitedWorks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TwoFromTheCasketDatabase.Models.Room", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Address")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("OwnerFIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<double>("Space")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Address")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Rooms");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TwoFromTheCasketDatabase.Models.RoomHistory", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("ChangeDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("OwnerFIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("RoomId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RoomId");
|
||||
|
||||
b.ToTable("RoomHistories");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TwoFromTheCasketDatabase.Models.Salary", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<double>("Sum")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.Property<string>("WorkerId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WorkerId");
|
||||
|
||||
b.ToTable("Salaries");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TwoFromTheCasketDatabase.Models.Specialization", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("ChangeDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("IsActual")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<double>("Salary")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.Property<string>("SpecializationName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SpecializationName")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Specializations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TwoFromTheCasketDatabase.Models.Work", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Works");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TwoFromTheCasketDatabase.Models.Worker", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("DateBirthDay")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("FIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("IsCurrent")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("PhoneNumber")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("SpecializationId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("ValidFrom")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("PhoneNumber")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("SpecializationId");
|
||||
|
||||
b.ToTable("Workers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TwoFromTheCasketDatabase.Models.WorkerComplitedWork", b =>
|
||||
{
|
||||
b.Property<string>("WorkerId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ComplitedWorkId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<double>("NumberOfWorkingHours")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.HasKey("WorkerId", "ComplitedWorkId");
|
||||
|
||||
b.HasIndex("ComplitedWorkId");
|
||||
|
||||
b.ToTable("WorkerComplitedWorks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TwoFromTheCasketDatabase.Models.ComplitedWork", b =>
|
||||
{
|
||||
b.HasOne("TwoFromTheCasketDatabase.Models.Room", "Room")
|
||||
.WithMany("ComplitedWorks")
|
||||
.HasForeignKey("RoomId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("TwoFromTheCasketDatabase.Models.Work", "Work")
|
||||
.WithMany("ComplitedWorks")
|
||||
.HasForeignKey("WorkId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Room");
|
||||
|
||||
b.Navigation("Work");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TwoFromTheCasketDatabase.Models.RoomHistory", b =>
|
||||
{
|
||||
b.HasOne("TwoFromTheCasketDatabase.Models.Room", "Room")
|
||||
.WithMany("RoomHistories")
|
||||
.HasForeignKey("RoomId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Room");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TwoFromTheCasketDatabase.Models.Salary", b =>
|
||||
{
|
||||
b.HasOne("TwoFromTheCasketDatabase.Models.Worker", "Worker")
|
||||
.WithMany("Salaries")
|
||||
.HasForeignKey("WorkerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Worker");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TwoFromTheCasketDatabase.Models.Worker", b =>
|
||||
{
|
||||
b.HasOne("TwoFromTheCasketDatabase.Models.Specialization", "Specialization")
|
||||
.WithMany("Workers")
|
||||
.HasForeignKey("SpecializationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Specialization");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TwoFromTheCasketDatabase.Models.WorkerComplitedWork", b =>
|
||||
{
|
||||
b.HasOne("TwoFromTheCasketDatabase.Models.ComplitedWork", "ComplitedWork")
|
||||
.WithMany("WorkersComplitedWorks")
|
||||
.HasForeignKey("ComplitedWorkId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("TwoFromTheCasketDatabase.Models.Worker", "Worker")
|
||||
.WithMany("WorkersComplitedWorks")
|
||||
.HasForeignKey("WorkerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("ComplitedWork");
|
||||
|
||||
b.Navigation("Worker");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TwoFromTheCasketDatabase.Models.ComplitedWork", b =>
|
||||
{
|
||||
b.Navigation("WorkersComplitedWorks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TwoFromTheCasketDatabase.Models.Room", b =>
|
||||
{
|
||||
b.Navigation("ComplitedWorks");
|
||||
|
||||
b.Navigation("RoomHistories");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TwoFromTheCasketDatabase.Models.Specialization", b =>
|
||||
{
|
||||
b.Navigation("Workers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TwoFromTheCasketDatabase.Models.Work", b =>
|
||||
{
|
||||
b.Navigation("ComplitedWorks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TwoFromTheCasketDatabase.Models.Worker", b =>
|
||||
{
|
||||
b.Navigation("Salaries");
|
||||
|
||||
b.Navigation("WorkersComplitedWorks");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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 TwoFromTheCasketDatabase;
|
||||
|
||||
internal class SampleContextFactory : IDesignTimeDbContextFactory<TwoFromTheCasketDbContext>
|
||||
{
|
||||
public TwoFromTheCasketDbContext CreateDbContext(string[] args)
|
||||
{
|
||||
return new TwoFromTheCasketDbContext(new DefaultConfigurationDatabase());
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,11 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoMapper" Version="14.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.4">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Npgsql" Version="9.0.3" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.4" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -9,5 +9,5 @@ namespace TwoFromTheCasketTests.Infrastructure;
|
||||
|
||||
public class ConfigurationDatabaseTest : IConfigurationDatabase
|
||||
{
|
||||
public string ConnectionString => "Host=localhost;Port=5432;Database=TwoFromTheCasketDb;Username=postgres;Password=1234";
|
||||
public string ConnectionString => "Host=localhost;Port=5432;Database=TwoFromTheCasketDb;Username=postgres;Password=123456";
|
||||
}
|
||||
@@ -17,15 +17,21 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="coverlet.collector" Version="6.0.2" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="9.0.3" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.3" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
|
||||
<PackageReference Include="coverlet.collector" Version="6.0.4">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="9.0.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.4" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
|
||||
<PackageReference Include="Moq" Version="4.20.72" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.4" />
|
||||
<PackageReference Include="NUnit" Version="4.2.2" />
|
||||
<PackageReference Include="NUnit.Analyzers" Version="4.3.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
|
||||
<PackageReference Include="NUnit" Version="4.3.2" />
|
||||
<PackageReference Include="NUnit.Analyzers" Version="4.7.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="5.0.0" />
|
||||
<PackageReference Include="Serilog" Version="4.2.0" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -9,6 +9,10 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="9.0.3" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.3" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.4">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="8.7.0" />
|
||||
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="8.7.0" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="9.0.0" />
|
||||
|
||||
Reference in New Issue
Block a user