и мое сердце остановилось, мое сердце замерло

This commit is contained in:
1234 2024-05-01 00:26:47 +04:00
parent 607551a8be
commit d5223d7463
4 changed files with 1032 additions and 0 deletions

View File

@ -0,0 +1,372 @@
// <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 UniversityDatabaseImplement;
#nullable disable
namespace UniversityDatabaseImplement.Migrations
{
[DbContext(typeof(UniversityDB))]
[Migration("20230515153721_Init")]
partial class Init
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.4")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("UniversityDatabaseImplement.Models.Account", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("ClientByDisciplineId")
.HasColumnType("integer");
b.Property<DateOnly>("DateOfAccount")
.HasColumnType("date");
b.Property<double>("Price")
.HasColumnType("double precision");
b.HasKey("Id");
b.HasIndex("ClientByDisciplineId");
b.ToTable("Accounts");
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.Client", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("Course")
.HasColumnType("integer");
b.Property<int>("DirectorId")
.HasColumnType("integer");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<double>("Price")
.HasColumnType("double precision");
b.HasKey("Id");
b.HasIndex("DirectorId");
b.ToTable("Clients");
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.ClientByDiscipline", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<DateTime>("DateOfClient")
.HasColumnType("timestamp with time zone");
b.Property<int>("DisciplineId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ClientId");
b.HasIndex("DisciplineId");
b.ToTable("ClientsByDisciplines");
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.Director", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("FirstName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("LastName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Login")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PhoneNumber")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Directors");
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.Discipline", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<DateOnly>("DateOfPassage")
.HasColumnType("date");
b.Property<DateOnly>("DateOfReceipt")
.HasColumnType("date");
b.Property<int>("ImplementerId")
.HasColumnType("integer");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<double>("Price")
.HasColumnType("double precision");
b.HasKey("Id");
b.HasIndex("ImplementerId");
b.ToTable("Disciplines");
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.Implementer", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("FirstName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("LastName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Login")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PhoneNumber")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Implementers");
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.Requirement", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("DirectorId")
.HasColumnType("integer");
b.Property<string>("NameOfRequirement")
.IsRequired()
.HasColumnType("text");
b.Property<double>("Price")
.HasColumnType("double precision");
b.HasKey("Id");
b.HasIndex("DirectorId");
b.ToTable("Requirements");
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.RequirementByDiscipline", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("Count")
.HasColumnType("integer");
b.Property<int>("DisciplineId")
.HasColumnType("integer");
b.Property<int>("RequirementId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("DisciplineId");
b.HasIndex("RequirementId");
b.ToTable("RequirementByDisciplines");
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.Account", b =>
{
b.HasOne("UniversityDatabaseImplement.Models.ClientByDiscipline", "ClientByDiscipline")
.WithMany("Accounts")
.HasForeignKey("ClientByDisciplineId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ClientByDiscipline");
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.Client", b =>
{
b.HasOne("UniversityDatabaseImplement.Models.Director", "Director")
.WithMany("Clients")
.HasForeignKey("DirectorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Director");
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.ClientByDiscipline", b =>
{
b.HasOne("UniversityDatabaseImplement.Models.Client", "Client")
.WithMany("Disciplines")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("UniversityDatabaseImplement.Models.Discipline", "Discipline")
.WithMany("Clients")
.HasForeignKey("DisciplineId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
b.Navigation("Discipline");
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.Discipline", b =>
{
b.HasOne("UniversityDatabaseImplement.Models.Implementer", "Client")
.WithMany("Disciplines")
.HasForeignKey("ImplementerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.Requirement", b =>
{
b.HasOne("UniversityDatabaseImplement.Models.Director", "Director")
.WithMany("Requirements")
.HasForeignKey("DirectorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Director");
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.RequirementByDiscipline", b =>
{
b.HasOne("UniversityDatabaseImplement.Models.Discipline", "Discipline")
.WithMany("Requirements")
.HasForeignKey("DisciplineId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("UniversityDatabaseImplement.Models.Requirement", "Requirement")
.WithMany("Disciplines")
.HasForeignKey("RequirementId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Discipline");
b.Navigation("Requirement");
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.Client", b =>
{
b.Navigation("Disciplines");
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.ClientByDiscipline", b =>
{
b.Navigation("Accounts");
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.Director", b =>
{
b.Navigation("Clients");
b.Navigation("Requirements");
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.Discipline", b =>
{
b.Navigation("Clients");
b.Navigation("Requirements");
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.Implementer", b =>
{
b.Navigation("Disciplines");
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.Requirement", b =>
{
b.Navigation("Disciplines");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,259 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace UniversityDatabaseImplement.Migrations
{
/// <inheritdoc />
public partial class Init : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Directors",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
FirstName = table.Column<string>(type: "text", nullable: false),
LastName = table.Column<string>(type: "text", nullable: false),
Login = table.Column<string>(type: "text", nullable: false),
Password = table.Column<string>(type: "text", nullable: false),
PhoneNumber = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Directors", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Implementers",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
FirstName = table.Column<string>(type: "text", nullable: false),
LastName = table.Column<string>(type: "text", nullable: false),
Login = table.Column<string>(type: "text", nullable: false),
Password = table.Column<string>(type: "text", nullable: false),
PhoneNumber = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Implementers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Clients",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
DirectorId = table.Column<int>(type: "integer", nullable: false),
Name = table.Column<string>(type: "text", nullable: false),
Price = table.Column<double>(type: "double precision", nullable: false),
Course = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Clients", x => x.Id);
table.ForeignKey(
name: "FK_Clients_Directors_DirectorId",
column: x => x.DirectorId,
principalTable: "Directors",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Requirements",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
DirectorId = table.Column<int>(type: "integer", nullable: false),
NameOfRequirement = table.Column<string>(type: "text", nullable: false),
Price = table.Column<double>(type: "double precision", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Requirements", x => x.Id);
table.ForeignKey(
name: "FK_Requirements_Directors_DirectorId",
column: x => x.DirectorId,
principalTable: "Directors",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Disciplines",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ImplementerId = table.Column<int>(type: "integer", nullable: false),
Name = table.Column<string>(type: "text", nullable: false),
Price = table.Column<double>(type: "double precision", nullable: false),
DateOfReceipt = table.Column<DateOnly>(type: "date", nullable: false),
DateOfPassage = table.Column<DateOnly>(type: "date", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Disciplines", x => x.Id);
table.ForeignKey(
name: "FK_Disciplines_Implementers_ImplementerId",
column: x => x.ImplementerId,
principalTable: "Implementers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ClientsByDisciplines",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ClientId = table.Column<int>(type: "integer", nullable: false),
DisciplineId = table.Column<int>(type: "integer", nullable: false),
DateOfClient = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ClientsByDisciplines", x => x.Id);
table.ForeignKey(
name: "FK_ClientsByDisciplines_Clients_ClientId",
column: x => x.ClientId,
principalTable: "Clients",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ClientsByDisciplines_Disciplines_DisciplineId",
column: x => x.DisciplineId,
principalTable: "Disciplines",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "RequirementByDisciplines",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
RequirementId = table.Column<int>(type: "integer", nullable: false),
DisciplineId = table.Column<int>(type: "integer", nullable: false),
Count = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_RequirementByDisciplines", x => x.Id);
table.ForeignKey(
name: "FK_RequirementByDisciplines_Disciplines_DisciplineId",
column: x => x.DisciplineId,
principalTable: "Disciplines",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_RequirementByDisciplines_Requirements_RequirementId",
column: x => x.RequirementId,
principalTable: "Requirements",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Accounts",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ClientByDisciplineId = table.Column<int>(type: "integer", nullable: false),
DateOfAccount = table.Column<DateOnly>(type: "date", nullable: false),
Price = table.Column<double>(type: "double precision", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Accounts", x => x.Id);
table.ForeignKey(
name: "FK_Accounts_ClientsByDisciplines_ClientByDisciplineId",
column: x => x.ClientByDisciplineId,
principalTable: "ClientsByDisciplines",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Accounts_ClientByDisciplineId",
table: "Accounts",
column: "ClientByDisciplineId");
migrationBuilder.CreateIndex(
name: "IX_Clients_DirectorId",
table: "Clients",
column: "DirectorId");
migrationBuilder.CreateIndex(
name: "IX_ClientsByDisciplines_ClientId",
table: "ClientsByDisciplines",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_ClientsByDisciplines_DisciplineId",
table: "ClientsByDisciplines",
column: "DisciplineId");
migrationBuilder.CreateIndex(
name: "IX_Disciplines_ImplementerId",
table: "Disciplines",
column: "ImplementerId");
migrationBuilder.CreateIndex(
name: "IX_RequirementByDisciplines_DisciplineId",
table: "RequirementByDisciplines",
column: "DisciplineId");
migrationBuilder.CreateIndex(
name: "IX_RequirementByDisciplines_RequirementId",
table: "RequirementByDisciplines",
column: "RequirementId");
migrationBuilder.CreateIndex(
name: "IX_Requirements_DirectorId",
table: "Requirements",
column: "DirectorId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Accounts");
migrationBuilder.DropTable(
name: "RequirementByDisciplines");
migrationBuilder.DropTable(
name: "ClientsByDisciplines");
migrationBuilder.DropTable(
name: "Requirements");
migrationBuilder.DropTable(
name: "Clients");
migrationBuilder.DropTable(
name: "Disciplines");
migrationBuilder.DropTable(
name: "Directors");
migrationBuilder.DropTable(
name: "Implementers");
}
}
}

View File

@ -0,0 +1,369 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using UniversityDatabaseImplement;
#nullable disable
namespace UniversityDatabaseImplement.Migrations
{
[DbContext(typeof(UniversityDB))]
partial class UniversityDBModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.4")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("UniversityDatabaseImplement.Models.Account", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("ClientByDisciplineId")
.HasColumnType("integer");
b.Property<DateOnly>("DateOfAccount")
.HasColumnType("date");
b.Property<double>("Price")
.HasColumnType("double precision");
b.HasKey("Id");
b.HasIndex("ClientByDisciplineId");
b.ToTable("Accounts");
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.Client", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("Course")
.HasColumnType("integer");
b.Property<int>("DirectorId")
.HasColumnType("integer");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<double>("Price")
.HasColumnType("double precision");
b.HasKey("Id");
b.HasIndex("DirectorId");
b.ToTable("Clients");
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.ClientByDiscipline", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<DateTime>("DateOfClient")
.HasColumnType("timestamp with time zone");
b.Property<int>("DisciplineId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ClientId");
b.HasIndex("DisciplineId");
b.ToTable("ClientsByDisciplines");
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.Director", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("FirstName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("LastName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Login")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PhoneNumber")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Directors");
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.Discipline", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<DateOnly>("DateOfPassage")
.HasColumnType("date");
b.Property<DateOnly>("DateOfReceipt")
.HasColumnType("date");
b.Property<int>("ImplementerId")
.HasColumnType("integer");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<double>("Price")
.HasColumnType("double precision");
b.HasKey("Id");
b.HasIndex("ImplementerId");
b.ToTable("Disciplines");
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.Implementer", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("FirstName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("LastName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Login")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PhoneNumber")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Implementers");
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.Requirement", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("DirectorId")
.HasColumnType("integer");
b.Property<string>("NameOfRequirement")
.IsRequired()
.HasColumnType("text");
b.Property<double>("Price")
.HasColumnType("double precision");
b.HasKey("Id");
b.HasIndex("DirectorId");
b.ToTable("Requirements");
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.RequirementByDiscipline", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("Count")
.HasColumnType("integer");
b.Property<int>("DisciplineId")
.HasColumnType("integer");
b.Property<int>("RequirementId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("DisciplineId");
b.HasIndex("RequirementId");
b.ToTable("RequirementByDisciplines");
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.Account", b =>
{
b.HasOne("UniversityDatabaseImplement.Models.ClientByDiscipline", "ClientByDiscipline")
.WithMany("Accounts")
.HasForeignKey("ClientByDisciplineId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ClientByDiscipline");
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.Client", b =>
{
b.HasOne("UniversityDatabaseImplement.Models.Director", "Director")
.WithMany("Clients")
.HasForeignKey("DirectorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Director");
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.ClientByDiscipline", b =>
{
b.HasOne("UniversityDatabaseImplement.Models.Client", "Client")
.WithMany("Disciplines")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("UniversityDatabaseImplement.Models.Discipline", "Discipline")
.WithMany("Clients")
.HasForeignKey("DisciplineId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
b.Navigation("Discipline");
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.Discipline", b =>
{
b.HasOne("UniversityDatabaseImplement.Models.Implementer", "Client")
.WithMany("Disciplines")
.HasForeignKey("ImplementerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.Requirement", b =>
{
b.HasOne("UniversityDatabaseImplement.Models.Director", "Director")
.WithMany("Requirements")
.HasForeignKey("DirectorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Director");
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.RequirementByDiscipline", b =>
{
b.HasOne("UniversityDatabaseImplement.Models.Discipline", "Discipline")
.WithMany("Requirements")
.HasForeignKey("DisciplineId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("UniversityDatabaseImplement.Models.Requirement", "Requirement")
.WithMany("Disciplines")
.HasForeignKey("RequirementId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Discipline");
b.Navigation("Requirement");
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.Client", b =>
{
b.Navigation("Disciplines");
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.ClientByDiscipline", b =>
{
b.Navigation("Accounts");
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.Director", b =>
{
b.Navigation("Clients");
b.Navigation("Requirements");
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.Discipline", b =>
{
b.Navigation("Clients");
b.Navigation("Requirements");
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.Implementer", b =>
{
b.Navigation("Disciplines");
});
modelBuilder.Entity("UniversityDatabaseImplement.Models.Requirement", b =>
{
b.Navigation("Disciplines");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,32 @@
using UniversityDatabaseImplement.Models;
using Microsoft.EntityFrameworkCore;
namespace UniversityDatabaseImplement
{
public class UniversityDB : DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (optionsBuilder.IsConfigured == false)
{
optionsBuilder.UseNpgsql(@"
Host=localhost;
Port=5432;
Database=University;
Username=postgres;
Password=1234;
Include Error Detail=true");
}
base.OnConfiguring(optionsBuilder);
}
public virtual DbSet<Implementer> Implementers { set; get; }
public virtual DbSet<Requirement> Requirements { set; get; }
public virtual DbSet<RequirementByDiscipline> RequirementByDisciplines { set; get; }
public virtual DbSet<Director> Directors { set; get; }
public virtual DbSet<Client> Clients { set; get; }
public virtual DbSet<ClientByDiscipline> ClientsByDisciplines { set; get; }
public virtual DbSet<Account> Accounts { set; get; }
public virtual DbSet<Discipline> Disciplines { set; get; }
}
}