Compare commits

..

No commits in common. "827cdaf9f9b8544493f4e694cf28dce1c9d1289a" and "7a741d7783462b3dedeff3d263485aecde144e67" have entirely different histories.

37 changed files with 6 additions and 4314 deletions

View File

@ -29,23 +29,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Application", "SqlData\Appl
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Persistence", "SqlData\Persistence\Persistence.csproj", "{48C9998C-ECE2-407F-835F-1A7255A5C99E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Migrations", "Migrations", "{79639CD4-7A16-4AB4-BBE8-672B9ACCB3F5}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SqliteMigrations", "SqlData\Migrations\SqliteMigrations\SqliteMigrations.csproj", "{EF5530BD-4BF4-4DD8-80BB-04C6B6623DA7}"
ProjectSection(ProjectDependencies) = postProject
{48C9998C-ECE2-407F-835F-1A7255A5C99E} = {48C9998C-ECE2-407F-835F-1A7255A5C99E}
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MysqlMigrations", "SqlData\Migrations\MysqlMigrations\MysqlMigrations.csproj", "{5861915B-9574-4D5D-872F-D54A09651697}"
ProjectSection(ProjectDependencies) = postProject
{48C9998C-ECE2-407F-835F-1A7255A5C99E} = {48C9998C-ECE2-407F-835F-1A7255A5C99E}
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PsqlMigrations", "SqlData\Migrations\PsqlMigrations\PsqlMigrations.csproj", "{E9E238CD-6DD8-4B29-8C36-C61F1168FCCD}"
ProjectSection(ProjectDependencies) = postProject
{48C9998C-ECE2-407F-835F-1A7255A5C99E} = {48C9998C-ECE2-407F-835F-1A7255A5C99E}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -76,18 +59,6 @@ Global
{48C9998C-ECE2-407F-835F-1A7255A5C99E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{48C9998C-ECE2-407F-835F-1A7255A5C99E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{48C9998C-ECE2-407F-835F-1A7255A5C99E}.Release|Any CPU.Build.0 = Release|Any CPU
{EF5530BD-4BF4-4DD8-80BB-04C6B6623DA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EF5530BD-4BF4-4DD8-80BB-04C6B6623DA7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EF5530BD-4BF4-4DD8-80BB-04C6B6623DA7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EF5530BD-4BF4-4DD8-80BB-04C6B6623DA7}.Release|Any CPU.Build.0 = Release|Any CPU
{5861915B-9574-4D5D-872F-D54A09651697}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5861915B-9574-4D5D-872F-D54A09651697}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5861915B-9574-4D5D-872F-D54A09651697}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5861915B-9574-4D5D-872F-D54A09651697}.Release|Any CPU.Build.0 = Release|Any CPU
{E9E238CD-6DD8-4B29-8C36-C61F1168FCCD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E9E238CD-6DD8-4B29-8C36-C61F1168FCCD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E9E238CD-6DD8-4B29-8C36-C61F1168FCCD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E9E238CD-6DD8-4B29-8C36-C61F1168FCCD}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -96,10 +67,6 @@ Global
{3BFD6180-7CA7-4E85-A379-225B872439A1} = {7E7A63CD-547B-4FB4-A383-EB75298020A1}
{0B1F3656-E5B3-440C-961F-A7D004FBE9A8} = {7E7A63CD-547B-4FB4-A383-EB75298020A1}
{48C9998C-ECE2-407F-835F-1A7255A5C99E} = {7E7A63CD-547B-4FB4-A383-EB75298020A1}
{79639CD4-7A16-4AB4-BBE8-672B9ACCB3F5} = {7E7A63CD-547B-4FB4-A383-EB75298020A1}
{EF5530BD-4BF4-4DD8-80BB-04C6B6623DA7} = {79639CD4-7A16-4AB4-BBE8-672B9ACCB3F5}
{5861915B-9574-4D5D-872F-D54A09651697} = {79639CD4-7A16-4AB4-BBE8-672B9ACCB3F5}
{E9E238CD-6DD8-4B29-8C36-C61F1168FCCD} = {79639CD4-7A16-4AB4-BBE8-672B9ACCB3F5}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E80A1224-87F5-4FEB-82AE-89006BE98B12}

View File

@ -34,9 +34,6 @@
<ProjectReference Include="..\SqlData\Domain\Domain.csproj" />
<ProjectReference Include="..\SqlData\Persistence\Persistence.csproj" />
<ProjectReference Include="..\Security\Security.csproj" />
<ProjectReference Include="..\SqlData\Migrations\PsqlMigrations\PsqlMigrations.csproj" />
<ProjectReference Include="..\SqlData\Migrations\SqliteMigrations\SqliteMigrations.csproj" />
<ProjectReference Include="..\SqlData\Migrations\MysqlMigrations\MysqlMigrations.csproj" />
</ItemGroup>
</Project>

View File

@ -1,442 +0,0 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Mirea.Api.DataAccess.Persistence;
#nullable disable
namespace MysqlMigrations.Migrations
{
[DbContext(typeof(UberDbContext))]
[Migration("20240601023106_InitialMigration")]
partial class InitialMigration
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.6")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Campus", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Address")
.HasMaxLength(512)
.HasColumnType("TEXT");
b.Property<string>("CodeName")
.IsRequired()
.HasMaxLength(16)
.HasColumnType("TEXT");
b.Property<string>("FullName")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("Id")
.IsUnique();
b.ToTable("Campus", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Discipline", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("Id")
.IsUnique();
b.ToTable("Discipline", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Faculty", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<int?>("CampusId")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("CampusId");
b.HasIndex("Id")
.IsUnique();
b.ToTable("Faculty", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Group", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<int?>("FacultyId")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("FacultyId");
b.HasIndex("Id")
.IsUnique();
b.ToTable("Group", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LectureHall", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<int>("CampusId")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("CampusId");
b.HasIndex("Id")
.IsUnique();
b.ToTable("LectureHall", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Lesson", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<int>("DayOfWeek")
.HasColumnType("INTEGER");
b.Property<int>("DisciplineId")
.HasColumnType("INTEGER");
b.Property<int>("GroupId")
.HasColumnType("INTEGER");
b.Property<bool>("IsEven")
.HasColumnType("BIT(1)");
b.Property<bool?>("IsExcludedWeeks")
.HasColumnType("BIT(1)");
b.Property<int>("PairNumber")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("DisciplineId");
b.HasIndex("GroupId");
b.HasIndex("Id")
.IsUnique();
b.ToTable("Lesson", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LessonAssociation", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<int?>("LectureHallId")
.HasColumnType("INTEGER");
b.Property<int>("LessonId")
.HasColumnType("INTEGER");
b.Property<string>("LinkToMeet")
.HasMaxLength(512)
.HasColumnType("TEXT");
b.Property<int?>("ProfessorId")
.HasColumnType("INTEGER");
b.Property<int>("TypeOfOccupationId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("Id")
.IsUnique();
b.HasIndex("LectureHallId");
b.HasIndex("LessonId");
b.HasIndex("ProfessorId");
b.HasIndex("TypeOfOccupationId");
b.ToTable("LessonAssociation", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Professor", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<string>("AltName")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("Id")
.IsUnique();
b.ToTable("Professor", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.SpecificWeek", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<int>("LessonId")
.HasColumnType("INTEGER");
b.Property<int>("WeekNumber")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("Id")
.IsUnique();
b.HasIndex("LessonId");
b.ToTable("SpecificWeek", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.TypeOfOccupation", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ShortName")
.IsRequired()
.HasMaxLength(16)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("Id")
.IsUnique();
b.ToTable("TypeOfOccupation", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Faculty", b =>
{
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Campus", "Campus")
.WithMany("Faculties")
.HasForeignKey("CampusId")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("Campus");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Group", b =>
{
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Faculty", "Faculty")
.WithMany("Groups")
.HasForeignKey("FacultyId")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("Faculty");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LectureHall", b =>
{
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Campus", "Campus")
.WithMany("LectureHalls")
.HasForeignKey("CampusId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Campus");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Lesson", b =>
{
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Discipline", "Discipline")
.WithMany("Lessons")
.HasForeignKey("DisciplineId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Group", "Group")
.WithMany("Lessons")
.HasForeignKey("GroupId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Discipline");
b.Navigation("Group");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LessonAssociation", b =>
{
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.LectureHall", "LectureHall")
.WithMany("LessonAssociations")
.HasForeignKey("LectureHallId")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Lesson", "Lesson")
.WithMany("LessonAssociations")
.HasForeignKey("LessonId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Professor", "Professor")
.WithMany("LessonAssociations")
.HasForeignKey("ProfessorId")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.TypeOfOccupation", "TypeOfOccupation")
.WithMany("Lessons")
.HasForeignKey("TypeOfOccupationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("LectureHall");
b.Navigation("Lesson");
b.Navigation("Professor");
b.Navigation("TypeOfOccupation");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.SpecificWeek", b =>
{
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Lesson", "Lesson")
.WithMany("SpecificWeeks")
.HasForeignKey("LessonId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Lesson");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Campus", b =>
{
b.Navigation("Faculties");
b.Navigation("LectureHalls");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Discipline", b =>
{
b.Navigation("Lessons");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Faculty", b =>
{
b.Navigation("Groups");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Group", b =>
{
b.Navigation("Lessons");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LectureHall", b =>
{
b.Navigation("LessonAssociations");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Lesson", b =>
{
b.Navigation("LessonAssociations");
b.Navigation("SpecificWeeks");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Professor", b =>
{
b.Navigation("LessonAssociations");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.TypeOfOccupation", b =>
{
b.Navigation("Lessons");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -1,389 +0,0 @@
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MysqlMigrations.Migrations
{
/// <inheritdoc />
public partial class InitialMigration : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterDatabase()
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "Campus",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
CodeName = table.Column<string>(type: "TEXT", maxLength: 16, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
FullName = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Address = table.Column<string>(type: "TEXT", maxLength: 512, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_Campus", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "Discipline",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Name = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_Discipline", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "Professor",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Name = table.Column<string>(type: "TEXT", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
AltName = table.Column<string>(type: "TEXT", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_Professor", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "TypeOfOccupation",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
ShortName = table.Column<string>(type: "TEXT", maxLength: 16, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_TypeOfOccupation", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "Faculty",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Name = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
CampusId = table.Column<int>(type: "INTEGER", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Faculty", x => x.Id);
table.ForeignKey(
name: "FK_Faculty_Campus_CampusId",
column: x => x.CampusId,
principalTable: "Campus",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "LectureHall",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Name = table.Column<string>(type: "TEXT", maxLength: 64, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
CampusId = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_LectureHall", x => x.Id);
table.ForeignKey(
name: "FK_LectureHall_Campus_CampusId",
column: x => x.CampusId,
principalTable: "Campus",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "Group",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Name = table.Column<string>(type: "TEXT", maxLength: 64, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
FacultyId = table.Column<int>(type: "INTEGER", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Group", x => x.Id);
table.ForeignKey(
name: "FK_Group_Faculty_FacultyId",
column: x => x.FacultyId,
principalTable: "Faculty",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "Lesson",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
IsEven = table.Column<bool>(type: "BIT(1)", nullable: false),
DayOfWeek = table.Column<int>(type: "INTEGER", nullable: false),
PairNumber = table.Column<int>(type: "INTEGER", nullable: false),
IsExcludedWeeks = table.Column<bool>(type: "BIT(1)", nullable: true),
GroupId = table.Column<int>(type: "INTEGER", nullable: false),
DisciplineId = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Lesson", x => x.Id);
table.ForeignKey(
name: "FK_Lesson_Discipline_DisciplineId",
column: x => x.DisciplineId,
principalTable: "Discipline",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Lesson_Group_GroupId",
column: x => x.GroupId,
principalTable: "Group",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "LessonAssociation",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
LinkToMeet = table.Column<string>(type: "TEXT", maxLength: 512, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
TypeOfOccupationId = table.Column<int>(type: "INTEGER", nullable: false),
LessonId = table.Column<int>(type: "INTEGER", nullable: false),
ProfessorId = table.Column<int>(type: "INTEGER", nullable: true),
LectureHallId = table.Column<int>(type: "INTEGER", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_LessonAssociation", x => x.Id);
table.ForeignKey(
name: "FK_LessonAssociation_LectureHall_LectureHallId",
column: x => x.LectureHallId,
principalTable: "LectureHall",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_LessonAssociation_Lesson_LessonId",
column: x => x.LessonId,
principalTable: "Lesson",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_LessonAssociation_Professor_ProfessorId",
column: x => x.ProfessorId,
principalTable: "Professor",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_LessonAssociation_TypeOfOccupation_TypeOfOccupationId",
column: x => x.TypeOfOccupationId,
principalTable: "TypeOfOccupation",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "SpecificWeek",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
WeekNumber = table.Column<int>(type: "INTEGER", nullable: false),
LessonId = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_SpecificWeek", x => x.Id);
table.ForeignKey(
name: "FK_SpecificWeek_Lesson_LessonId",
column: x => x.LessonId,
principalTable: "Lesson",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_Campus_Id",
table: "Campus",
column: "Id",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Discipline_Id",
table: "Discipline",
column: "Id",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Faculty_CampusId",
table: "Faculty",
column: "CampusId");
migrationBuilder.CreateIndex(
name: "IX_Faculty_Id",
table: "Faculty",
column: "Id",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Group_FacultyId",
table: "Group",
column: "FacultyId");
migrationBuilder.CreateIndex(
name: "IX_Group_Id",
table: "Group",
column: "Id",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_LectureHall_CampusId",
table: "LectureHall",
column: "CampusId");
migrationBuilder.CreateIndex(
name: "IX_LectureHall_Id",
table: "LectureHall",
column: "Id",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Lesson_DisciplineId",
table: "Lesson",
column: "DisciplineId");
migrationBuilder.CreateIndex(
name: "IX_Lesson_GroupId",
table: "Lesson",
column: "GroupId");
migrationBuilder.CreateIndex(
name: "IX_Lesson_Id",
table: "Lesson",
column: "Id",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_LessonAssociation_Id",
table: "LessonAssociation",
column: "Id",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_LessonAssociation_LectureHallId",
table: "LessonAssociation",
column: "LectureHallId");
migrationBuilder.CreateIndex(
name: "IX_LessonAssociation_LessonId",
table: "LessonAssociation",
column: "LessonId");
migrationBuilder.CreateIndex(
name: "IX_LessonAssociation_ProfessorId",
table: "LessonAssociation",
column: "ProfessorId");
migrationBuilder.CreateIndex(
name: "IX_LessonAssociation_TypeOfOccupationId",
table: "LessonAssociation",
column: "TypeOfOccupationId");
migrationBuilder.CreateIndex(
name: "IX_Professor_Id",
table: "Professor",
column: "Id",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_SpecificWeek_Id",
table: "SpecificWeek",
column: "Id",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_SpecificWeek_LessonId",
table: "SpecificWeek",
column: "LessonId");
migrationBuilder.CreateIndex(
name: "IX_TypeOfOccupation_Id",
table: "TypeOfOccupation",
column: "Id",
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "LessonAssociation");
migrationBuilder.DropTable(
name: "SpecificWeek");
migrationBuilder.DropTable(
name: "LectureHall");
migrationBuilder.DropTable(
name: "Professor");
migrationBuilder.DropTable(
name: "TypeOfOccupation");
migrationBuilder.DropTable(
name: "Lesson");
migrationBuilder.DropTable(
name: "Discipline");
migrationBuilder.DropTable(
name: "Group");
migrationBuilder.DropTable(
name: "Faculty");
migrationBuilder.DropTable(
name: "Campus");
}
}
}

View File

@ -1,439 +0,0 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Mirea.Api.DataAccess.Persistence;
#nullable disable
namespace MysqlMigrations.Migrations
{
[DbContext(typeof(UberDbContext))]
partial class UberDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.6")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Campus", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Address")
.HasMaxLength(512)
.HasColumnType("TEXT");
b.Property<string>("CodeName")
.IsRequired()
.HasMaxLength(16)
.HasColumnType("TEXT");
b.Property<string>("FullName")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("Id")
.IsUnique();
b.ToTable("Campus", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Discipline", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("Id")
.IsUnique();
b.ToTable("Discipline", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Faculty", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<int?>("CampusId")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("CampusId");
b.HasIndex("Id")
.IsUnique();
b.ToTable("Faculty", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Group", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<int?>("FacultyId")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("FacultyId");
b.HasIndex("Id")
.IsUnique();
b.ToTable("Group", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LectureHall", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<int>("CampusId")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("CampusId");
b.HasIndex("Id")
.IsUnique();
b.ToTable("LectureHall", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Lesson", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<int>("DayOfWeek")
.HasColumnType("INTEGER");
b.Property<int>("DisciplineId")
.HasColumnType("INTEGER");
b.Property<int>("GroupId")
.HasColumnType("INTEGER");
b.Property<bool>("IsEven")
.HasColumnType("BIT(1)");
b.Property<bool?>("IsExcludedWeeks")
.HasColumnType("BIT(1)");
b.Property<int>("PairNumber")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("DisciplineId");
b.HasIndex("GroupId");
b.HasIndex("Id")
.IsUnique();
b.ToTable("Lesson", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LessonAssociation", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<int?>("LectureHallId")
.HasColumnType("INTEGER");
b.Property<int>("LessonId")
.HasColumnType("INTEGER");
b.Property<string>("LinkToMeet")
.HasMaxLength(512)
.HasColumnType("TEXT");
b.Property<int?>("ProfessorId")
.HasColumnType("INTEGER");
b.Property<int>("TypeOfOccupationId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("Id")
.IsUnique();
b.HasIndex("LectureHallId");
b.HasIndex("LessonId");
b.HasIndex("ProfessorId");
b.HasIndex("TypeOfOccupationId");
b.ToTable("LessonAssociation", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Professor", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<string>("AltName")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("Id")
.IsUnique();
b.ToTable("Professor", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.SpecificWeek", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<int>("LessonId")
.HasColumnType("INTEGER");
b.Property<int>("WeekNumber")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("Id")
.IsUnique();
b.HasIndex("LessonId");
b.ToTable("SpecificWeek", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.TypeOfOccupation", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ShortName")
.IsRequired()
.HasMaxLength(16)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("Id")
.IsUnique();
b.ToTable("TypeOfOccupation", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Faculty", b =>
{
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Campus", "Campus")
.WithMany("Faculties")
.HasForeignKey("CampusId")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("Campus");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Group", b =>
{
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Faculty", "Faculty")
.WithMany("Groups")
.HasForeignKey("FacultyId")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("Faculty");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LectureHall", b =>
{
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Campus", "Campus")
.WithMany("LectureHalls")
.HasForeignKey("CampusId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Campus");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Lesson", b =>
{
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Discipline", "Discipline")
.WithMany("Lessons")
.HasForeignKey("DisciplineId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Group", "Group")
.WithMany("Lessons")
.HasForeignKey("GroupId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Discipline");
b.Navigation("Group");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LessonAssociation", b =>
{
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.LectureHall", "LectureHall")
.WithMany("LessonAssociations")
.HasForeignKey("LectureHallId")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Lesson", "Lesson")
.WithMany("LessonAssociations")
.HasForeignKey("LessonId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Professor", "Professor")
.WithMany("LessonAssociations")
.HasForeignKey("ProfessorId")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.TypeOfOccupation", "TypeOfOccupation")
.WithMany("Lessons")
.HasForeignKey("TypeOfOccupationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("LectureHall");
b.Navigation("Lesson");
b.Navigation("Professor");
b.Navigation("TypeOfOccupation");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.SpecificWeek", b =>
{
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Lesson", "Lesson")
.WithMany("SpecificWeeks")
.HasForeignKey("LessonId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Lesson");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Campus", b =>
{
b.Navigation("Faculties");
b.Navigation("LectureHalls");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Discipline", b =>
{
b.Navigation("Lessons");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Faculty", b =>
{
b.Navigation("Groups");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Group", b =>
{
b.Navigation("Lessons");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LectureHall", b =>
{
b.Navigation("LessonAssociations");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Lesson", b =>
{
b.Navigation("LessonAssociations");
b.Navigation("SpecificWeeks");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Professor", b =>
{
b.Navigation("LessonAssociations");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.TypeOfOccupation", b =>
{
b.Navigation("Lessons");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -1,12 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<BaseOutputPath>..\..\Persistence\bin\</BaseOutputPath>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\Persistence\Persistence.csproj" />
</ItemGroup>
</Project>

View File

@ -1,442 +0,0 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Mirea.Api.DataAccess.Persistence;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace PsqlMigrations.Migrations
{
[DbContext(typeof(UberDbContext))]
[Migration("20240601021702_InitialMigration")]
partial class InitialMigration
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.6")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Campus", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Address")
.HasMaxLength(512)
.HasColumnType("TEXT");
b.Property<string>("CodeName")
.IsRequired()
.HasMaxLength(16)
.HasColumnType("TEXT");
b.Property<string>("FullName")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("Id")
.IsUnique();
b.ToTable("Campus", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Discipline", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("Id")
.IsUnique();
b.ToTable("Discipline", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Faculty", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int?>("CampusId")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("CampusId");
b.HasIndex("Id")
.IsUnique();
b.ToTable("Faculty", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Group", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int?>("FacultyId")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("FacultyId");
b.HasIndex("Id")
.IsUnique();
b.ToTable("Group", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LectureHall", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("CampusId")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("CampusId");
b.HasIndex("Id")
.IsUnique();
b.ToTable("LectureHall", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Lesson", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("DayOfWeek")
.HasColumnType("INTEGER");
b.Property<int>("DisciplineId")
.HasColumnType("INTEGER");
b.Property<int>("GroupId")
.HasColumnType("INTEGER");
b.Property<bool>("IsEven")
.HasColumnType("BOOLEAN");
b.Property<bool?>("IsExcludedWeeks")
.HasColumnType("BOOLEAN");
b.Property<int>("PairNumber")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("DisciplineId");
b.HasIndex("GroupId");
b.HasIndex("Id")
.IsUnique();
b.ToTable("Lesson", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LessonAssociation", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int?>("LectureHallId")
.HasColumnType("INTEGER");
b.Property<int>("LessonId")
.HasColumnType("INTEGER");
b.Property<string>("LinkToMeet")
.HasMaxLength(512)
.HasColumnType("TEXT");
b.Property<int?>("ProfessorId")
.HasColumnType("INTEGER");
b.Property<int>("TypeOfOccupationId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("Id")
.IsUnique();
b.HasIndex("LectureHallId");
b.HasIndex("LessonId");
b.HasIndex("ProfessorId");
b.HasIndex("TypeOfOccupationId");
b.ToTable("LessonAssociation", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Professor", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("AltName")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("Id")
.IsUnique();
b.ToTable("Professor", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.SpecificWeek", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("LessonId")
.HasColumnType("INTEGER");
b.Property<int>("WeekNumber")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("Id")
.IsUnique();
b.HasIndex("LessonId");
b.ToTable("SpecificWeek", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.TypeOfOccupation", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ShortName")
.IsRequired()
.HasMaxLength(16)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("Id")
.IsUnique();
b.ToTable("TypeOfOccupation", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Faculty", b =>
{
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Campus", "Campus")
.WithMany("Faculties")
.HasForeignKey("CampusId")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("Campus");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Group", b =>
{
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Faculty", "Faculty")
.WithMany("Groups")
.HasForeignKey("FacultyId")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("Faculty");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LectureHall", b =>
{
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Campus", "Campus")
.WithMany("LectureHalls")
.HasForeignKey("CampusId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Campus");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Lesson", b =>
{
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Discipline", "Discipline")
.WithMany("Lessons")
.HasForeignKey("DisciplineId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Group", "Group")
.WithMany("Lessons")
.HasForeignKey("GroupId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Discipline");
b.Navigation("Group");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LessonAssociation", b =>
{
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.LectureHall", "LectureHall")
.WithMany("LessonAssociations")
.HasForeignKey("LectureHallId")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Lesson", "Lesson")
.WithMany("LessonAssociations")
.HasForeignKey("LessonId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Professor", "Professor")
.WithMany("LessonAssociations")
.HasForeignKey("ProfessorId")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.TypeOfOccupation", "TypeOfOccupation")
.WithMany("Lessons")
.HasForeignKey("TypeOfOccupationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("LectureHall");
b.Navigation("Lesson");
b.Navigation("Professor");
b.Navigation("TypeOfOccupation");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.SpecificWeek", b =>
{
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Lesson", "Lesson")
.WithMany("SpecificWeeks")
.HasForeignKey("LessonId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Lesson");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Campus", b =>
{
b.Navigation("Faculties");
b.Navigation("LectureHalls");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Discipline", b =>
{
b.Navigation("Lessons");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Faculty", b =>
{
b.Navigation("Groups");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Group", b =>
{
b.Navigation("Lessons");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LectureHall", b =>
{
b.Navigation("LessonAssociations");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Lesson", b =>
{
b.Navigation("LessonAssociations");
b.Navigation("SpecificWeeks");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Professor", b =>
{
b.Navigation("LessonAssociations");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.TypeOfOccupation", b =>
{
b.Navigation("Lessons");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -1,365 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace PsqlMigrations.Migrations
{
/// <inheritdoc />
public partial class InitialMigration : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Campus",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
CodeName = table.Column<string>(type: "TEXT", maxLength: 16, nullable: false),
FullName = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
Address = table.Column<string>(type: "TEXT", maxLength: 512, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Campus", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Discipline",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Discipline", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Professor",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column<string>(type: "TEXT", nullable: false),
AltName = table.Column<string>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Professor", x => x.Id);
});
migrationBuilder.CreateTable(
name: "TypeOfOccupation",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ShortName = table.Column<string>(type: "TEXT", maxLength: 16, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_TypeOfOccupation", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Faculty",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false),
CampusId = table.Column<int>(type: "INTEGER", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Faculty", x => x.Id);
table.ForeignKey(
name: "FK_Faculty_Campus_CampusId",
column: x => x.CampusId,
principalTable: "Campus",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
});
migrationBuilder.CreateTable(
name: "LectureHall",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column<string>(type: "TEXT", maxLength: 64, nullable: false),
CampusId = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_LectureHall", x => x.Id);
table.ForeignKey(
name: "FK_LectureHall_Campus_CampusId",
column: x => x.CampusId,
principalTable: "Campus",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "Group",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column<string>(type: "TEXT", maxLength: 64, nullable: false),
FacultyId = table.Column<int>(type: "INTEGER", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Group", x => x.Id);
table.ForeignKey(
name: "FK_Group_Faculty_FacultyId",
column: x => x.FacultyId,
principalTable: "Faculty",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
});
migrationBuilder.CreateTable(
name: "Lesson",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
IsEven = table.Column<bool>(type: "BOOLEAN", nullable: false),
DayOfWeek = table.Column<int>(type: "INTEGER", nullable: false),
PairNumber = table.Column<int>(type: "INTEGER", nullable: false),
IsExcludedWeeks = table.Column<bool>(type: "BOOLEAN", nullable: true),
GroupId = table.Column<int>(type: "INTEGER", nullable: false),
DisciplineId = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Lesson", x => x.Id);
table.ForeignKey(
name: "FK_Lesson_Discipline_DisciplineId",
column: x => x.DisciplineId,
principalTable: "Discipline",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Lesson_Group_GroupId",
column: x => x.GroupId,
principalTable: "Group",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "LessonAssociation",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
LinkToMeet = table.Column<string>(type: "TEXT", maxLength: 512, nullable: true),
TypeOfOccupationId = table.Column<int>(type: "INTEGER", nullable: false),
LessonId = table.Column<int>(type: "INTEGER", nullable: false),
ProfessorId = table.Column<int>(type: "INTEGER", nullable: true),
LectureHallId = table.Column<int>(type: "INTEGER", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_LessonAssociation", x => x.Id);
table.ForeignKey(
name: "FK_LessonAssociation_LectureHall_LectureHallId",
column: x => x.LectureHallId,
principalTable: "LectureHall",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_LessonAssociation_Lesson_LessonId",
column: x => x.LessonId,
principalTable: "Lesson",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_LessonAssociation_Professor_ProfessorId",
column: x => x.ProfessorId,
principalTable: "Professor",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_LessonAssociation_TypeOfOccupation_TypeOfOccupationId",
column: x => x.TypeOfOccupationId,
principalTable: "TypeOfOccupation",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "SpecificWeek",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
WeekNumber = table.Column<int>(type: "INTEGER", nullable: false),
LessonId = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_SpecificWeek", x => x.Id);
table.ForeignKey(
name: "FK_SpecificWeek_Lesson_LessonId",
column: x => x.LessonId,
principalTable: "Lesson",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Campus_Id",
table: "Campus",
column: "Id",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Discipline_Id",
table: "Discipline",
column: "Id",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Faculty_CampusId",
table: "Faculty",
column: "CampusId");
migrationBuilder.CreateIndex(
name: "IX_Faculty_Id",
table: "Faculty",
column: "Id",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Group_FacultyId",
table: "Group",
column: "FacultyId");
migrationBuilder.CreateIndex(
name: "IX_Group_Id",
table: "Group",
column: "Id",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_LectureHall_CampusId",
table: "LectureHall",
column: "CampusId");
migrationBuilder.CreateIndex(
name: "IX_LectureHall_Id",
table: "LectureHall",
column: "Id",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Lesson_DisciplineId",
table: "Lesson",
column: "DisciplineId");
migrationBuilder.CreateIndex(
name: "IX_Lesson_GroupId",
table: "Lesson",
column: "GroupId");
migrationBuilder.CreateIndex(
name: "IX_Lesson_Id",
table: "Lesson",
column: "Id",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_LessonAssociation_Id",
table: "LessonAssociation",
column: "Id",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_LessonAssociation_LectureHallId",
table: "LessonAssociation",
column: "LectureHallId");
migrationBuilder.CreateIndex(
name: "IX_LessonAssociation_LessonId",
table: "LessonAssociation",
column: "LessonId");
migrationBuilder.CreateIndex(
name: "IX_LessonAssociation_ProfessorId",
table: "LessonAssociation",
column: "ProfessorId");
migrationBuilder.CreateIndex(
name: "IX_LessonAssociation_TypeOfOccupationId",
table: "LessonAssociation",
column: "TypeOfOccupationId");
migrationBuilder.CreateIndex(
name: "IX_Professor_Id",
table: "Professor",
column: "Id",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_SpecificWeek_Id",
table: "SpecificWeek",
column: "Id",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_SpecificWeek_LessonId",
table: "SpecificWeek",
column: "LessonId");
migrationBuilder.CreateIndex(
name: "IX_TypeOfOccupation_Id",
table: "TypeOfOccupation",
column: "Id",
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "LessonAssociation");
migrationBuilder.DropTable(
name: "SpecificWeek");
migrationBuilder.DropTable(
name: "LectureHall");
migrationBuilder.DropTable(
name: "Professor");
migrationBuilder.DropTable(
name: "TypeOfOccupation");
migrationBuilder.DropTable(
name: "Lesson");
migrationBuilder.DropTable(
name: "Discipline");
migrationBuilder.DropTable(
name: "Group");
migrationBuilder.DropTable(
name: "Faculty");
migrationBuilder.DropTable(
name: "Campus");
}
}
}

View File

@ -1,439 +0,0 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Mirea.Api.DataAccess.Persistence;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace PsqlMigrations.Migrations
{
[DbContext(typeof(UberDbContext))]
partial class UberDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.6")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Campus", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Address")
.HasMaxLength(512)
.HasColumnType("TEXT");
b.Property<string>("CodeName")
.IsRequired()
.HasMaxLength(16)
.HasColumnType("TEXT");
b.Property<string>("FullName")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("Id")
.IsUnique();
b.ToTable("Campus", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Discipline", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("Id")
.IsUnique();
b.ToTable("Discipline", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Faculty", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int?>("CampusId")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("CampusId");
b.HasIndex("Id")
.IsUnique();
b.ToTable("Faculty", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Group", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int?>("FacultyId")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("FacultyId");
b.HasIndex("Id")
.IsUnique();
b.ToTable("Group", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LectureHall", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("CampusId")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("CampusId");
b.HasIndex("Id")
.IsUnique();
b.ToTable("LectureHall", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Lesson", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("DayOfWeek")
.HasColumnType("INTEGER");
b.Property<int>("DisciplineId")
.HasColumnType("INTEGER");
b.Property<int>("GroupId")
.HasColumnType("INTEGER");
b.Property<bool>("IsEven")
.HasColumnType("BOOLEAN");
b.Property<bool?>("IsExcludedWeeks")
.HasColumnType("BOOLEAN");
b.Property<int>("PairNumber")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("DisciplineId");
b.HasIndex("GroupId");
b.HasIndex("Id")
.IsUnique();
b.ToTable("Lesson", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LessonAssociation", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int?>("LectureHallId")
.HasColumnType("INTEGER");
b.Property<int>("LessonId")
.HasColumnType("INTEGER");
b.Property<string>("LinkToMeet")
.HasMaxLength(512)
.HasColumnType("TEXT");
b.Property<int?>("ProfessorId")
.HasColumnType("INTEGER");
b.Property<int>("TypeOfOccupationId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("Id")
.IsUnique();
b.HasIndex("LectureHallId");
b.HasIndex("LessonId");
b.HasIndex("ProfessorId");
b.HasIndex("TypeOfOccupationId");
b.ToTable("LessonAssociation", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Professor", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("AltName")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("Id")
.IsUnique();
b.ToTable("Professor", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.SpecificWeek", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("LessonId")
.HasColumnType("INTEGER");
b.Property<int>("WeekNumber")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("Id")
.IsUnique();
b.HasIndex("LessonId");
b.ToTable("SpecificWeek", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.TypeOfOccupation", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ShortName")
.IsRequired()
.HasMaxLength(16)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("Id")
.IsUnique();
b.ToTable("TypeOfOccupation", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Faculty", b =>
{
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Campus", "Campus")
.WithMany("Faculties")
.HasForeignKey("CampusId")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("Campus");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Group", b =>
{
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Faculty", "Faculty")
.WithMany("Groups")
.HasForeignKey("FacultyId")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("Faculty");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LectureHall", b =>
{
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Campus", "Campus")
.WithMany("LectureHalls")
.HasForeignKey("CampusId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Campus");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Lesson", b =>
{
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Discipline", "Discipline")
.WithMany("Lessons")
.HasForeignKey("DisciplineId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Group", "Group")
.WithMany("Lessons")
.HasForeignKey("GroupId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Discipline");
b.Navigation("Group");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LessonAssociation", b =>
{
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.LectureHall", "LectureHall")
.WithMany("LessonAssociations")
.HasForeignKey("LectureHallId")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Lesson", "Lesson")
.WithMany("LessonAssociations")
.HasForeignKey("LessonId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Professor", "Professor")
.WithMany("LessonAssociations")
.HasForeignKey("ProfessorId")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.TypeOfOccupation", "TypeOfOccupation")
.WithMany("Lessons")
.HasForeignKey("TypeOfOccupationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("LectureHall");
b.Navigation("Lesson");
b.Navigation("Professor");
b.Navigation("TypeOfOccupation");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.SpecificWeek", b =>
{
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Lesson", "Lesson")
.WithMany("SpecificWeeks")
.HasForeignKey("LessonId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Lesson");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Campus", b =>
{
b.Navigation("Faculties");
b.Navigation("LectureHalls");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Discipline", b =>
{
b.Navigation("Lessons");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Faculty", b =>
{
b.Navigation("Groups");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Group", b =>
{
b.Navigation("Lessons");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LectureHall", b =>
{
b.Navigation("LessonAssociations");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Lesson", b =>
{
b.Navigation("LessonAssociations");
b.Navigation("SpecificWeeks");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Professor", b =>
{
b.Navigation("LessonAssociations");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.TypeOfOccupation", b =>
{
b.Navigation("Lessons");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -1,12 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<BaseOutputPath>..\..\Persistence\bin\</BaseOutputPath>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\Persistence\Persistence.csproj" />
</ItemGroup>
</Project>

View File

@ -1,417 +0,0 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Mirea.Api.DataAccess.Persistence;
#nullable disable
namespace SqliteMigrations.Migrations
{
[DbContext(typeof(UberDbContext))]
[Migration("20240601015714_InitialMigration")]
partial class InitialMigration
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "8.0.6");
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Campus", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Address")
.HasMaxLength(512)
.HasColumnType("TEXT");
b.Property<string>("CodeName")
.IsRequired()
.HasMaxLength(16)
.HasColumnType("TEXT");
b.Property<string>("FullName")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("Id")
.IsUnique();
b.ToTable("Campus", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Discipline", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("Id")
.IsUnique();
b.ToTable("Discipline", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Faculty", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int?>("CampusId")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("CampusId");
b.HasIndex("Id")
.IsUnique();
b.ToTable("Faculty", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Group", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int?>("FacultyId")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("FacultyId");
b.HasIndex("Id")
.IsUnique();
b.ToTable("Group", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LectureHall", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("CampusId")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("CampusId");
b.HasIndex("Id")
.IsUnique();
b.ToTable("LectureHall", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Lesson", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("DayOfWeek")
.HasColumnType("INTEGER");
b.Property<int>("DisciplineId")
.HasColumnType("INTEGER");
b.Property<int>("GroupId")
.HasColumnType("INTEGER");
b.Property<bool>("IsEven")
.HasColumnType("BOOLEAN");
b.Property<bool?>("IsExcludedWeeks")
.HasColumnType("BOOLEAN");
b.Property<int>("PairNumber")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("DisciplineId");
b.HasIndex("GroupId");
b.HasIndex("Id")
.IsUnique();
b.ToTable("Lesson", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LessonAssociation", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int?>("LectureHallId")
.HasColumnType("INTEGER");
b.Property<int>("LessonId")
.HasColumnType("INTEGER");
b.Property<string>("LinkToMeet")
.HasMaxLength(512)
.HasColumnType("TEXT");
b.Property<int?>("ProfessorId")
.HasColumnType("INTEGER");
b.Property<int>("TypeOfOccupationId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("Id")
.IsUnique();
b.HasIndex("LectureHallId");
b.HasIndex("LessonId");
b.HasIndex("ProfessorId");
b.HasIndex("TypeOfOccupationId");
b.ToTable("LessonAssociation", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Professor", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("AltName")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("Id")
.IsUnique();
b.ToTable("Professor", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.SpecificWeek", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("LessonId")
.HasColumnType("INTEGER");
b.Property<int>("WeekNumber")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("Id")
.IsUnique();
b.HasIndex("LessonId");
b.ToTable("SpecificWeek", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.TypeOfOccupation", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ShortName")
.IsRequired()
.HasMaxLength(16)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("Id")
.IsUnique();
b.ToTable("TypeOfOccupation", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Faculty", b =>
{
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Campus", "Campus")
.WithMany("Faculties")
.HasForeignKey("CampusId")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("Campus");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Group", b =>
{
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Faculty", "Faculty")
.WithMany("Groups")
.HasForeignKey("FacultyId")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("Faculty");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LectureHall", b =>
{
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Campus", "Campus")
.WithMany("LectureHalls")
.HasForeignKey("CampusId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Campus");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Lesson", b =>
{
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Discipline", "Discipline")
.WithMany("Lessons")
.HasForeignKey("DisciplineId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Group", "Group")
.WithMany("Lessons")
.HasForeignKey("GroupId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Discipline");
b.Navigation("Group");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LessonAssociation", b =>
{
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.LectureHall", "LectureHall")
.WithMany("LessonAssociations")
.HasForeignKey("LectureHallId")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Lesson", "Lesson")
.WithMany("LessonAssociations")
.HasForeignKey("LessonId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Professor", "Professor")
.WithMany("LessonAssociations")
.HasForeignKey("ProfessorId")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.TypeOfOccupation", "TypeOfOccupation")
.WithMany("Lessons")
.HasForeignKey("TypeOfOccupationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("LectureHall");
b.Navigation("Lesson");
b.Navigation("Professor");
b.Navigation("TypeOfOccupation");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.SpecificWeek", b =>
{
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Lesson", "Lesson")
.WithMany("SpecificWeeks")
.HasForeignKey("LessonId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Lesson");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Campus", b =>
{
b.Navigation("Faculties");
b.Navigation("LectureHalls");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Discipline", b =>
{
b.Navigation("Lessons");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Faculty", b =>
{
b.Navigation("Groups");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Group", b =>
{
b.Navigation("Lessons");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LectureHall", b =>
{
b.Navigation("LessonAssociations");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Lesson", b =>
{
b.Navigation("LessonAssociations");
b.Navigation("SpecificWeeks");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Professor", b =>
{
b.Navigation("LessonAssociations");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.TypeOfOccupation", b =>
{
b.Navigation("Lessons");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -1,364 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace SqliteMigrations.Migrations
{
/// <inheritdoc />
public partial class InitialMigration : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Campus",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
CodeName = table.Column<string>(type: "TEXT", maxLength: 16, nullable: false),
FullName = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
Address = table.Column<string>(type: "TEXT", maxLength: 512, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Campus", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Discipline",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Name = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Discipline", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Professor",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Name = table.Column<string>(type: "TEXT", nullable: false),
AltName = table.Column<string>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Professor", x => x.Id);
});
migrationBuilder.CreateTable(
name: "TypeOfOccupation",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
ShortName = table.Column<string>(type: "TEXT", maxLength: 16, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_TypeOfOccupation", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Faculty",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Name = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false),
CampusId = table.Column<int>(type: "INTEGER", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Faculty", x => x.Id);
table.ForeignKey(
name: "FK_Faculty_Campus_CampusId",
column: x => x.CampusId,
principalTable: "Campus",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
});
migrationBuilder.CreateTable(
name: "LectureHall",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Name = table.Column<string>(type: "TEXT", maxLength: 64, nullable: false),
CampusId = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_LectureHall", x => x.Id);
table.ForeignKey(
name: "FK_LectureHall_Campus_CampusId",
column: x => x.CampusId,
principalTable: "Campus",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "Group",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Name = table.Column<string>(type: "TEXT", maxLength: 64, nullable: false),
FacultyId = table.Column<int>(type: "INTEGER", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Group", x => x.Id);
table.ForeignKey(
name: "FK_Group_Faculty_FacultyId",
column: x => x.FacultyId,
principalTable: "Faculty",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
});
migrationBuilder.CreateTable(
name: "Lesson",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
IsEven = table.Column<bool>(type: "BOOLEAN", nullable: false),
DayOfWeek = table.Column<int>(type: "INTEGER", nullable: false),
PairNumber = table.Column<int>(type: "INTEGER", nullable: false),
IsExcludedWeeks = table.Column<bool>(type: "BOOLEAN", nullable: true),
GroupId = table.Column<int>(type: "INTEGER", nullable: false),
DisciplineId = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Lesson", x => x.Id);
table.ForeignKey(
name: "FK_Lesson_Discipline_DisciplineId",
column: x => x.DisciplineId,
principalTable: "Discipline",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Lesson_Group_GroupId",
column: x => x.GroupId,
principalTable: "Group",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "LessonAssociation",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
LinkToMeet = table.Column<string>(type: "TEXT", maxLength: 512, nullable: true),
TypeOfOccupationId = table.Column<int>(type: "INTEGER", nullable: false),
LessonId = table.Column<int>(type: "INTEGER", nullable: false),
ProfessorId = table.Column<int>(type: "INTEGER", nullable: true),
LectureHallId = table.Column<int>(type: "INTEGER", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_LessonAssociation", x => x.Id);
table.ForeignKey(
name: "FK_LessonAssociation_LectureHall_LectureHallId",
column: x => x.LectureHallId,
principalTable: "LectureHall",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_LessonAssociation_Lesson_LessonId",
column: x => x.LessonId,
principalTable: "Lesson",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_LessonAssociation_Professor_ProfessorId",
column: x => x.ProfessorId,
principalTable: "Professor",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_LessonAssociation_TypeOfOccupation_TypeOfOccupationId",
column: x => x.TypeOfOccupationId,
principalTable: "TypeOfOccupation",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "SpecificWeek",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
WeekNumber = table.Column<int>(type: "INTEGER", nullable: false),
LessonId = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_SpecificWeek", x => x.Id);
table.ForeignKey(
name: "FK_SpecificWeek_Lesson_LessonId",
column: x => x.LessonId,
principalTable: "Lesson",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Campus_Id",
table: "Campus",
column: "Id",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Discipline_Id",
table: "Discipline",
column: "Id",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Faculty_CampusId",
table: "Faculty",
column: "CampusId");
migrationBuilder.CreateIndex(
name: "IX_Faculty_Id",
table: "Faculty",
column: "Id",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Group_FacultyId",
table: "Group",
column: "FacultyId");
migrationBuilder.CreateIndex(
name: "IX_Group_Id",
table: "Group",
column: "Id",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_LectureHall_CampusId",
table: "LectureHall",
column: "CampusId");
migrationBuilder.CreateIndex(
name: "IX_LectureHall_Id",
table: "LectureHall",
column: "Id",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Lesson_DisciplineId",
table: "Lesson",
column: "DisciplineId");
migrationBuilder.CreateIndex(
name: "IX_Lesson_GroupId",
table: "Lesson",
column: "GroupId");
migrationBuilder.CreateIndex(
name: "IX_Lesson_Id",
table: "Lesson",
column: "Id",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_LessonAssociation_Id",
table: "LessonAssociation",
column: "Id",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_LessonAssociation_LectureHallId",
table: "LessonAssociation",
column: "LectureHallId");
migrationBuilder.CreateIndex(
name: "IX_LessonAssociation_LessonId",
table: "LessonAssociation",
column: "LessonId");
migrationBuilder.CreateIndex(
name: "IX_LessonAssociation_ProfessorId",
table: "LessonAssociation",
column: "ProfessorId");
migrationBuilder.CreateIndex(
name: "IX_LessonAssociation_TypeOfOccupationId",
table: "LessonAssociation",
column: "TypeOfOccupationId");
migrationBuilder.CreateIndex(
name: "IX_Professor_Id",
table: "Professor",
column: "Id",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_SpecificWeek_Id",
table: "SpecificWeek",
column: "Id",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_SpecificWeek_LessonId",
table: "SpecificWeek",
column: "LessonId");
migrationBuilder.CreateIndex(
name: "IX_TypeOfOccupation_Id",
table: "TypeOfOccupation",
column: "Id",
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "LessonAssociation");
migrationBuilder.DropTable(
name: "SpecificWeek");
migrationBuilder.DropTable(
name: "LectureHall");
migrationBuilder.DropTable(
name: "Professor");
migrationBuilder.DropTable(
name: "TypeOfOccupation");
migrationBuilder.DropTable(
name: "Lesson");
migrationBuilder.DropTable(
name: "Discipline");
migrationBuilder.DropTable(
name: "Group");
migrationBuilder.DropTable(
name: "Faculty");
migrationBuilder.DropTable(
name: "Campus");
}
}
}

View File

@ -1,414 +0,0 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Mirea.Api.DataAccess.Persistence;
#nullable disable
namespace SqliteMigrations.Migrations
{
[DbContext(typeof(UberDbContext))]
partial class UberDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "8.0.6");
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Campus", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Address")
.HasMaxLength(512)
.HasColumnType("TEXT");
b.Property<string>("CodeName")
.IsRequired()
.HasMaxLength(16)
.HasColumnType("TEXT");
b.Property<string>("FullName")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("Id")
.IsUnique();
b.ToTable("Campus", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Discipline", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("Id")
.IsUnique();
b.ToTable("Discipline", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Faculty", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int?>("CampusId")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("CampusId");
b.HasIndex("Id")
.IsUnique();
b.ToTable("Faculty", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Group", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int?>("FacultyId")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("FacultyId");
b.HasIndex("Id")
.IsUnique();
b.ToTable("Group", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LectureHall", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("CampusId")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("CampusId");
b.HasIndex("Id")
.IsUnique();
b.ToTable("LectureHall", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Lesson", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("DayOfWeek")
.HasColumnType("INTEGER");
b.Property<int>("DisciplineId")
.HasColumnType("INTEGER");
b.Property<int>("GroupId")
.HasColumnType("INTEGER");
b.Property<bool>("IsEven")
.HasColumnType("BOOLEAN");
b.Property<bool?>("IsExcludedWeeks")
.HasColumnType("BOOLEAN");
b.Property<int>("PairNumber")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("DisciplineId");
b.HasIndex("GroupId");
b.HasIndex("Id")
.IsUnique();
b.ToTable("Lesson", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LessonAssociation", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int?>("LectureHallId")
.HasColumnType("INTEGER");
b.Property<int>("LessonId")
.HasColumnType("INTEGER");
b.Property<string>("LinkToMeet")
.HasMaxLength(512)
.HasColumnType("TEXT");
b.Property<int?>("ProfessorId")
.HasColumnType("INTEGER");
b.Property<int>("TypeOfOccupationId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("Id")
.IsUnique();
b.HasIndex("LectureHallId");
b.HasIndex("LessonId");
b.HasIndex("ProfessorId");
b.HasIndex("TypeOfOccupationId");
b.ToTable("LessonAssociation", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Professor", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("AltName")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("Id")
.IsUnique();
b.ToTable("Professor", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.SpecificWeek", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("LessonId")
.HasColumnType("INTEGER");
b.Property<int>("WeekNumber")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("Id")
.IsUnique();
b.HasIndex("LessonId");
b.ToTable("SpecificWeek", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.TypeOfOccupation", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ShortName")
.IsRequired()
.HasMaxLength(16)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("Id")
.IsUnique();
b.ToTable("TypeOfOccupation", (string)null);
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Faculty", b =>
{
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Campus", "Campus")
.WithMany("Faculties")
.HasForeignKey("CampusId")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("Campus");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Group", b =>
{
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Faculty", "Faculty")
.WithMany("Groups")
.HasForeignKey("FacultyId")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("Faculty");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LectureHall", b =>
{
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Campus", "Campus")
.WithMany("LectureHalls")
.HasForeignKey("CampusId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Campus");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Lesson", b =>
{
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Discipline", "Discipline")
.WithMany("Lessons")
.HasForeignKey("DisciplineId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Group", "Group")
.WithMany("Lessons")
.HasForeignKey("GroupId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Discipline");
b.Navigation("Group");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LessonAssociation", b =>
{
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.LectureHall", "LectureHall")
.WithMany("LessonAssociations")
.HasForeignKey("LectureHallId")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Lesson", "Lesson")
.WithMany("LessonAssociations")
.HasForeignKey("LessonId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Professor", "Professor")
.WithMany("LessonAssociations")
.HasForeignKey("ProfessorId")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.TypeOfOccupation", "TypeOfOccupation")
.WithMany("Lessons")
.HasForeignKey("TypeOfOccupationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("LectureHall");
b.Navigation("Lesson");
b.Navigation("Professor");
b.Navigation("TypeOfOccupation");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.SpecificWeek", b =>
{
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Lesson", "Lesson")
.WithMany("SpecificWeeks")
.HasForeignKey("LessonId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Lesson");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Campus", b =>
{
b.Navigation("Faculties");
b.Navigation("LectureHalls");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Discipline", b =>
{
b.Navigation("Lessons");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Faculty", b =>
{
b.Navigation("Groups");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Group", b =>
{
b.Navigation("Lessons");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LectureHall", b =>
{
b.Navigation("LessonAssociations");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Lesson", b =>
{
b.Navigation("LessonAssociations");
b.Navigation("SpecificWeeks");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Professor", b =>
{
b.Navigation("LessonAssociations");
});
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.TypeOfOccupation", b =>
{
b.Navigation("Lessons");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -1,12 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<BaseOutputPath>..\..\Persistence\bin\</BaseOutputPath>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\Persistence\Persistence.csproj" />
</ItemGroup>
</Project>

View File

@ -6,6 +6,6 @@ public static class DbInitializer
{
public static void Initialize(DbContext dbContext)
{
dbContext.Database.Migrate();
dbContext.Database.EnsureCreated();
}
}

View File

@ -76,12 +76,9 @@ public static class DependencyInjection
{
return dbProvider switch
{
DatabaseProvider.Mysql => options.UseMySql(connection, ServerVersion.AutoDetect(connection),
x => x.MigrationsAssembly("MysqlMigrations")),
DatabaseProvider.Sqlite => options.UseSqlite(connection,
x => x.MigrationsAssembly("SqliteMigrations")),
DatabaseProvider.Postgresql => options.UseNpgsql(connection,
x => x.MigrationsAssembly("PsqlMigrations")),
DatabaseProvider.Sqlite => options.UseSqlite(connection),
DatabaseProvider.Mysql => options.UseMySql(connection, ServerVersion.AutoDetect(connection)),
DatabaseProvider.Postgresql => options.UseNpgsql(connection),
_ => throw new ArgumentException("Unsupported database provider", Enum.GetName(dbProvider))
};
}

View File

@ -1,20 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Mirea.Api.DataAccess.Domain.Schedule;
namespace Mirea.Api.DataAccess.Persistence.EntityTypeConfigurations.Mysql.Schedule;
public sealed class CampusConfiguration : IEntityTypeConfiguration<Campus>
{
public void Configure(EntityTypeBuilder<Campus> builder)
{
builder.ToTable(nameof(Campus));
builder.HasKey(c => c.Id);
builder.HasIndex(c => c.Id).IsUnique();
builder.Property(c => c.Id).HasColumnType("INT").IsRequired().ValueGeneratedOnAdd();
builder.Property(c => c.Address).HasColumnType("VARCHAR(512)").HasMaxLength(512);
builder.Property(c => c.CodeName).HasColumnType("VARCHAR(16)").IsRequired().HasMaxLength(16);
builder.Property(c => c.FullName).HasColumnType("VARCHAR(256)").HasMaxLength(256);
}
}

View File

@ -1,18 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Mirea.Api.DataAccess.Domain.Schedule;
namespace Mirea.Api.DataAccess.Persistence.EntityTypeConfigurations.Mysql.Schedule;
public class DisciplineConfiguration : IEntityTypeConfiguration<Discipline>
{
public void Configure(EntityTypeBuilder<Discipline> builder)
{
builder.ToTable(nameof(Discipline));
builder.HasKey(d => d.Id);
builder.HasIndex(d => d.Id).IsUnique();
builder.Property(d => d.Id).HasColumnType("INT").IsRequired().ValueGeneratedOnAdd();
builder.Property(d => d.Name).HasColumnType("VARCHAR(256)").HasMaxLength(256).IsRequired();
}
}

View File

@ -1,26 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Mirea.Api.DataAccess.Domain.Schedule;
namespace Mirea.Api.DataAccess.Persistence.EntityTypeConfigurations.Mysql.Schedule;
public class FacultyConfiguration : IEntityTypeConfiguration<Faculty>
{
public void Configure(EntityTypeBuilder<Faculty> builder)
{
builder.ToTable(nameof(Faculty));
builder.HasKey(f => f.Id);
builder.HasIndex(f => f.Id).IsUnique();
builder.Property(f => f.Id).HasColumnType("INT").IsRequired().ValueGeneratedOnAdd();
builder.Property(f => f.Name).HasColumnType("VARCHAR(256)").IsRequired().HasMaxLength(256);
builder.Property(f => f.CampusId).HasColumnType("INT");
builder
.HasOne(f => f.Campus)
.WithMany(c => c.Faculties)
.HasForeignKey(c => c.CampusId)
.OnDelete(DeleteBehavior.SetNull);
}
}

View File

@ -1,25 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Mirea.Api.DataAccess.Domain.Schedule;
namespace Mirea.Api.DataAccess.Persistence.EntityTypeConfigurations.Mysql.Schedule;
public class GroupConfiguration : IEntityTypeConfiguration<Group>
{
public void Configure(EntityTypeBuilder<Group> builder)
{
builder.ToTable(nameof(Group));
builder.HasKey(g => g.Id);
builder.HasIndex(g => g.Id).IsUnique();
builder.Property(g => g.Id).HasColumnType("INT").IsRequired().ValueGeneratedOnAdd();
builder.Property(g => g.FacultyId).HasColumnType("INT");
builder.Property(g => g.Name).HasColumnType("VARCHAR(64)").IsRequired().HasMaxLength(64);
builder
.HasOne(g => g.Faculty)
.WithMany(u => u.Groups)
.HasForeignKey(d => d.FacultyId)
.OnDelete(DeleteBehavior.SetNull);
}
}

View File

@ -1,25 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Mirea.Api.DataAccess.Domain.Schedule;
namespace Mirea.Api.DataAccess.Persistence.EntityTypeConfigurations.Mysql.Schedule;
public class LectureHallConfiguration : IEntityTypeConfiguration<LectureHall>
{
public void Configure(EntityTypeBuilder<LectureHall> builder)
{
builder.ToTable(nameof(LectureHall));
builder.HasKey(l => l.Id);
builder.HasIndex(l => l.Id).IsUnique();
builder.Property(l => l.Id).HasColumnType("INT").IsRequired().ValueGeneratedOnAdd();
builder.Property(l => l.CampusId).HasColumnType("INT").IsRequired();
builder.Property(l => l.Name).HasColumnType("VARCHAR(64)").IsRequired().HasMaxLength(64);
builder
.HasOne(l => l.Campus)
.WithMany(c => c.LectureHalls)
.HasForeignKey(d => d.CampusId)
.OnDelete(DeleteBehavior.Restrict);
}
}

View File

@ -1,48 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Mirea.Api.DataAccess.Domain.Schedule;
namespace Mirea.Api.DataAccess.Persistence.EntityTypeConfigurations.Mysql.Schedule;
public class LessonAssociationConfiguration : IEntityTypeConfiguration<LessonAssociation>
{
public void Configure(EntityTypeBuilder<LessonAssociation> builder)
{
builder.ToTable(nameof(LessonAssociation));
builder.HasKey(l => l.Id);
builder.HasIndex(l => l.Id).IsUnique();
builder.Property(l => l.Id).HasColumnType("INT").IsRequired().ValueGeneratedOnAdd();
builder.Property(l => l.LinkToMeet).HasColumnType("VARCHAR(512)").HasMaxLength(512);
builder.Property(l => l.LessonId).HasColumnType("INT").IsRequired();
builder.Property(l => l.ProfessorId).HasColumnType("INT");
builder.Property(l => l.LectureHallId).HasColumnType("INT");
builder.Property(l => l.TypeOfOccupationId).HasColumnType("INT").IsRequired();
builder
.HasOne(l => l.Lesson)
.WithMany(d => d.LessonAssociations)
.HasForeignKey(l => l.LessonId)
.OnDelete(DeleteBehavior.Cascade);
builder
.HasOne(l => l.Professor)
.WithMany(p => p.LessonAssociations)
.HasForeignKey(l => l.ProfessorId)
.OnDelete(DeleteBehavior.SetNull);
builder
.HasOne(l => l.LectureHall)
.WithMany(l => l.LessonAssociations)
.HasForeignKey(l => l.LectureHallId)
.OnDelete(DeleteBehavior.SetNull);
builder
.HasOne(l => l.TypeOfOccupation)
.WithMany(t => t.Lessons)
.HasForeignKey(d => d.TypeOfOccupationId)
.OnDelete(DeleteBehavior.Cascade);
}
}

View File

@ -1,36 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Mirea.Api.DataAccess.Domain.Schedule;
namespace Mirea.Api.DataAccess.Persistence.EntityTypeConfigurations.Mysql.Schedule;
public class LessonConfiguration : IEntityTypeConfiguration<Lesson>
{
public void Configure(EntityTypeBuilder<Lesson> builder)
{
builder.ToTable(nameof(Lesson));
builder.HasKey(l => l.Id);
builder.HasIndex(l => l.Id).IsUnique();
builder.Property(l => l.Id).HasColumnType("INT").IsRequired().ValueGeneratedOnAdd();
builder.Property(l => l.IsEven).HasColumnType("BIT(1)").IsRequired();
builder.Property(l => l.DayOfWeek).HasColumnType("INT").IsRequired();
builder.Property(l => l.PairNumber).HasColumnType("INT").IsRequired();
builder.Property(l => l.IsExcludedWeeks).HasColumnType("BIT(1)");
builder.Property(l => l.GroupId).HasColumnType("INT").IsRequired();
builder.Property(l => l.DisciplineId).HasColumnType("INT").IsRequired();
builder
.HasOne(l => l.Group)
.WithMany(g => g.Lessons)
.HasForeignKey(d => d.GroupId)
.OnDelete(DeleteBehavior.Cascade);
builder
.HasOne(l => l.Discipline)
.WithMany(d => d.Lessons)
.HasForeignKey(l => l.DisciplineId)
.OnDelete(DeleteBehavior.Cascade);
}
}

View File

@ -1,19 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Mirea.Api.DataAccess.Domain.Schedule;
namespace Mirea.Api.DataAccess.Persistence.EntityTypeConfigurations.Mysql.Schedule;
public class ProfessorConfiguration : IEntityTypeConfiguration<Professor>
{
public void Configure(EntityTypeBuilder<Professor> builder)
{
builder.ToTable(nameof(Professor));
builder.HasKey(p => p.Id);
builder.HasIndex(p => p.Id).IsUnique();
builder.Property(p => p.Id).HasColumnType("INT").IsRequired().ValueGeneratedOnAdd();
builder.Property(p => p.Name).HasColumnType("VARCHAR").IsRequired();
builder.Property(p => p.AltName).HasColumnType("VARCHAR");
}
}

View File

@ -1,26 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Mirea.Api.DataAccess.Domain.Schedule;
namespace Mirea.Api.DataAccess.Persistence.EntityTypeConfigurations.Mysql.Schedule;
public class SpecificWeekConfiguration : IEntityTypeConfiguration<SpecificWeek>
{
public void Configure(EntityTypeBuilder<SpecificWeek> builder)
{
builder.ToTable(nameof(SpecificWeek));
builder.HasKey(s => s.Id);
builder.HasIndex(s => s.Id).IsUnique();
builder.Property(s => s.Id).HasColumnType("INT").IsRequired().ValueGeneratedOnAdd();
builder.Property(s => s.WeekNumber).HasColumnType("INT").IsRequired();
builder.Property(s => s.LessonId).HasColumnType("INT").IsRequired();
builder
.HasOne(s => s.Lesson)
.WithMany(l => l.SpecificWeeks)
.HasForeignKey(s => s.LessonId)
.OnDelete(DeleteBehavior.Cascade);
}
}

View File

@ -1,18 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Mirea.Api.DataAccess.Domain.Schedule;
namespace Mirea.Api.DataAccess.Persistence.EntityTypeConfigurations.Mysql.Schedule;
public class TypeOfOccupationConfiguration : IEntityTypeConfiguration<TypeOfOccupation>
{
public void Configure(EntityTypeBuilder<TypeOfOccupation> builder)
{
builder.ToTable(nameof(TypeOfOccupation));
builder.HasKey(t => t.Id);
builder.HasIndex(t => t.Id).IsUnique();
builder.Property(t => t.Id).HasColumnType("INT").IsRequired().ValueGeneratedOnAdd();
builder.Property(t => t.ShortName).HasColumnType("VARCHAR").IsRequired().HasMaxLength(16);
}
}

View File

@ -1,20 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Mirea.Api.DataAccess.Domain.Schedule;
namespace Mirea.Api.DataAccess.Persistence.EntityTypeConfigurations.Postgresql.Schedule;
public sealed class CampusConfiguration : IEntityTypeConfiguration<Campus>
{
public void Configure(EntityTypeBuilder<Campus> builder)
{
builder.ToTable(nameof(Campus));
builder.HasKey(c => c.Id);
builder.HasIndex(c => c.Id).IsUnique();
builder.Property(c => c.Id).HasColumnType("serial").IsRequired().ValueGeneratedOnAdd();
builder.Property(c => c.Address).HasColumnType("text").HasMaxLength(512);
builder.Property(c => c.CodeName).HasColumnType("text").IsRequired().HasMaxLength(16);
builder.Property(c => c.FullName).HasColumnType("text").HasMaxLength(256);
}
}

View File

@ -1,18 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Mirea.Api.DataAccess.Domain.Schedule;
namespace Mirea.Api.DataAccess.Persistence.EntityTypeConfigurations.Postgresql.Schedule;
public class DisciplineConfiguration : IEntityTypeConfiguration<Discipline>
{
public void Configure(EntityTypeBuilder<Discipline> builder)
{
builder.ToTable(nameof(Discipline));
builder.HasKey(d => d.Id);
builder.HasIndex(d => d.Id).IsUnique();
builder.Property(d => d.Id).HasColumnType("serial").IsRequired().ValueGeneratedOnAdd();
builder.Property(d => d.Name).HasColumnType("text").HasMaxLength(256).IsRequired();
}
}

View File

@ -1,26 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Mirea.Api.DataAccess.Domain.Schedule;
namespace Mirea.Api.DataAccess.Persistence.EntityTypeConfigurations.Postgresql.Schedule;
public class FacultyConfiguration : IEntityTypeConfiguration<Faculty>
{
public void Configure(EntityTypeBuilder<Faculty> builder)
{
builder.ToTable(nameof(Faculty));
builder.HasKey(f => f.Id);
builder.HasIndex(f => f.Id).IsUnique();
builder.Property(f => f.Id).HasColumnType("serial").IsRequired().ValueGeneratedOnAdd();
builder.Property(f => f.Name).HasColumnType("text").IsRequired().HasMaxLength(256);
builder.Property(f => f.CampusId).HasColumnType("serial");
builder
.HasOne(f => f.Campus)
.WithMany(c => c.Faculties)
.HasForeignKey(c => c.CampusId)
.OnDelete(DeleteBehavior.SetNull);
}
}

View File

@ -1,25 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Mirea.Api.DataAccess.Domain.Schedule;
namespace Mirea.Api.DataAccess.Persistence.EntityTypeConfigurations.Postgresql.Schedule;
public class GroupConfiguration : IEntityTypeConfiguration<Group>
{
public void Configure(EntityTypeBuilder<Group> builder)
{
builder.ToTable(nameof(Group));
builder.HasKey(g => g.Id);
builder.HasIndex(g => g.Id).IsUnique();
builder.Property(g => g.Id).HasColumnType("serial").IsRequired().ValueGeneratedOnAdd();
builder.Property(g => g.FacultyId).HasColumnType("serial");
builder.Property(g => g.Name).HasColumnType("text").IsRequired().HasMaxLength(64);
builder
.HasOne(g => g.Faculty)
.WithMany(u => u.Groups)
.HasForeignKey(d => d.FacultyId)
.OnDelete(DeleteBehavior.SetNull);
}
}

View File

@ -1,25 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Mirea.Api.DataAccess.Domain.Schedule;
namespace Mirea.Api.DataAccess.Persistence.EntityTypeConfigurations.Postgresql.Schedule;
public class LectureHallConfiguration : IEntityTypeConfiguration<LectureHall>
{
public void Configure(EntityTypeBuilder<LectureHall> builder)
{
builder.ToTable(nameof(LectureHall));
builder.HasKey(l => l.Id);
builder.HasIndex(l => l.Id).IsUnique();
builder.Property(l => l.Id).HasColumnType("INT").IsRequired().ValueGeneratedOnAdd();
builder.Property(l => l.CampusId).HasColumnType("INT").IsRequired();
builder.Property(l => l.Name).HasColumnType("VARCHAR(64)").IsRequired().HasMaxLength(64);
builder
.HasOne(l => l.Campus)
.WithMany(c => c.LectureHalls)
.HasForeignKey(d => d.CampusId)
.OnDelete(DeleteBehavior.Restrict);
}
}

View File

@ -1,48 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Mirea.Api.DataAccess.Domain.Schedule;
namespace Mirea.Api.DataAccess.Persistence.EntityTypeConfigurations.Postgresql.Schedule;
public class LessonAssociationConfiguration : IEntityTypeConfiguration<LessonAssociation>
{
public void Configure(EntityTypeBuilder<LessonAssociation> builder)
{
builder.ToTable(nameof(LessonAssociation));
builder.HasKey(l => l.Id);
builder.HasIndex(l => l.Id).IsUnique();
builder.Property(l => l.Id).HasColumnType("serial").IsRequired().ValueGeneratedOnAdd();
builder.Property(l => l.LinkToMeet).HasColumnType("text").HasMaxLength(512);
builder.Property(l => l.LessonId).HasColumnType("serial").IsRequired();
builder.Property(l => l.ProfessorId).HasColumnType("serial");
builder.Property(l => l.LectureHallId).HasColumnType("serial");
builder.Property(l => l.TypeOfOccupationId).HasColumnType("serial").IsRequired();
builder
.HasOne(l => l.Lesson)
.WithMany(d => d.LessonAssociations)
.HasForeignKey(l => l.LessonId)
.OnDelete(DeleteBehavior.Cascade);
builder
.HasOne(l => l.Professor)
.WithMany(p => p.LessonAssociations)
.HasForeignKey(l => l.ProfessorId)
.OnDelete(DeleteBehavior.SetNull);
builder
.HasOne(l => l.LectureHall)
.WithMany(l => l.LessonAssociations)
.HasForeignKey(l => l.LectureHallId)
.OnDelete(DeleteBehavior.SetNull);
builder
.HasOne(l => l.TypeOfOccupation)
.WithMany(t => t.Lessons)
.HasForeignKey(d => d.TypeOfOccupationId)
.OnDelete(DeleteBehavior.Cascade);
}
}

View File

@ -1,36 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Mirea.Api.DataAccess.Domain.Schedule;
namespace Mirea.Api.DataAccess.Persistence.EntityTypeConfigurations.Postgresql.Schedule;
public class LessonConfiguration : IEntityTypeConfiguration<Lesson>
{
public void Configure(EntityTypeBuilder<Lesson> builder)
{
builder.ToTable(nameof(Lesson));
builder.HasKey(l => l.Id);
builder.HasIndex(l => l.Id).IsUnique();
builder.Property(l => l.Id).HasColumnType("serial").IsRequired().ValueGeneratedOnAdd();
builder.Property(l => l.IsEven).HasColumnType("boolean").IsRequired();
builder.Property(l => l.DayOfWeek).HasColumnType("serial").IsRequired();
builder.Property(l => l.PairNumber).HasColumnType("serial").IsRequired();
builder.Property(l => l.IsExcludedWeeks).HasColumnType("boolean");
builder.Property(l => l.GroupId).HasColumnType("serial").IsRequired();
builder.Property(l => l.DisciplineId).HasColumnType("serial").IsRequired();
builder
.HasOne(l => l.Group)
.WithMany(g => g.Lessons)
.HasForeignKey(d => d.GroupId)
.OnDelete(DeleteBehavior.Cascade);
builder
.HasOne(l => l.Discipline)
.WithMany(d => d.Lessons)
.HasForeignKey(l => l.DisciplineId)
.OnDelete(DeleteBehavior.Cascade);
}
}

View File

@ -1,19 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Mirea.Api.DataAccess.Domain.Schedule;
namespace Mirea.Api.DataAccess.Persistence.EntityTypeConfigurations.Postgresql.Schedule;
public class ProfessorConfiguration : IEntityTypeConfiguration<Professor>
{
public void Configure(EntityTypeBuilder<Professor> builder)
{
builder.ToTable(nameof(Professor));
builder.HasKey(p => p.Id);
builder.HasIndex(p => p.Id).IsUnique();
builder.Property(p => p.Id).HasColumnType("serial").IsRequired().ValueGeneratedOnAdd();
builder.Property(p => p.Name).HasColumnType("text").IsRequired();
builder.Property(p => p.AltName).HasColumnType("text");
}
}

View File

@ -1,26 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Mirea.Api.DataAccess.Domain.Schedule;
namespace Mirea.Api.DataAccess.Persistence.EntityTypeConfigurations.Postgresql.Schedule;
public class SpecificWeekConfiguration : IEntityTypeConfiguration<SpecificWeek>
{
public void Configure(EntityTypeBuilder<SpecificWeek> builder)
{
builder.ToTable(nameof(SpecificWeek));
builder.HasKey(s => s.Id);
builder.HasIndex(s => s.Id).IsUnique();
builder.Property(s => s.Id).HasColumnType("serial").IsRequired().ValueGeneratedOnAdd();
builder.Property(s => s.WeekNumber).HasColumnType("serial").IsRequired();
builder.Property(s => s.LessonId).HasColumnType("serial").IsRequired();
builder
.HasOne(s => s.Lesson)
.WithMany(l => l.SpecificWeeks)
.HasForeignKey(s => s.LessonId)
.OnDelete(DeleteBehavior.Cascade);
}
}

View File

@ -1,18 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Mirea.Api.DataAccess.Domain.Schedule;
namespace Mirea.Api.DataAccess.Persistence.EntityTypeConfigurations.Postgresql.Schedule;
public class TypeOfOccupationConfiguration : IEntityTypeConfiguration<TypeOfOccupation>
{
public void Configure(EntityTypeBuilder<TypeOfOccupation> builder)
{
builder.ToTable(nameof(TypeOfOccupation));
builder.HasKey(t => t.Id);
builder.HasIndex(t => t.Id).IsUnique();
builder.Property(t => t.Id).HasColumnType("serial").IsRequired().ValueGeneratedOnAdd();
builder.Property(t => t.ShortName).HasColumnType("text").IsRequired().HasMaxLength(16);
}
}

View File

@ -13,8 +13,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="8.0.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="8.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.5" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.1" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.4" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.2" />