feat: remove unused ref campus

This commit is contained in:
Polianin Nikita 2024-10-27 06:50:47 +03:00
parent 8c932cf0be
commit dead9f89bb
24 changed files with 1447 additions and 231 deletions

View File

@ -1,36 +0,0 @@
using System.ComponentModel.DataAnnotations;
namespace Mirea.Api.Dto.Responses;
/// <summary>
/// Represents detailed information about a faculty.
/// </summary>
public class FacultyDetailsResponse
{
/// <summary>
/// Gets or sets the unique identifier of the faculty.
/// </summary>
[Required]
public int Id { get; set; }
/// <summary>
/// Gets or sets the name of the faculty.
/// </summary>
[Required]
public required string Name { get; set; }
/// <summary>
/// Gets or sets the unique identifier of the campus to which the faculty belongs (optional).
/// </summary>
public int? CampusId { get; set; }
/// <summary>
/// Gets or sets the name of the campus to which the faculty belongs (optional).
/// </summary>
public string? CampusName { get; set; }
/// <summary>
/// Gets or sets the code name of the campus to which the faculty belongs (optional).
/// </summary>
public string? CampusCode { get; set; }
}

View File

@ -18,9 +18,4 @@ public class FacultyResponse
/// </summary> /// </summary>
[Required] [Required]
public required string Name { get; set; } public required string Name { get; set; }
/// <summary>
/// Gets or sets the unique identifier of the campus to which the faculty belongs (optional).
/// </summary>
public int? CampusId { get; set; }
} }

View File

@ -1,7 +1,6 @@
using Asp.Versioning; using Asp.Versioning;
using MediatR; using MediatR;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Mirea.Api.DataAccess.Application.Cqrs.Faculty.Queries.GetFacultyDetails;
using Mirea.Api.DataAccess.Application.Cqrs.Faculty.Queries.GetFacultyList; using Mirea.Api.DataAccess.Application.Cqrs.Faculty.Queries.GetFacultyList;
using Mirea.Api.Dto.Responses; using Mirea.Api.Dto.Responses;
using Mirea.Api.Endpoint.Common.Attributes; using Mirea.Api.Endpoint.Common.Attributes;
@ -35,34 +34,8 @@ public class FacultyController(IMediator mediator) : BaseController
.Select(f => new FacultyResponse() .Select(f => new FacultyResponse()
{ {
Id = f.Id, Id = f.Id,
Name = f.Name, Name = f.Name
CampusId = f.CampusId
}) })
); );
} }
/// <summary>
/// Gets details of a specific faculty by ID.
/// </summary>
/// <param name="id">Faculty ID.</param>
/// <returns>Details of the specified faculty.</returns>
[HttpGet("{id:int}")]
[BadRequestResponse]
[NotFoundResponse]
public async Task<ActionResult<FacultyDetailsResponse>> GetDetails(int id)
{
var result = await mediator.Send(new GetFacultyInfoQuery()
{
Id = id
});
return Ok(new FacultyDetailsResponse()
{
Id = result.Id,
Name = result.Name,
CampusId = result.CampusId,
CampusCode = result.CampusCode,
CampusName = result.CampusName
});
}
} }

View File

@ -5,9 +5,9 @@
<ImplicitUsings>disable</ImplicitUsings> <ImplicitUsings>disable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<Company>Winsomnia</Company> <Company>Winsomnia</Company>
<Version>1.0.1</Version> <Version>1.0.2</Version>
<AssemblyVersion>1.0.3.1</AssemblyVersion> <AssemblyVersion>1.0.3.2</AssemblyVersion>
<FileVersion>1.0.3.1</FileVersion> <FileVersion>1.0.3.2</FileVersion>
<AssemblyName>Mirea.Api.DataAccess.Application</AssemblyName> <AssemblyName>Mirea.Api.DataAccess.Application</AssemblyName>
<RootNamespace>$(AssemblyName)</RootNamespace> <RootNamespace>$(AssemblyName)</RootNamespace>
</PropertyGroup> </PropertyGroup>

View File

@ -1,32 +0,0 @@
namespace Mirea.Api.DataAccess.Application.Cqrs.Faculty.Queries.GetFacultyDetails;
/// <summary>
/// Represents faculties.
/// </summary>
public class FacultyInfoVm
{
/// <summary>
/// The unique identifier for the faculty.
/// </summary>
public int Id { get; set; }
/// <summary>
/// The name of the faculty.
/// </summary>
public required string Name { get; set; }
/// <summary>
/// ID indicating the faculty's affiliation to the campus.
/// </summary>
public int? CampusId { get; set; }
/// <summary>
/// Campus name indicating the faculty's affiliation to the campus.
/// </summary>
public string? CampusName { get; set; }
/// <summary>
/// Campus code indicating the faculty's affiliation to the campus.
/// </summary>
public string? CampusCode { get; set; }
}

View File

@ -1,8 +0,0 @@
using MediatR;
namespace Mirea.Api.DataAccess.Application.Cqrs.Faculty.Queries.GetFacultyDetails;
public class GetFacultyInfoQuery : IRequest<FacultyInfoVm>
{
public required int Id { get; set; }
}

View File

@ -1,27 +0,0 @@
using MediatR;
using Microsoft.EntityFrameworkCore;
using Mirea.Api.DataAccess.Application.Common.Exceptions;
using Mirea.Api.DataAccess.Application.Interfaces.DbContexts.Schedule;
using System.Threading;
using System.Threading.Tasks;
namespace Mirea.Api.DataAccess.Application.Cqrs.Faculty.Queries.GetFacultyDetails;
public class GetFacultyInfoQueryHandler(IFacultyDbContext dbContext) : IRequestHandler<GetFacultyInfoQuery, FacultyInfoVm>
{
public async Task<FacultyInfoVm> Handle(GetFacultyInfoQuery request, CancellationToken cancellationToken)
{
var faculty = await dbContext.Faculties
.Include(f => f.Campus)
.FirstOrDefaultAsync(f => f.Id == request.Id, cancellationToken) ?? throw new NotFoundException(typeof(Domain.Schedule.Faculty), request.Id);
return new FacultyInfoVm()
{
Id = faculty.Id,
Name = faculty.Name,
CampusId = faculty.CampusId,
CampusName = faculty.Campus?.FullName,
CampusCode = faculty.Campus?.CodeName
};
}
}

View File

@ -14,8 +14,7 @@ public class GetFacultyListQueryHandler(IFacultyDbContext dbContext) : IRequestH
var dtos = dbContext.Faculties.OrderBy(f => f.Id).Select(f => new FacultyLookupDto() var dtos = dbContext.Faculties.OrderBy(f => f.Id).Select(f => new FacultyLookupDto()
{ {
Id = f.Id, Id = f.Id,
Name = f.Name, Name = f.Name
CampusId = f.CampusId
}); });
if (request is { PageSize: not null, Page: not null }) if (request is { PageSize: not null, Page: not null })

View File

@ -5,9 +5,9 @@
<ImplicitUsings>disable</ImplicitUsings> <ImplicitUsings>disable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<Company>Winsomnia</Company> <Company>Winsomnia</Company>
<Version>1.0.0</Version> <Version>1.0.1</Version>
<AssemblyVersion>1.0.3.0</AssemblyVersion> <AssemblyVersion>1.0.3.1</AssemblyVersion>
<FileVersion>1.0.3.0</FileVersion> <FileVersion>1.0.3.1</FileVersion>
<AssemblyName>Mirea.Api.DataAccess.Domain</AssemblyName> <AssemblyName>Mirea.Api.DataAccess.Domain</AssemblyName>
<RootNamespace>$(AssemblyName)</RootNamespace> <RootNamespace>$(AssemblyName)</RootNamespace>
</PropertyGroup> </PropertyGroup>

View File

@ -9,6 +9,5 @@ public class Campus
public string? FullName { get; set; } public string? FullName { get; set; }
public string? Address { get; set; } public string? Address { get; set; }
public List<Faculty>? Faculties { get; set; }
public List<LectureHall>? LectureHalls { get; set; } public List<LectureHall>? LectureHalls { get; set; }
} }

View File

@ -7,8 +7,5 @@ public class Faculty
public int Id { get; set; } public int Id { get; set; }
public required string Name { get; set; } public required string Name { get; set; }
public int? CampusId { get; set; }
public Campus? Campus { get; set; }
public List<Group>? Groups { get; set; } public List<Group>? Groups { get; set; }
} }

View File

@ -0,0 +1,425 @@
// <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("20241027034820_RemoveUnusedRef")]
partial class RemoveUnusedRef
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.10")
.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<string>("Name")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
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("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");
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.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("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

@ -0,0 +1,83 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MysqlMigrations.Migrations
{
/// <inheritdoc />
public partial class RemoveUnusedRef : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Faculty_Campus_CampusId",
table: "Faculty");
migrationBuilder.DropIndex(
name: "IX_Faculty_CampusId",
table: "Faculty");
migrationBuilder.DropColumn(
name: "CampusId",
table: "Faculty");
migrationBuilder.AlterColumn<bool>(
name: "IsExcludedWeeks",
table: "Lesson",
type: "BOOLEAN(1)",
nullable: true,
oldClrType: typeof(ulong),
oldType: "BIT(1)",
oldNullable: true);
migrationBuilder.AlterColumn<bool>(
name: "IsEven",
table: "Lesson",
type: "BOOLEAN(1)",
nullable: false,
oldClrType: typeof(ulong),
oldType: "BIT(1)");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<ulong>(
name: "IsExcludedWeeks",
table: "Lesson",
type: "BIT(1)",
nullable: true,
oldClrType: typeof(bool),
oldType: "BOOLEAN(1)",
oldNullable: true);
migrationBuilder.AlterColumn<ulong>(
name: "IsEven",
table: "Lesson",
type: "BIT(1)",
nullable: false,
oldClrType: typeof(bool),
oldType: "BOOLEAN(1)");
migrationBuilder.AddColumn<int>(
name: "CampusId",
table: "Faculty",
type: "INTEGER",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_Faculty_CampusId",
table: "Faculty",
column: "CampusId");
migrationBuilder.AddForeignKey(
name: "FK_Faculty_Campus_CampusId",
table: "Faculty",
column: "CampusId",
principalTable: "Campus",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
}
}
}

View File

@ -17,7 +17,7 @@ namespace MysqlMigrations.Migrations
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "8.0.6") .HasAnnotation("ProductVersion", "8.0.10")
.HasAnnotation("Relational:MaxIdentifierLength", 64); .HasAnnotation("Relational:MaxIdentifierLength", 64);
MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
@ -80,9 +80,6 @@ namespace MysqlMigrations.Migrations
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id")); MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<int?>("CampusId")
.HasColumnType("INTEGER");
b.Property<string>("Name") b.Property<string>("Name")
.IsRequired() .IsRequired()
.HasMaxLength(256) .HasMaxLength(256)
@ -90,8 +87,6 @@ namespace MysqlMigrations.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("CampusId");
b.HasIndex("Id") b.HasIndex("Id")
.IsUnique(); .IsUnique();
@ -168,10 +163,10 @@ namespace MysqlMigrations.Migrations
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
b.Property<bool>("IsEven") b.Property<bool>("IsEven")
.HasColumnType("BIT(1)"); .HasColumnType("BOOLEAN");
b.Property<bool?>("IsExcludedWeeks") b.Property<bool?>("IsExcludedWeeks")
.HasColumnType("BIT(1)"); .HasColumnType("BOOLEAN");
b.Property<int>("PairNumber") b.Property<int>("PairNumber")
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
@ -296,16 +291,6 @@ namespace MysqlMigrations.Migrations
b.ToTable("TypeOfOccupation", (string)null); 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 => modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Group", b =>
{ {
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Faculty", "Faculty") b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Faculty", "Faculty")
@ -392,8 +377,6 @@ namespace MysqlMigrations.Migrations
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Campus", b => modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Campus", b =>
{ {
b.Navigation("Faculties");
b.Navigation("LectureHalls"); b.Navigation("LectureHalls");
}); });

View File

@ -0,0 +1,425 @@
// <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("20241027032753_RemoveUnusedRef")]
partial class RemoveUnusedRef
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.10")
.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<string>("Name")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
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.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("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

@ -0,0 +1,49 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PsqlMigrations.Migrations
{
/// <inheritdoc />
public partial class RemoveUnusedRef : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Faculty_Campus_CampusId",
table: "Faculty");
migrationBuilder.DropIndex(
name: "IX_Faculty_CampusId",
table: "Faculty");
migrationBuilder.DropColumn(
name: "CampusId",
table: "Faculty");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "CampusId",
table: "Faculty",
type: "INTEGER",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_Faculty_CampusId",
table: "Faculty",
column: "CampusId");
migrationBuilder.AddForeignKey(
name: "FK_Faculty_Campus_CampusId",
table: "Faculty",
column: "CampusId",
principalTable: "Campus",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
}
}
}

View File

@ -17,7 +17,7 @@ namespace PsqlMigrations.Migrations
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "8.0.6") .HasAnnotation("ProductVersion", "8.0.10")
.HasAnnotation("Relational:MaxIdentifierLength", 63); .HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
@ -80,9 +80,6 @@ namespace PsqlMigrations.Migrations
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id")); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int?>("CampusId")
.HasColumnType("INTEGER");
b.Property<string>("Name") b.Property<string>("Name")
.IsRequired() .IsRequired()
.HasMaxLength(256) .HasMaxLength(256)
@ -90,8 +87,6 @@ namespace PsqlMigrations.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("CampusId");
b.HasIndex("Id") b.HasIndex("Id")
.IsUnique(); .IsUnique();
@ -296,16 +291,6 @@ namespace PsqlMigrations.Migrations
b.ToTable("TypeOfOccupation", (string)null); 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 => modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Group", b =>
{ {
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Faculty", "Faculty") b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Faculty", "Faculty")
@ -392,8 +377,6 @@ namespace PsqlMigrations.Migrations
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Campus", b => modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Campus", b =>
{ {
b.Navigation("Faculties");
b.Navigation("LectureHalls"); b.Navigation("LectureHalls");
}); });

View File

@ -0,0 +1,400 @@
// <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("20241027032931_RemoveUnusedRef")]
partial class RemoveUnusedRef
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "8.0.10");
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<string>("Name")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
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.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("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

@ -0,0 +1,49 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace SqliteMigrations.Migrations
{
/// <inheritdoc />
public partial class RemoveUnusedRef : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Faculty_Campus_CampusId",
table: "Faculty");
migrationBuilder.DropIndex(
name: "IX_Faculty_CampusId",
table: "Faculty");
migrationBuilder.DropColumn(
name: "CampusId",
table: "Faculty");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "CampusId",
table: "Faculty",
type: "INTEGER",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_Faculty_CampusId",
table: "Faculty",
column: "CampusId");
migrationBuilder.AddForeignKey(
name: "FK_Faculty_Campus_CampusId",
table: "Faculty",
column: "CampusId",
principalTable: "Campus",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
}
}
}

View File

@ -15,7 +15,7 @@ namespace SqliteMigrations.Migrations
protected override void BuildModel(ModelBuilder modelBuilder) protected override void BuildModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "8.0.6"); modelBuilder.HasAnnotation("ProductVersion", "8.0.10");
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Campus", b => modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Campus", b =>
{ {
@ -69,9 +69,6 @@ namespace SqliteMigrations.Migrations
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
b.Property<int?>("CampusId")
.HasColumnType("INTEGER");
b.Property<string>("Name") b.Property<string>("Name")
.IsRequired() .IsRequired()
.HasMaxLength(256) .HasMaxLength(256)
@ -79,8 +76,6 @@ namespace SqliteMigrations.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("CampusId");
b.HasIndex("Id") b.HasIndex("Id")
.IsUnique(); .IsUnique();
@ -271,16 +266,6 @@ namespace SqliteMigrations.Migrations
b.ToTable("TypeOfOccupation", (string)null); 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 => modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Group", b =>
{ {
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Faculty", "Faculty") b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Faculty", "Faculty")
@ -367,8 +352,6 @@ namespace SqliteMigrations.Migrations
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Campus", b => modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Campus", b =>
{ {
b.Navigation("Faculties");
b.Navigation("LectureHalls"); b.Navigation("LectureHalls");
}); });

View File

@ -14,13 +14,5 @@ public class FacultyConfiguration : IEntityTypeConfiguration<Faculty>
builder.Property(f => f.Id).HasColumnType("INT").IsRequired().ValueGeneratedOnAdd(); builder.Property(f => f.Id).HasColumnType("INT").IsRequired().ValueGeneratedOnAdd();
builder.Property(f => f.Name).HasColumnType("VARCHAR(256)").IsRequired().HasMaxLength(256); 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

@ -14,13 +14,5 @@ public class FacultyConfiguration : IEntityTypeConfiguration<Faculty>
builder.Property(f => f.Id).HasColumnType("serial").IsRequired().ValueGeneratedOnAdd(); builder.Property(f => f.Id).HasColumnType("serial").IsRequired().ValueGeneratedOnAdd();
builder.Property(f => f.Name).HasColumnType("text").IsRequired().HasMaxLength(256); 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

@ -14,13 +14,5 @@ public class FacultyConfiguration : IEntityTypeConfiguration<Faculty>
builder.Property(f => f.Id).HasColumnType("INTEGER").IsRequired().ValueGeneratedOnAdd(); builder.Property(f => f.Id).HasColumnType("INTEGER").IsRequired().ValueGeneratedOnAdd();
builder.Property(f => f.Name).HasColumnType("TEXT").IsRequired().HasMaxLength(256); builder.Property(f => f.Name).HasColumnType("TEXT").IsRequired().HasMaxLength(256);
builder.Property(f => f.CampusId).HasColumnType("INTEGER");
builder
.HasOne(f => f.Campus)
.WithMany(c => c.Faculties)
.HasForeignKey(c => c.CampusId)
.OnDelete(DeleteBehavior.SetNull);
} }
} }

View File

@ -5,9 +5,9 @@
<ImplicitUsings>disable</ImplicitUsings> <ImplicitUsings>disable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<Company>Winsomnia</Company> <Company>Winsomnia</Company>
<Version>1.0.1</Version> <Version>1.0.2</Version>
<AssemblyVersion>1.0.3.1</AssemblyVersion> <AssemblyVersion>1.0.3.2</AssemblyVersion>
<FileVersion>1.0.3.1</FileVersion> <FileVersion>1.0.3.2</FileVersion>
<AssemblyName>Mirea.Api.DataAccess.Persistence</AssemblyName> <AssemblyName>Mirea.Api.DataAccess.Persistence</AssemblyName>
<RootNamespace>$(AssemblyName)</RootNamespace> <RootNamespace>$(AssemblyName)</RootNamespace>
</PropertyGroup> </PropertyGroup>