Compare commits
2 Commits
f4f0834859
...
63fec6a1db
Author | SHA1 | Date | |
---|---|---|---|
|
63fec6a1db | ||
|
3156a6d518 |
@ -1,7 +1,32 @@
|
||||
namespace CarCenterDatabaseImplement
|
||||
{
|
||||
public class Class1
|
||||
{
|
||||
using CarCenterDatabaseImplement.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
}
|
||||
namespace CarCenterDatabaseImplement
|
||||
{
|
||||
public class CarCenterDb : DbContext
|
||||
{
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
if (optionsBuilder.IsConfigured == false)
|
||||
{
|
||||
optionsBuilder.UseNpgsql(@"
|
||||
Host=localhost;
|
||||
Port=5432;
|
||||
Database=CarCenter;
|
||||
Username=postgres;
|
||||
Password=postgres;
|
||||
Include Error Detail=true");
|
||||
}
|
||||
base.OnConfiguring(optionsBuilder);
|
||||
}
|
||||
|
||||
public virtual DbSet<Implementer> Implementers { set; get; }
|
||||
public virtual DbSet<Requirement> Requirements { set; get; }
|
||||
public virtual DbSet<RequirementByCar> RequirementByCars { set; get; }
|
||||
public virtual DbSet<Director> Directors { set; get; }
|
||||
public virtual DbSet<Client> Clients { set; get; }
|
||||
public virtual DbSet<ClientByCar> ClientsByCars { set; get; }
|
||||
public virtual DbSet<Account> Accounts { set; get; }
|
||||
public virtual DbSet<Car> Cars { set; get; }
|
||||
}
|
||||
}
|
||||
|
372
CarCenterDatabaseImplement/Migrations/20240429152414_InitialCreate.Designer.cs
generated
Normal file
372
CarCenterDatabaseImplement/Migrations/20240429152414_InitialCreate.Designer.cs
generated
Normal 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 CarCenterDatabaseImplement;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CarCenterDatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(CarCenterDB))]
|
||||
[Migration("20240429152414_InitialCreate")]
|
||||
partial class InitialCreate
|
||||
{
|
||||
/// <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("CarCenterDatabaseImplement.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("CarCenterDatabaseImplement.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("CarCenterDatabaseImplement.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("CarCenterDatabaseImplement.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("CarCenterDatabaseImplement.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("CarCenterDatabaseImplement.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("CarCenterDatabaseImplement.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("CarCenterDatabaseImplement.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("CarCenterDatabaseImplement.Models.Account", b =>
|
||||
{
|
||||
b.HasOne("CarCenterDatabaseImplement.Models.ClientByDiscipline", "ClientByDiscipline")
|
||||
.WithMany("Accounts")
|
||||
.HasForeignKey("ClientByDisciplineId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("ClientByDiscipline");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CarCenterDatabaseImplement.Models.Client", b =>
|
||||
{
|
||||
b.HasOne("CarCenterDatabaseImplement.Models.Director", "Director")
|
||||
.WithMany("Clients")
|
||||
.HasForeignKey("DirectorId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Director");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CarCenterDatabaseImplement.Models.ClientByDiscipline", b =>
|
||||
{
|
||||
b.HasOne("CarCenterDatabaseImplement.Models.Client", "Client")
|
||||
.WithMany("Disciplines")
|
||||
.HasForeignKey("ClientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CarCenterDatabaseImplement.Models.Discipline", "Discipline")
|
||||
.WithMany("Clients")
|
||||
.HasForeignKey("DisciplineId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Client");
|
||||
|
||||
b.Navigation("Discipline");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CarCenterDatabaseImplement.Models.Discipline", b =>
|
||||
{
|
||||
b.HasOne("CarCenterDatabaseImplement.Models.Implementer", "Client")
|
||||
.WithMany("Disciplines")
|
||||
.HasForeignKey("ImplementerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Client");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CarCenterDatabaseImplement.Models.Requirement", b =>
|
||||
{
|
||||
b.HasOne("CarCenterDatabaseImplement.Models.Director", "Director")
|
||||
.WithMany("Requirements")
|
||||
.HasForeignKey("DirectorId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Director");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CarCenterDatabaseImplement.Models.RequirementByDiscipline", b =>
|
||||
{
|
||||
b.HasOne("CarCenterDatabaseImplement.Models.Discipline", "Discipline")
|
||||
.WithMany("Requirements")
|
||||
.HasForeignKey("DisciplineId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CarCenterDatabaseImplement.Models.Requirement", "Requirement")
|
||||
.WithMany("Disciplines")
|
||||
.HasForeignKey("RequirementId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Discipline");
|
||||
|
||||
b.Navigation("Requirement");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CarCenterDatabaseImplement.Models.Client", b =>
|
||||
{
|
||||
b.Navigation("Disciplines");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CarCenterDatabaseImplement.Models.ClientByDiscipline", b =>
|
||||
{
|
||||
b.Navigation("Accounts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CarCenterDatabaseImplement.Models.Director", b =>
|
||||
{
|
||||
b.Navigation("Clients");
|
||||
|
||||
b.Navigation("Requirements");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CarCenterDatabaseImplement.Models.Discipline", b =>
|
||||
{
|
||||
b.Navigation("Clients");
|
||||
|
||||
b.Navigation("Requirements");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CarCenterDatabaseImplement.Models.Implementer", b =>
|
||||
{
|
||||
b.Navigation("Disciplines");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CarCenterDatabaseImplement.Models.Requirement", b =>
|
||||
{
|
||||
b.Navigation("Disciplines");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,259 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CarCenterDatabaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class InitialCreate : 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");
|
||||
}
|
||||
}
|
||||
}
|
@ -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>("ClientByModelsId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateOnly>("DateOfAccount")
|
||||
.HasColumnType("date");
|
||||
|
||||
b.Property<double>("Price")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ClientByModelsId");
|
||||
|
||||
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.ClientByModels", 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>("ModelsId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ClientId");
|
||||
|
||||
b.HasIndex("ModelsId");
|
||||
|
||||
b.ToTable("ClientsByModelss");
|
||||
});
|
||||
|
||||
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.Models", 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("Modelss");
|
||||
});
|
||||
|
||||
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.RequirementByModels", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ModelsId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("RequirementId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ModelsId");
|
||||
|
||||
b.HasIndex("RequirementId");
|
||||
|
||||
b.ToTable("RequirementByModelss");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDatabaseImplement.Models.Account", b =>
|
||||
{
|
||||
b.HasOne("UniversityDatabaseImplement.Models.ClientByModels", "ClientByModels")
|
||||
.WithMany("Accounts")
|
||||
.HasForeignKey("ClientByModelsId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("ClientByModels");
|
||||
});
|
||||
|
||||
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.ClientByModels", b =>
|
||||
{
|
||||
b.HasOne("UniversityDatabaseImplement.Models.Client", "Client")
|
||||
.WithMany("Modelss")
|
||||
.HasForeignKey("ClientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("UniversityDatabaseImplement.Models.Models", "Models")
|
||||
.WithMany("Clients")
|
||||
.HasForeignKey("ModelsId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Client");
|
||||
|
||||
b.Navigation("Models");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDatabaseImplement.Models.Models", b =>
|
||||
{
|
||||
b.HasOne("UniversityDatabaseImplement.Models.Implementer", "Client")
|
||||
.WithMany("Modelss")
|
||||
.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.RequirementByModels", b =>
|
||||
{
|
||||
b.HasOne("UniversityDatabaseImplement.Models.Models", "Models")
|
||||
.WithMany("Requirements")
|
||||
.HasForeignKey("ModelsId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("UniversityDatabaseImplement.Models.Requirement", "Requirement")
|
||||
.WithMany("Modelss")
|
||||
.HasForeignKey("RequirementId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Models");
|
||||
|
||||
b.Navigation("Requirement");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDatabaseImplement.Models.Client", b =>
|
||||
{
|
||||
b.Navigation("Modelss");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDatabaseImplement.Models.ClientByModels", b =>
|
||||
{
|
||||
b.Navigation("Accounts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDatabaseImplement.Models.Director", b =>
|
||||
{
|
||||
b.Navigation("Clients");
|
||||
|
||||
b.Navigation("Requirements");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDatabaseImplement.Models.Models", b =>
|
||||
{
|
||||
b.Navigation("Clients");
|
||||
|
||||
b.Navigation("Requirements");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDatabaseImplement.Models.Implementer", b =>
|
||||
{
|
||||
b.Navigation("Modelss");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDatabaseImplement.Models.Requirement", b =>
|
||||
{
|
||||
b.Navigation("Modelss");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user